summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-10-29 11:48:19 -0300
committerTomás Touceda <chiiph@leap.se>2013-10-29 11:48:19 -0300
commit49db36a361a6fe027f2fffacf52d715b11cbdb52 (patch)
treefafbd1bc5f7e085effdf2d37b085e2479dd2f9ac /setup.py
parent4b12d6f003e9b7f4d85e711e78cb186109ec2660 (diff)
parent2b063c0d5b0da8f76c5de64d7bdeb2ee1edf1b93 (diff)
Merge remote-tracking branch 'kali/feature/freeze_debianver_command' into develop
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py72
1 files changed, 60 insertions, 12 deletions
diff --git a/setup.py b/setup.py
index fd87e56c..dca8f44a 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",