From 8e3f3c60448279ab03a378d3961ad212afb08eab Mon Sep 17 00:00:00 2001 From: Joe Testa Date: Sat, 11 Jul 2020 12:42:11 -0400 Subject: [PATCH] Updated PyPI notes. --- packages/notes.txt | 2 +- packages/setup.py | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/notes.txt b/packages/notes.txt index 784bb55..a02cf9b 100644 --- a/packages/notes.txt +++ b/packages/notes.txt @@ -7,7 +7,7 @@ $ virtualenv -p /usr/bin/python3 /tmp/pypi_upload $ cd /tmp/pypi_upload; source bin/activate $ pip3 install twine $ cp -R path/to/ssh-audit . -$ cd ssh-audit/pypi +$ cd ssh-audit/packages $ make -f Makefile.pypi $ make -f Makefile.pypi uploadtest diff --git a/packages/setup.py b/packages/setup.py index c4daba9..f24c33c 100644 --- a/packages/setup.py +++ b/packages/setup.py @@ -2,10 +2,21 @@ import re +import sys from setuptools import setup +print_warning = False +m = re.search(r'^VERSION\s*=\s*\'v(\d\.\d\.\d)\'', open('sshaudit/sshaudit.py').read(), re.M) +if m is None: + # If we failed to parse the stable version, see if this is the development version. + m = re.search(r'^VERSION\s*=\s*\'v(\d\.\d\.\d-dev)\'', open('sshaudit/sshaudit.py').read(), re.M) + if m is None: + print("Error: could not parse VERSION variable from ssh-audit.py.") + sys.exit(1) + else: # Continue with the development version, but print a warning later. + print_warning = True -version = re.search(r'^VERSION\s*=\s*\'v(\d\.\d\.\d)\'', open('sshaudit/sshaudit.py').read(), re.M).group(1) +version = m.group(1) print("\n\nPackaging ssh-audit v%s...\n\n" % version) with open("sshaudit/README.md", "rb") as f: @@ -42,3 +53,6 @@ setup( "Topic :: Security", "Topic :: Security :: Cryptography" ]) + +if print_warning: + print("\n\n !!! WARNING: development version detected (%s). Are you sure you want to package this version? Probably not...\n" % version)