mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
Utility tool to wait until package is available on pypi
This commit is contained in:
parent
b955c377f1
commit
cef04cfd2a
@ -2,6 +2,7 @@ import argparse
|
|||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
from subprocess import check_output
|
from subprocess import check_output
|
||||||
from packaging import tags
|
from packaging import tags
|
||||||
from packaging.utils import parse_wheel_filename
|
from packaging.utils import parse_wheel_filename
|
||||||
@ -86,6 +87,11 @@ def main():
|
|||||||
action="store_true",
|
action="store_true",
|
||||||
help="Check if package is on pypi already, fails with exit code 1 if available",
|
help="Check if package is on pypi already, fails with exit code 1 if available",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--wait-pip",
|
||||||
|
action="store_true",
|
||||||
|
help="Wait until package is on pypi, fails with exit code 1 if still not available after 300s",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--get-git-version",
|
"--get-git-version",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
@ -115,6 +121,15 @@ def main():
|
|||||||
if is_package_available(args.package, version):
|
if is_package_available(args.package, version):
|
||||||
print(f"{args.package}=={version} is already on pypi")
|
print(f"{args.package}=={version} is already on pypi")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
elif args.wait_pip:
|
||||||
|
version = get_version(args.dir)
|
||||||
|
t0 = time.time()
|
||||||
|
while time.time()-t0 < 300 and not is_package_available(args.package, version):
|
||||||
|
time.sleep(20)
|
||||||
|
|
||||||
|
if not is_package_available(args.package, version):
|
||||||
|
print(f"Timeout waiting for package {args.package}=={version} to be available on pypi")
|
||||||
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
print("no action")
|
print("no action")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user