mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-16 15:35:54 +08:00
Allow giving a specific OS when looking for pip package
CURA-12404
This commit is contained in:
parent
5cf52a5d85
commit
b2bb7c6c3e
@ -3,7 +3,7 @@ import argparse
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
def get_package_wheel_hashes(package, version):
|
def get_package_wheel_hashes(package, version, os):
|
||||||
url = f"https://pypi.org/pypi/{package}/{version}/json"
|
url = f"https://pypi.org/pypi/{package}/{version}/json"
|
||||||
data = requests.get(url).json()
|
data = requests.get(url).json()
|
||||||
|
|
||||||
@ -12,6 +12,7 @@ def get_package_wheel_hashes(package, version):
|
|||||||
print(f" hashes:")
|
print(f" hashes:")
|
||||||
|
|
||||||
for url in data["urls"]:
|
for url in data["urls"]:
|
||||||
|
if os is None or os in url["filename"]:
|
||||||
print(f" - sha256:{url['digests']['sha256']}")
|
print(f" - sha256:{url['digests']['sha256']}")
|
||||||
|
|
||||||
|
|
||||||
@ -20,5 +21,6 @@ if __name__ == "__main__":
|
|||||||
description="Display the hashes of the wheel files to be inserted in pip_requirements")
|
description="Display the hashes of the wheel files to be inserted in pip_requirements")
|
||||||
parser.add_argument("package", type=Path, help="Name of the target package")
|
parser.add_argument("package", type=Path, help="Name of the target package")
|
||||||
parser.add_argument("version", type=Path, help="Version of the target package")
|
parser.add_argument("version", type=Path, help="Version of the target package")
|
||||||
|
parser.add_argument('--os', type=str, help='Specific package OS', choices=['win', 'macosx', 'manylinux', 'musllinux'])
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
get_package_wheel_hashes(args.package, args.version)
|
get_package_wheel_hashes(args.package, args.version, args.os)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user