-
-
Notifications
You must be signed in to change notification settings - Fork 606
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
Nuitka doesn't support pkg_resources.get_distribution #146
Comments
With 0.6.1 release, I want to work on this for the next release. |
Hi @kayhayen, Thanks |
I have had similar issues in the past with |
There is a plugin in Nuitka that detects these kinds of version stuff, and resolves them now at compile time to the correct value, avoiding any runtime code, which makes this a solved issue. |
@kayhayen maybe you can link to the plugin? |
It's automatically enabled. |
Sometimes code will check installed package versions with require or use the version information of installed packages for outputs. For standalone packages that does not work:
__version__ = pkg_resources.get_distribution('requests').version
However, by teaching pkg_resources about our meta path based importer, we could convince it
to provide the information even when egg data, etc. has been lost.
The source of the information is easy to get:
This produces a dictionary with the information to use to produce
Distribution
objects at run time.This apparently mostly does the job, but is bare of robustness:
This code could become a post-load for
pkg_resources
to monkey patch it for finding resources hidden in the meta path based loader. Our meta path based loader should not be assumed to be only one (it is not for Python3 anyway), but directly accessed.Also maybe it could read the distribution data from disk, to avoid caching issues, and it's nicer
to read that way probably too.
The text was updated successfully, but these errors were encountered: