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
This commit is contained in:
Elod Illes 2019-01-24 20:07:17 +01:00
parent cce734c667
commit 44b4702eb3
1 changed files with 2 additions and 1 deletions

View File

@ -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):