ssh-audit/setup.py
Ganden Schaffner b15664929f
Improve PyPI packaging (#71)
* Move files for better setup.py packaging

* Update setup.py and configs for src layout

* Run tests on setup.py build

In effect, this tests that the setup.py configuration is correct.

coverage combine and coverage:paths are added to keep the displayed
coverage paths as src/ssh_audit/*.py instead of
.tox/$envname/**/site-packages/ssh_audit/*.py

* Remove unnecessary encoding declarations

Python 3 defaults to UTF-8 encoding.
https://docs.python.org/3/reference/lexical_analysis.html#encoding-declarations

* Remove shebang from colorama type stubs

Shouldn't need to be an executable.
Related: git has this file tracked as chmod -x.
2020-10-11 14:03:02 -04:00

24 lines
871 B
Python

import re
import sys
from setuptools import setup
print_warning = False
m = re.search(r'^VERSION\s*=\s*\'v(\d\.\d\.\d)\'', open('src/ssh_audit/ssh_audit.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('src/ssh_audit/ssh_audit.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 = m.group(1)
print("\n\nPackaging ssh-audit v%s...\n\n" % version)
# see setup.cfg
setup()
if print_warning:
print("\n\n !!! WARNING: development version detected (%s). Are you sure you want to package this version? Probably not...\n" % version)