Commit 71f3c0bd authored by Victor Yacovlev's avatar Victor Yacovlev

Fixed git hash number extraction

parent aae99306
...@@ -9,11 +9,16 @@ if 3 == sys.version_info.major: ...@@ -9,11 +9,16 @@ if 3 == sys.version_info.major:
from urllib.parse import unquote from urllib.parse import unquote
def to_str(x): def to_str(x):
return x.decode("utf-8") assert isinstance(x, str) or isinstance(x, bytes)
if isinstance(x, str):
return x
return x.decode("utf-8")
else: else:
from urllib import unquote from urllib import unquote
def to_str(x): def to_str(x):
assert isinstance(x, str) or isinstance(x, unicode)
return unicode(x) return unicode(x)
OUT_FILE = sys.stdout OUT_FILE = sys.stdout
...@@ -29,10 +34,14 @@ def get_version_information(top_level_dir): ...@@ -29,10 +34,14 @@ def get_version_information(top_level_dir):
stderr=subprocess.PIPE stderr=subprocess.PIPE
).strip() ).strip()
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
version_info = subprocess.check_output( version_info = to_str(subprocess.check_output(
"git rev-parse --abbrev-ref HEAD", "git rev-parse --abbrev-ref HEAD",
shell=True shell=True
).strip() ).strip())
version_info += "-" + to_str(subprocess.check_output(
"git --no-pager log -1 --pretty=format:%H",
else: else:
dir_name = os.path.basename(top_level_dir) dir_name = os.path.basename(top_level_dir)
match = re.match(r"kumir2-(.+)", dir_name) match = re.match(r"kumir2-(.+)", dir_name)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment