Skip to content

Commit 9f8fc42

Browse files
authored
Fix wait-for-pypi script (#88)
1 parent 0ffa99c commit 9f8fc42

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

codebuild/cd/publish_to_prod_pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ phases:
2222
- CURRENT_TAG_VERSION=$(git describe --tags | cut -f2 -dv)
2323
- python3 continuous-delivery/pull-pypirc.py prod
2424
- python3 -m twine upload -r pypi ../dist/*
25-
- python3 continuous-delivery/wait-for-pypi.py awscrt $CURRENT_TAG_VERSION --index-url https://pypi.org/simple
25+
- python3 continuous-delivery/wait-for-pypi.py awscrt $CURRENT_TAG_VERSION --index https://pypi.python.org/pypi
2626
post_build:
2727
commands:
2828
- echo Build completed on `date`

codebuild/cd/publish_to_test_pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ phases:
2222
- CURRENT_TAG_VERSION=$(git describe --tags | cut -f2 -dv)
2323
- python3 continuous-delivery/pull-pypirc.py alpha
2424
- python3 -m twine upload -r testpypi ../dist/*
25-
- python3 continuous-delivery/wait-for-pypi.py awscrt $CURRENT_TAG_VERSION --index-url https://testpypi.python.org/simple
25+
- python3 continuous-delivery/wait-for-pypi.py awscrt $CURRENT_TAG_VERSION --index https://test.pypi.org/pypi
2626
post_build:
2727
commands:
2828
- echo Build completed on `date`

continuous-delivery/wait-for-pypi.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
import sys
44
import time
55

6-
DEFAULT_TIMEOUT = 1800
6+
DEFAULT_TIMEOUT = 60 * 30 # 30 min
77
DEFAULT_INTERVAL = 5
8-
DEFAULT_INDEX_URL = 'https://pypi.org/simple'
8+
DEFAULT_INDEX_URL = 'https://pypi.python.org/pypi'
99

1010

1111
def wait(package, version, index_url=DEFAULT_INDEX_URL, timeout=DEFAULT_TIMEOUT, interval=DEFAULT_INTERVAL):
1212
give_up_time = time.time() + timeout
1313
while True:
14-
output = subprocess.check_output([sys.executable, '-m', 'pip', '--index', index_url, 'search', package])
14+
output = subprocess.check_output([sys.executable, '-m', 'pip', 'search', '--index', index_url, package])
1515
output = output.decode()
1616

1717
# output looks like: 'awscrt (0.3.1) - A common runtime for AWS Python projects\n...'
@@ -28,12 +28,15 @@ def wait(package, version, index_url=DEFAULT_INDEX_URL, timeout=DEFAULT_TIMEOUT,
2828
parser = argparse.ArgumentParser()
2929
parser.add_argument('package', help="Packet name")
3030
parser.add_argument('version', help="Package version")
31-
parser.add_argument('-i', '--index-url', default=DEFAULT_INDEX_URL, help="PyPI URL")
32-
parser.add_argument('--timeout', type=float, default=DEFAULT_TIMEOUT, help="Give up after N seconds.")
33-
parser.add_argument('--interval', type=float, default=DEFAULT_INTERVAL, help="Query PyPI every N seconds")
31+
parser.add_argument('--index', default=DEFAULT_INDEX_URL, metavar='<url>',
32+
help="Base URL of Python Package Index. (default {})".format(DEFAULT_INDEX_URL))
33+
parser.add_argument('--timeout', type=float, default=DEFAULT_TIMEOUT, metavar='<sec>',
34+
help="Give up after N seconds.")
35+
parser.add_argument('--interval', type=float, default=DEFAULT_INTERVAL, metavar='<sec>',
36+
help="Query PyPI every N seconds")
3437
args = parser.parse_args()
3538

36-
if wait(args.package, args.version, args.index_url, args.timeout, args.interval):
39+
if wait(args.package, args.version, args.index, args.timeout, args.interval):
3740
print('{} {} is available in pypi'.format(args.package, args.version))
3841
else:
3942
exit("Timed out waiting for pypi to report {} {} as latest".format(args.package, args.version))

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def awscrt_ext():
241241

242242
setuptools.setup(
243243
name="awscrt",
244-
version="0.3.2",
244+
version="0.3.3",
245245
author="Amazon Web Services, Inc",
246246
author_email="[email protected]",
247247
description="A common runtime for AWS Python projects",

0 commit comments

Comments
 (0)