-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3edece9
commit 8d7abbc
Showing
5 changed files
with
36 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python | ||
|
||
import os | ||
import hashlib | ||
import base64 | ||
import sys | ||
|
||
if len(sys.argv) != 4: | ||
raise ValueError("no name/version/tag") | ||
name, version, tag = sys.argv[1:] | ||
|
||
path = os.path.join(f"{name}-{version}.dist-info", "RECORD") | ||
with open(path, "w") as record: | ||
for subdir in [name, f"{name}-{version}.dist-info"]: | ||
for fn in os.listdir(subdir): | ||
fpath = os.path.join(subdir, fn) | ||
if os.path.isfile(fpath): | ||
if fn == "RECORD": | ||
record.write(f"{fpath},,\n") | ||
else: | ||
data = open(fpath, "rb").read() | ||
digest = hashlib.sha256(data).digest() | ||
checksum = base64.urlsafe_b64encode(digest).decode() | ||
size = len(data) | ||
record.write(f"{fpath},sha256={checksum},{size}\n") | ||
|
||
path = os.path.join(f"{name}-{version}.dist-info", "WHEEL") | ||
with open(path, "w") as wheel: | ||
wheel.write("Wheel-Version: 1.0\n") | ||
wheel.write("Generator: custom\n") | ||
wheel.write("Root-Is-Purelib: false\n") | ||
wheel.write(f"Tag: {tag}\n") |