From 1e82571b3d7f34c0760c63ba8553024db86c29bc Mon Sep 17 00:00:00 2001 From: Brian May Date: Wed, 13 Jan 2016 17:30:38 +1100 Subject: [PATCH] Experimental: Use setuptools-scm Closes: #58 --- .gitignore | 1 + setup.py | 14 +++++++++++--- sshuttle/__main__.py | 5 +++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 152e0e5..76398bb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +sshuttle/version.py *.pyc *~ *.8 diff --git a/setup.py b/setup.py index fecf822..f67dee8 100755 --- a/setup.py +++ b/setup.py @@ -19,12 +19,20 @@ from setuptools import setup, find_packages -with open('VERSION.txt', 'r') as f: - version = f.readline().strip() + +def version_scheme(version): + from setuptools_scm.version import guess_next_dev_version + version = guess_next_dev_version(version) + return version.lstrip("v") setup( name="sshuttle", - version=version, + use_scm_version={ + 'write_to': "sshuttle/version.py", + 'version_scheme': version_scheme, + }, + setup_requires=['setuptools_scm'], + # version=version, url='https://github.com/sshuttle/sshuttle', author='Brian May', author_email='brian@linuxpenguins.xyz', diff --git a/sshuttle/__main__.py b/sshuttle/__main__.py index f2cdc57..19803d0 100644 --- a/sshuttle/__main__.py +++ b/sshuttle/__main__.py @@ -126,6 +126,7 @@ r,remote= ssh hostname (and optional username) of remote sshuttle server x,exclude= exclude this subnet (can be used more than once) X,exclude-from= exclude the subnets in a file (whitespace separated) v,verbose increase debug message verbosity +V,version print the sshuttle version number and exit e,ssh-cmd= the command to use to connect to the remote [ssh] seed-hosts= with -H, use these hostnames for initial scan (comma-separated) no-latency-control sacrifice latency to improve bandwidth benchmarks @@ -142,6 +143,10 @@ hostwatch (internal use only) o = options.Options(optspec) (opt, flags, extra) = o.parse(sys.argv[1:]) +if opt.version: + from sshuttle.version import version + print(version) + exit(0) if opt.daemon: opt.syslog = 1 if opt.wrap: