diff options
| author | Kali Kaneko <kali@leap.se> | 2013-10-29 12:36:12 -0200 | 
|---|---|---|
| committer | Kali Kaneko <kali@leap.se> | 2013-10-29 12:36:12 -0200 | 
| commit | 2b063c0d5b0da8f76c5de64d7bdeb2ee1edf1b93 (patch) | |
| tree | c485c699059a34ff33414ec0597091aa7ddbdc93 | |
| parent | 856a3301b025f3d14c36a0ec0c90563358780670 (diff) | |
Adds a command to freeze debian versions.
| -rw-r--r-- | changes/feature_4315-freeze-debianver-command | 1 | ||||
| -rwxr-xr-x | setup.py | 72 | 
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 @@ -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", | 
