diff options
author | Calum Lind <calumlind+deluge@gmail.com> | 2016-11-26 17:47:09 +0000 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2016-11-26 17:51:07 +0000 |
commit | 943a9ded00660668100d2f7c7cdba3fddb9694ea (patch) | |
tree | a63317a7a3b10665d5c031f672ec0d1ac7292983 /version.py | |
parent | 04370b38ece66c65ccbe1f85a65c4831b9ddca21 (diff) | |
download | deluge-943a9ded00660668100d2f7c7cdba3fddb9694ea.tar.gz deluge-943a9ded00660668100d2f7c7cdba3fddb9694ea.tar.bz2 deluge-943a9ded00660668100d2f7c7cdba3fddb9694ea.zip |
Rename version.py to calc_version.py to fix buildd error
- There is a version.py included with buildd that is conflicting
with the deluge one. Rather than messing with sys.path it is
simplest to rename version.py to calc_version.py
Diffstat (limited to 'version.py')
-rwxr-xr-x | version.py | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/version.py b/version.py deleted file mode 100755 index e6e3f76fa..000000000 --- a/version.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Authors: Douglas Creager <dcreager@dcreager.net> -# Calum Lind <calumlind@gmail.com> -# -# This file is placed into the public domain. -# -# Calculates the current version number by first checking output of “git describe”, -# modified to conform to PEP 386 versioning scheme. If “git describe” fails -# (likely due to using release tarball rather than git working copy), then fall -# back on reading the contents of the RELEASE-VERSION file. -# -# Usage: Import in setup.py, and use result of get_version() as package version: -# -# from version import * -# -# setup( -# ... -# version=get_version(), -# ... -# ) -# -# Script will automatically update the RELEASE-VERSION file, if needed. -# Note that RELEASE-VERSION file should *not* be checked into git; please add -# it to your top-level .gitignore file. -# -# You'll probably want to distribute the RELEASE-VERSION file in your -# sdist tarballs; to do this, just create a MANIFEST.in file that -# contains the following line: -# -# include RELEASE-VERSION -# - -from __future__ import print_function - -import os -from subprocess import PIPE, Popen - -__all__ = ('get_version') - -VERSION_FILE = os.path.join(os.path.dirname(__file__), 'RELEASE-VERSION') - - -def call_git_describe(prefix='', suffix=''): - cmd = 'git describe --tags --match %s[0-9]*' % prefix - try: - output = Popen(cmd.split(), stdout=PIPE, stderr=PIPE).communicate() - version = output[0].decode('utf-8').strip().replace(prefix, '') - if '-' in version: - version = '.dev'.join(version.replace(suffix, '').split('-')[:2]) - return version - except OSError: - return None - - -def get_version(prefix='', suffix=''): - try: - with open(VERSION_FILE, 'r') as f: - release_version = f.readline().strip() - except IOError: - release_version = None - - version = call_git_describe(prefix, suffix) - - if not version: - version = release_version - if not version: - raise ValueError('Cannot find the version number!') - - if version != release_version: - with open(VERSION_FILE, 'w') as f: - f.write('%s\n' % version) - - return version - - -if __name__ == '__main__': - print(get_version(prefix='deluge-', suffix='.dev0')) |