Fix bug where packages with literal hyphens don't parse right.

This commit is contained in:
voussoir 2020-01-15 22:47:52 -08:00
parent 2d5ef0c7cf
commit 725a91f1cc

View file

@ -21,13 +21,15 @@ def pip_download(package):
subprocess.call([sys.executable, '-m', 'pip', 'download', package, '-d', tmpdir.name]) subprocess.call([sys.executable, '-m', 'pip', 'download', package, '-d', tmpdir.name])
downloaded_files = os.listdir(tmpdir.name) downloaded_files = os.listdir(tmpdir.name)
for filename in downloaded_files: for filename in downloaded_files:
parts = filename.split('-') filename = filename.lower()
filename_package = parts[0] prefix = package.lower() + '-'
if filename_package.lower() == package.lower(): if filename.startswith(prefix):
parts = filename.replace(prefix, '')
parts = parts.split('-')
version = parts[0]
break break
else: else:
raise Exception(f'None of the downloads match the package name {package}? {downloaded_files}') raise Exception(f'None of the downloads match the package name {package}? {downloaded_files}')
version = parts[1]
version = clean_version(version) version = clean_version(version)
new_directory = f'{package}\\{package}-{version}' new_directory = f'{package}\\{package}-{version}'
if not os.path.exists(new_directory): if not os.path.exists(new_directory):