nice version numbers, and metadata update
This commit is contained in:
@@ -24,6 +24,7 @@ import json
|
||||
|
||||
import util
|
||||
from c_overviewer import get_render_mode_inheritance
|
||||
import overviewer_version
|
||||
|
||||
"""
|
||||
This module has routines related to generating a Google Maps-based
|
||||
@@ -132,7 +133,8 @@ class MapGen(object):
|
||||
index = open(indexpath, 'r').read()
|
||||
index = index.replace(
|
||||
"{time}", str(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())))
|
||||
index = index.replace("{version}", util.findGitVersion())
|
||||
versionstr = "%s (%s)" % (overviewer_version.VERSION, overviewer_version.HASH[:7])
|
||||
index = index.replace("{version}", versionstr)
|
||||
|
||||
with open(os.path.join(self.destdir, "index.html"), 'w') as output:
|
||||
output.write(index)
|
||||
|
||||
@@ -21,6 +21,7 @@ import imp
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
def get_program_path():
|
||||
if hasattr(sys, "frozen") or imp.is_frozen("__main__"):
|
||||
@@ -34,8 +35,8 @@ def get_program_path():
|
||||
return os.path.dirname(sys.argv[0])
|
||||
|
||||
|
||||
|
||||
def findGitVersion():
|
||||
# does not require git, very likely to work everywhere
|
||||
def findGitHash():
|
||||
this_dir = get_program_path()
|
||||
if os.path.exists(os.path.join(this_dir,".git")):
|
||||
with open(os.path.join(this_dir,".git","HEAD")) as f:
|
||||
@@ -48,6 +49,24 @@ def findGitVersion():
|
||||
else:
|
||||
return data
|
||||
else:
|
||||
try:
|
||||
import overviewer_version
|
||||
return overviewer_version.HASH
|
||||
except:
|
||||
return "unknown"
|
||||
|
||||
def findGitVersion():
|
||||
try:
|
||||
p = Popen(['git', 'describe', '--tags'], stdout=PIPE, stderr=PIPE)
|
||||
p.stderr.close()
|
||||
line = p.stdout.readlines()[0]
|
||||
if line.startswith('release-'):
|
||||
line = line.split('-', 1)[1]
|
||||
# turn 0.1.2-50-somehash into 0.1.2-50
|
||||
# and 0.1.3 into 0.1.3
|
||||
line = '-'.join(line.split('-', 2)[:2])
|
||||
return line.strip()
|
||||
except:
|
||||
try:
|
||||
import overviewer_version
|
||||
return overviewer_version.VERSION
|
||||
|
||||
Reference in New Issue
Block a user