From 44b4702eb3ef83950c5b6fe14bf13024c47b89fa Mon Sep 17 00:00:00 2001 From: Elod Illes Date: Thu, 24 Jan 2019 20:07:17 +0100 Subject: [PATCH] Fix Editable Git install package name parsing In pip 19.0 release [1] the Editable Git installs without a remote now freeze as editable. (#4759) [2] bug is fixed. Now the output of pip freeze for such package looks like: # Editable Git install with no remote (neutron==10.0.8.dev66) -e /home/zuul/src/git.openstack.org/openstack/neutron instead of: ## !! Could not determine repository location neutron==10.0.8.dev66 Since for listing the package names the module uses the lines that contains '==' the new behaviour leaves some garbage in front of the package name. So in case the string contains '(' then remove the first part of the string. [1] https://pip.pypa.io/en/stable/news/#id15 [2] https://github.com/pypa/pip/issues/4759 Change-Id: I3573c067f63a09f22377612f53c80c80252965e4 --- roles/tox/library/tox_install_sibling_packages.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/tox/library/tox_install_sibling_packages.py b/roles/tox/library/tox_install_sibling_packages.py index 4dd23b0c2..7d894f81a 100644 --- a/roles/tox/library/tox_install_sibling_packages.py +++ b/roles/tox/library/tox_install_sibling_packages.py @@ -106,7 +106,8 @@ def get_installed_packages(tox_python): frozen_pkgs = subprocess.check_output( [tox_python, '-m', 'pip', '-qqq', 'freeze'] ) - return [x.split('==')[0] for x in frozen_pkgs.split('\n') if '==' in x] + return [x[x.find('(') + 1:].split('==')[0] + for x in frozen_pkgs.split('\n') if '==' in x] def write_new_constraints_file(constraints, packages):