setup_venv: Fix handling of Git requirements.

get_package_names did not correctly strip the GitHub URLs from package
names, resulting in the "package names" for our dependencies installed
from Git being tracked with the complete sha1sum included in the name.
This meant that upgrading our virtualenvs incorrectly ended up
resorting to creating an entirely new virtualenv whenever we changed a
dependency that had previously been installed from GitHub URLs.
This commit is contained in:
Tim Abbott 2016-10-15 23:58:09 -07:00
parent e37b6488b8
commit fcde846b58
1 changed files with 7 additions and 0 deletions

View File

@ -45,6 +45,13 @@ def get_package_names(requirements_file):
cleaned = [] cleaned = []
operators = ['~=', '==', '!=', '<', '>'] operators = ['~=', '==', '!=', '<', '>']
for package in packages: for package in packages:
if package.startswith("git+https://") and '#egg=' in package:
split_package = package.split("#egg=")
if len(split_package) != 2:
raise Exception("Unexpected duplicate #egg in package %s" % (package,))
# Extract the package name from Git requirements entries
package = split_package[1]
for operator in operators: for operator in operators:
if operator in package: if operator in package:
package = package.split(operator)[0] package = package.split(operator)[0]