capstone icon indicating copy to clipboard operation
capstone copied to clipboard

Py bindings: use pkg_resources to set package version

Open disconnect3d opened this issue 6 years ago • 4 comments

This was inspired by the fact we forgot to set the package version when Capstone 4.0.1 was released: https://github.com/aquynh/capstone/issues/1315#issuecomment-454386418

...now we won't need to set the Python bindings version manually :).

disconnect3d avatar Jan 15 '19 16:01 disconnect3d

So this fails the build:


0.16s$ if [[ "$NOPYTEST" != "true" ]]; then cd bindings/python && make check; fi
Check test_basic.py ...
Traceback (most recent call last):
  File "./test_basic.py", line 5, in <module>
    from capstone import *
  File "/home/travis/build/aquynh/capstone/bindings/python/capstone/__init__.py", line 131, in <module>
    __version__ = pkg_resources.get_distribution("capstone").version
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 564, in get_distribution
    dist = get_provider(dist)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 436, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 984, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 870, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'capstone' distribution was not found and is required by the application
FAILED
make: *** [check] Error 1
The command "if [[ "$NOPYTEST" != "true" ]]; then cd bindings/python && make check; fi" exited with 2.

as the tests doesn't install the package, but they should! ;)

disconnect3d avatar Jan 15 '19 17:01 disconnect3d

will you continue to update this pull req?

aquynh avatar Jan 28 '19 08:01 aquynh

@aquynh Updated. Lets see if it builds/passes now.

disconnect3d avatar Jan 30 '19 15:01 disconnect3d

this is better, but still breaks on Mac

aquynh avatar Jan 31 '19 02:01 aquynh

Thank you for the PR! I closed it because it is out of date. With the new auto-sync update for v6 we made many changes to some main architectures and will do also to others. This also changed the requirements we have now for new PRs.

If you still want to merge the changes, please rebase your fix onto the newest next branch and open a new PR.

Rot127 avatar Mar 20 '24 09:03 Rot127