mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-10 02:18:41 +00:00
Fix version issue with no git repo
This commit is contained in:
parent
71b5e0a296
commit
c55a601db9
1 changed files with 6 additions and 6 deletions
12
version.py
12
version.py
|
@ -40,12 +40,12 @@ VERSION_FILE = "RELEASE-VERSION"
|
||||||
def call_git_describe(prefix="", suffix=""):
|
def call_git_describe(prefix="", suffix=""):
|
||||||
cmd = "git describe --tags --match %s[0-9]*" % prefix
|
cmd = "git describe --tags --match %s[0-9]*" % prefix
|
||||||
try:
|
try:
|
||||||
version = Popen(cmd.split(), stdout=PIPE).communicate()[0]
|
output = Popen(cmd.split(), stdout=PIPE, stderr=PIPE).communicate()
|
||||||
version = version.strip().replace(prefix, "")
|
version = output[0].strip().replace(prefix, "")
|
||||||
if "-" in version:
|
if "-" in version:
|
||||||
version = ".dev".join(version.replace(suffix, "").split("-")[:2])
|
version = ".dev".join(version.replace(suffix, "").split("-")[:2])
|
||||||
return version
|
return version
|
||||||
except:
|
except OSError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,14 +53,14 @@ def get_version(prefix="", suffix=""):
|
||||||
try:
|
try:
|
||||||
with open(VERSION_FILE, "r") as f:
|
with open(VERSION_FILE, "r") as f:
|
||||||
release_version = f.readline().strip()
|
release_version = f.readline().strip()
|
||||||
except:
|
except IOError:
|
||||||
release_version = None
|
release_version = None
|
||||||
|
|
||||||
version = call_git_describe(prefix, suffix)
|
version = call_git_describe(prefix, suffix)
|
||||||
|
|
||||||
if version is None:
|
if not version:
|
||||||
version = release_version
|
version = release_version
|
||||||
if version is None:
|
if not version:
|
||||||
raise ValueError("Cannot find the version number!")
|
raise ValueError("Cannot find the version number!")
|
||||||
|
|
||||||
if version != release_version:
|
if version != release_version:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue