summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian May <brian@linuxpenguins.xyz>2016-01-13 17:30:38 +1100
committerBrian May <brian@linuxpenguins.xyz>2016-01-13 19:00:08 +1100
commit1e82571b3d7f34c0760c63ba8553024db86c29bc (patch)
treefc6b4070fe0635b72022a7e312b01e1ca861c835
parentaab973f12e24a50b57b026cf31ff86fb19b1abd5 (diff)
Experimental: Use setuptools-scm
Closes: #58
-rw-r--r--.gitignore1
-rwxr-xr-xsetup.py14
-rw-r--r--sshuttle/__main__.py5
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: