summaryrefslogtreecommitdiff
path: root/.ci/pypi-check.py
diff options
context:
space:
mode:
authorElvis Pranskevichus <elvis@magic.io>2018-03-30 19:47:52 -0400
committerElvis Pranskevichus <elvis@magic.io>2018-03-30 20:50:17 -0400
commita1b19e1d10896f3ac2ce0b97c2bf24e0c1c4520f (patch)
tree283ca8f24adc74d1092cf24b7bd66174a0014b51 /.ci/pypi-check.py
parent0e715340a78863d973302981ab98b232d6f51735 (diff)
downloadimmutables-a1b19e1d10896f3ac2ce0b97c2bf24e0c1c4520f.tar.gz
immutables-a1b19e1d10896f3ac2ce0b97c2bf24e0c1c4520f.zip
CI integration
Diffstat (limited to '.ci/pypi-check.py')
-rwxr-xr-x.ci/pypi-check.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/.ci/pypi-check.py b/.ci/pypi-check.py
new file mode 100755
index 0000000..1b9c11c
--- /dev/null
+++ b/.ci/pypi-check.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python3
+
+
+import argparse
+import sys
+import xmlrpc.client
+
+
+def main():
+ parser = argparse.ArgumentParser(description='PyPI package checker')
+ parser.add_argument('package_name', metavar='PACKAGE-NAME')
+
+ parser.add_argument(
+ '--pypi-index-url',
+ help=('PyPI index URL.'),
+ default='https://pypi.python.org/pypi')
+
+ args = parser.parse_args()
+
+ pypi = xmlrpc.client.ServerProxy(args.pypi_index_url)
+ releases = pypi.package_releases(args.package_name)
+
+ if releases:
+ print(next(iter(sorted(releases, reverse=True))))
+
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main())