From 06e9a1529b5a29b5c3dd7df697c4a21332440d5d Mon Sep 17 00:00:00 2001 From: Hamuko Date: Thu, 28 Apr 2016 19:31:36 +0300 Subject: [PATCH] Fix get_setup_version() failing on non-git installs. --- setup.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index ad4a6e7..ae3a62f 100644 --- a/setup.py +++ b/setup.py @@ -32,10 +32,15 @@ def get_setup_version(): """Return a version string that can be used with the setup method. Includes additional commits since the last tagged commit. """ - process = subprocess.Popen(COMMAND_DESCRIBE_VERSION, **SUBPROCESS_KWARGS) - process.wait() - version = process.communicate()[0].decode("utf-8").strip() - return re.match(re_version, version).group(1) + if os.path.isdir('.git'): + process = subprocess.Popen(COMMAND_DESCRIBE_VERSION, + **SUBPROCESS_KWARGS) + process.wait() + version = process.communicate()[0].decode("utf-8").strip() + return re.match(re_version, version).group(1) + else: + from cum.version import __version__ + return __version__ def get_version():