-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python bindings: Fully remove distutils and pkg_resources #2369
Conversation
|
@pyrox0 please rebase this PR on top of the latest |
@kabeor and @aquynh This seems to be the cd .. && python3 const_generator.py python
Generating bindings for python
Generating bindings for python
Check test_basic.py ...
Traceback (most recent call last):
File "./test_basic.py", line 4, in <module>
from capstone import *
File "/home/runner/work/capstone/capstone/bindings/python/capstone/__init__.py", line 388, in <module>
from importlib import resources
ImportError: cannot import name 'resources'
FAILED
make: *** [Makefile:51: check] Error 1
Error: Process completed with exit code 2. @pyrox0 Could you check if this is also related to Python3.6 incompatibility?
|
I think for Python3 we can just support the modern versions, and ignore the EOLF ones. |
@pyrox0 Then feel free and go ahead with removing Python 3.6. |
Python 3.9 still complaints:
|
Removes distutils from the setup.py script for the python bindings, as it is removed in Python 3.12 onwards.
Since support is removed per maintainer request, this should be removed from the test suite as well.
Needed to fix a setuptools error on python 3.9
Python 3.11
Python 3.9:
and CSFuzz:
Sorry, I know these bug classes are super annoying. I really appreciate you take care of this part of the Python bindings! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See bindings/python/capstone/__init__.py:434
(_load_lib
call):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/capstone-5.0.0.post1-py3.11.egg/capstone/__init__.py", line 434, in <module>
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/capstone-5.0.0.post1-py3.11.egg/capstone/__init__.py", line 405, in _load_lib
File "<frozen posixpath>", line 76, in join
TypeError: expected str, bytes or os.PathLike object, not Path
@pyrox0 @twizmwazin We just reverted #2391, because it broke the CI fuzz job and I wanted to have it work for the bigger PRs for now (Xtensa, LoongArch, AArch64). #2378 was unfortunately incomplete, as it turned out. Python2 is used in @twizmwazin Please update google/oss-fuzz#12028 to use Also, there are plenty of other scripts which have a shebang of Some of them are Python2 scripts, which can be deleted. |
@pyrox0 Just saw that this PR is the only one which stops us from releasing But do you think you find time in the next week to finish the |
OSS-Fuzz PR updated |
Google folks merged google/oss-fuzz#12028 |
@Rot127 I guess this one could be closed as parts of it were used for the PR that is merged already? |
Indeed |
Your checklist for this pull request
Detailed description
Distutils has been fully removed from the
setup.py
script. This was done because Python 3.12 removes this package, so this ensures that this will continue to function in the future. The code only minimally changes, as the actual APIs are implemented in other parts of the standard library, so this just replaces the distutils functions with appropriate functions from elsewhere.I've also replaced the deprecated
pkg_resources
withimportlib.resources
, as in its own documentation, it's mentioned thatpkg_resources
is a deprecated API, and projects using it should migrate toimportlib
-based solutions, which I've done. The code changes slightly, but it's all based on the migration guide provided by importlib....
Test plan
N/A
...
Closing issues
...