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
pyudev.glib incompatible with Python 3 #33
Comments
glib support isn't tested against Python 3, because I didn't know that pygobject already supports Python 3. Do you know which version (unpatched of course) of pygobject introduced Python 3 support? |
So there is no released version with Python 3 support yet? In this case, you are on your own for now. I'm not using the glib module myself, and thus need the unit tests to make sure that the glib module works. The unit tests don't run with checkouts from git, but with released versions, and I simply lack the time to adapt the test toolchain to support tests against a git clone of pygobject. I'm sorry. I don't see any reason to support something that isn't even released yet anyway. Closing as invalid for now, please re-open, if I'm mistaken and there is a released pygobject version with Python 3, or if a new pygobject release provides Python 3 support. Of course, if you can provide patches for pyudev.glib to add Python 3 support, I'll gladly accept these and commit them,as long as they are covered by tests. |
This patch avoid problem during importing:
|
Already existing tests for pyudev.glib in tests/test_observer.py pass with this patch applied. |
I doubt that the patch passes tests on Python 2. Did you try that? And please don't use |
setup.py uses 2to3, which changes 'import glib' into 'from . import glib'. How do you suggest to fix it? |
This patch works with Python 2 and 3:
|
I managed to get pygobject building against Python 3, so now I'm able to run the pyudev.glib tests with Python 3. The bug is indeed very valid, sorry for all the hassle. I'll take care for this issue asap, I just need to figure out the best way to fix the glitches. The import is the biggest problem. In theory it is written to support python 2 and python 3, but unfortunately 2to3 fails to handle such imports correctly (an upstream bug in python). I'll probably have to adjust the 2to3 fixers used to generate the Python 3 code. |
2to3 "import" fixers blews up absolute imports by changing them back to relative imports in some python versions, see #8358. Affects the "pyudev.glib" module, which uses an absolute import for "glib". Applying the "import" fixer to this module breaks pyudev.glib for python 3.
Python issue #8358 was already fixed in Python version used by me. |
I already had doubts about #8358 myself, because it's marked fixed since over a year ago. But I didn't investigate the cause of this issue further, because it was obviously solved by disabling the |
And just for the record: Yesterday I released pyudev 0.12 which fixes this issue. |
I use pygobject-2.28.6 with some patches backported from pygobject repository. This version of pygobject has been separately built and installed for each version of Python.
2to3 changed 'import glib' into 'from . import glib' during processing of pyudev/glib.py.
If I manually revert this change, then the following error occurs:
The text was updated successfully, but these errors were encountered: