diff options
author | Calum Lind <calumlind+deluge@gmail.com> | 2015-08-23 19:27:14 +0100 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2015-08-24 14:56:53 +0100 |
commit | c55a601db9cb34be05116180a459044f984c5682 (patch) | |
tree | 5aecfff52cc18a32a43d96fd8c104de169acc61d /version.py | |
parent | 71b5e0a2965b263e7450b0c5999e15cf88c2595c (diff) | |
download | deluge-c55a601db9cb34be05116180a459044f984c5682.tar.gz deluge-c55a601db9cb34be05116180a459044f984c5682.tar.bz2 deluge-c55a601db9cb34be05116180a459044f984c5682.zip |
Fix version issue with no git repo
Diffstat (limited to 'version.py')
-rw-r--r-- | version.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/version.py b/version.py index 276b5c50e..bce2bdbcc 100644 --- a/version.py +++ b/version.py @@ -40,12 +40,12 @@ VERSION_FILE = "RELEASE-VERSION" def call_git_describe(prefix="", suffix=""): cmd = "git describe --tags --match %s[0-9]*" % prefix try: - version = Popen(cmd.split(), stdout=PIPE).communicate()[0] - version = version.strip().replace(prefix, "") + output = Popen(cmd.split(), stdout=PIPE, stderr=PIPE).communicate() + version = output[0].strip().replace(prefix, "") if "-" in version: version = ".dev".join(version.replace(suffix, "").split("-")[:2]) return version - except: + except OSError: return None @@ -53,14 +53,14 @@ def get_version(prefix="", suffix=""): try: with open(VERSION_FILE, "r") as f: release_version = f.readline().strip() - except: + except IOError: release_version = None version = call_git_describe(prefix, suffix) - if version is None: + if not version: version = release_version - if version is None: + if not version: raise ValueError("Cannot find the version number!") if version != release_version: |