summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/feature_4315-freeze-debianver-command1
-rwxr-xr-xsetup.py72
2 files changed, 61 insertions, 12 deletions
diff --git a/changes/feature_4315-freeze-debianver-command b/changes/feature_4315-freeze-debianver-command
new file mode 100644
index 00000000..0ae8ad97
--- /dev/null
+++ b/changes/feature_4315-freeze-debianver-command
@@ -0,0 +1 @@
+- Add a command to setup.py to freeze the versions reported under debian branches. Closes: #4315
diff --git a/setup.py b/setup.py
index e765b39f..67258ba1 100755
--- a/setup.py
+++ b/setup.py
@@ -44,7 +44,6 @@ versioneer.versionfile_build = 'leap/bitmask/_version.py'
versioneer.tag_prefix = '' # tags are like 1.2.0
versioneer.parentdir_prefix = 'leap.bitmask-'
-#from setuptools import Command
# The following import avoids the premature unloading of the `util` submodule
# when running tests, which would cause an error when nose finishes tests and
@@ -74,10 +73,69 @@ trove_classifiers = [
"Topic :: Utilities",
]
+DOWNLOAD_BASE = ('https://github.com/leapcode/bitmask_client/'
+ 'archive/%s.tar.gz')
+_versions = versioneer.get_versions()
+VERSION = _versions['version']
+VERSION_FULL = _versions['full']
+DOWNLOAD_URL = ""
-parsed_reqs = utils.parse_requirements()
+# get the short version for the download url
+_version_short = re.findall('\d+\.\d+\.\d+', VERSION)
+if len(_version_short) > 0:
+ VERSION_SHORT = _version_short[0]
+ DOWNLOAD_URL = DOWNLOAD_BASE % VERSION_SHORT
cmdclass = versioneer.get_cmdclass()
+
+
+from setuptools import Command
+
+
+class freeze_debianver(Command):
+ """
+ Freezes the version in a debian branch.
+ To be used after merging the development branch onto the debian one.
+ """
+ user_options = []
+
+ def initialize_options(self):
+ pass
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ proceed = str(raw_input(
+ "This will overwrite the file _version.py. Continue? [y/N] "))
+ if proceed != "y":
+ print("He. You scared. Aborting.")
+ return
+ template = r"""
+# This file was generated by the `freeze_debianver` command in setup.py
+# Using 'versioneer.py' (0.7+) from
+# revision-control system data, or from the parent directory name of an
+# unpacked source archive. Distribution tarballs contain a pre-generated copy
+# of this file.
+
+version_version = '{version}'
+version_full = '{version_full}'
+"""
+ templatefun = r"""
+
+def get_versions(default={}, verbose=False):
+ return {'version': version_version, 'full': version_full}
+"""
+ subst_template = template.format(
+ version=VERSION_SHORT,
+ version_full=VERSION_FULL) + templatefun
+ with open(versioneer.versionfile_source, 'w') as f:
+ f.write(subst_template)
+
+
+cmdclass["freeze_debianver"] = freeze_debianver
+parsed_reqs = utils.parse_requirements()
+
leap_launcher = 'bitmask=leap.bitmask.app:main'
from setuptools.command.develop import develop as _develop
@@ -150,16 +208,6 @@ if IS_LINUX:
["pkg/linux/resolv-update"]),
]
-DOWNLOAD_BASE = ('https://github.com/leapcode/bitmask_client/'
- 'archive/%s.tar.gz')
-VERSION = versioneer.get_version()
-DOWNLOAD_URL = ""
-
-# get the short version for the download url
-short_ver = re.findall('\d+\.\d+\.\d+', VERSION)
-if len(short_ver) > 0:
- DOWNLOAD_URL = DOWNLOAD_BASE % short_ver[0]
-
setup(
name="leap.bitmask",