aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/get_app_version
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2021-08-11 11:14:54 -0500
committerJesús <heckyel@hyperbola.info>2021-08-11 11:14:54 -0500
commit97ca52e77a42b8117732e7ffc16f2c44984ae304 (patch)
tree3be11991455a031bdcc03386cdb24a556f664400 /youtube/get_app_version
parent16f81de96856b714b991e1db025d10fc9dfe5909 (diff)
downloadyt-local-97ca52e77a42b8117732e7ffc16f2c44984ae304.tar.lz
yt-local-97ca52e77a42b8117732e7ffc16f2c44984ae304.tar.xz
yt-local-97ca52e77a42b8117732e7ffc16f2c44984ae304.zip
[get_app_version]: check git command
Diffstat (limited to 'youtube/get_app_version')
-rw-r--r--youtube/get_app_version/get_app_version.py45
1 files changed, 24 insertions, 21 deletions
diff --git a/youtube/get_app_version/get_app_version.py b/youtube/get_app_version/get_app_version.py
index 51eb2ce..9852359 100644
--- a/youtube/get_app_version/get_app_version.py
+++ b/youtube/get_app_version/get_app_version.py
@@ -24,28 +24,31 @@ def app_version():
cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
return out
- if call(["git", "branch"], stderr=STDOUT,
- stdout=open(os.devnull, 'w')) != 0:
-
- subst_list = {
- "version": __version__,
- "branch": None,
- "commit": None
- }
-
+ subst_list = {
+ "version": __version__,
+ "branch": None,
+ "commit": None
+ }
+
+ if os.system("command -v git > /dev/null 2>&1") != 0:
+ subst_list
else:
- # version
- describe = minimal_env_cmd(["git", "describe", "--always"])
- git_revision = describe.strip().decode('ascii')
- # branch
- branch = minimal_env_cmd(["git", "branch"])
- git_branch = branch.strip().decode('ascii').replace('* ', '')
-
- subst_list = {
- "version": __version__,
- "branch": git_branch,
- "commit": git_revision
- }
+ if call(["git", "branch"], stderr=STDOUT,
+ stdout=open(os.devnull, 'w')) != 0:
+ subst_list
+ else:
+ # version
+ describe = minimal_env_cmd(["git", "describe", "--always"])
+ git_revision = describe.strip().decode('ascii')
+ # branch
+ branch = minimal_env_cmd(["git", "branch"])
+ git_branch = branch.strip().decode('ascii').replace('* ', '')
+
+ subst_list = {
+ "version": __version__,
+ "branch": git_branch,
+ "commit": git_revision
+ }
return subst_list