Skip to content
Snippets Groups Projects
Commit 2443bc4a authored by Steffen Müthing's avatar Steffen Müthing
Browse files

Make Python package detection work with pip 10

pip 10 moved several interfaces to an internal package, causing our pyversion.py script to fail.
This patches fixes the issue by getting installed distributions directly from setuptools, as
suggested in https://github.com/pypa/pip/issues/5243.
parent 63b46abe
No related branches found
No related tags found
1 merge request!540Make Python package detection work with pip 10
Pipeline #10325 passed
......@@ -21,11 +21,11 @@ if hasattr(module, '__version__'):
# Alternative implementation: through pip (pip itself implement pip.__version__,
# so we never get here, when checking the version of pip itself), only works if
# package name and distribution name are the same
import pip
for package in pip.get_installed_distributions():
import pkg_resources
for package in pkg_resources.working_set:
if package.project_name == modstr and package.has_version():
sys.stdout.write(package.version)
sys.exit(0)
# Give up on this one
sys.exit(1)
\ No newline at end of file
sys.exit(1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment