From 2443bc4ad29ef365ef652ef538846348a61343c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Steffen=20M=C3=BCthing?=
 <steffen.muething@iwr.uni-heidelberg.de>
Date: Sat, 30 Jun 2018 14:48:17 +0200
Subject: [PATCH] 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.
---
 cmake/scripts/pyversion.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cmake/scripts/pyversion.py b/cmake/scripts/pyversion.py
index 44fb29467..1e5968e95 100644
--- a/cmake/scripts/pyversion.py
+++ b/cmake/scripts/pyversion.py
@@ -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)
-- 
GitLab