Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates the script to add multiple wheel hashes #85

Merged
merged 1 commit into from
Nov 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 11 additions & 5 deletions scripts/update-requirements
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,15 @@ def add_sha256sums(path: str, requirements_lines: str) -> None:
missing_wheels = []

# For each dependency in the requirements file
for line in requirements_lines:
package_name_and_version = line.strip().split()[0]
for mainline in requirements_lines:
package_name_and_version = mainline.strip().split()[0]
package_name = package_name_and_version.split('==')[0]
package_version = package_name_and_version.split('==')[1]

wheel_name_prefix = '{}-{}'.format(package_name, package_version)
package_othername = '{}-{}'.format(package_name.replace("-", "_"), package_version)

line = ""
for name in files:
lowername = name[1].lower()
digest = name[0]
Expand All @@ -93,9 +94,14 @@ def add_sha256sums(path: str, requirements_lines: str) -> None:
package_othername
):
# Now add the hash to the line
line = "{} --hash=sha256:{}\n".format(
package_name_and_version, digest)

if line.find("--hash") == -1:
line = "{} --hash=sha256:{}".format(
package_name_and_version, digest)
else:
# Means a second wheel hash
line += " --hash=sha256:{}".format(digest)

line += "\n"
newlines.append(line)
if line.find("--hash") == -1: # Missing wheel
missing_wheels.append(package_name_and_version)
Expand Down