Moved helper function out of overviewer.py and into util.py
Solves a dependency problem where you can't import overviewer unless the extension is built
This commit is contained in:
18
util.py
18
util.py
@@ -30,3 +30,21 @@ def get_program_path():
|
||||
return os.path.dirname(__file__)
|
||||
except NameError:
|
||||
return os.path.dirname(sys.argv[0])
|
||||
|
||||
|
||||
|
||||
def findGitVersion():
|
||||
if os.path.exists(".git"):
|
||||
with open(os.path.join(".git","HEAD")) as f:
|
||||
data = f.read().strip()
|
||||
if data.startswith("ref: "):
|
||||
with open(os.path.join(".git", data[5:])) as g:
|
||||
return g.read().strip()
|
||||
else:
|
||||
return data
|
||||
else:
|
||||
try:
|
||||
import overviewer_version
|
||||
return overviewer_version.VERSION
|
||||
except:
|
||||
return "unknown"
|
||||
|
||||
Reference in New Issue
Block a user