aboutsummaryrefslogtreecommitdiff
path: root/lazygal/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'lazygal/__init__.py')
-rw-r--r--lazygal/__init__.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lazygal/__init__.py b/lazygal/__init__.py
index 475bd7b..caa38fe 100644
--- a/lazygal/__init__.py
+++ b/lazygal/__init__.py
@@ -38,7 +38,8 @@ else:
def query_git_for_tag(gitdir):
import subprocess
- o = subprocess.check_output(('git', 'describe', '--tags')) \
+ o = subprocess.check_output(('git','-C', os.path.dirname(__file__),
+ 'describe', '--tags', )) \
.decode(sys.stdout.encoding).strip()
tokens = o.split('-')
h = tokens[-1]
@@ -70,7 +71,8 @@ def get_git_rev():
try:
lastrev = query_git_for_tag(gitdir)
except subprocess.CalledProcessError:
- os.unlink(last_revision_cache)
+ if os.path.isfile(last_revision_cache):
+ os.unlink(last_revision_cache)
return ''
else:
v, h = lastrev