From 3b60b42e6beec314742fe2b8ae5ab575f898f817 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 10 May 2014 22:39:13 +0200 Subject: [PATCH] support building from git mirror --- tools/build/build.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tools/build/build.py b/tools/build/build.py index 416b2d4a..2db7696c 100755 --- a/tools/build/build.py +++ b/tools/build/build.py @@ -12,6 +12,20 @@ import sys import tarfile import time +def get_version(): + if os.path.exists('../../.git'): + revision = subprocess.Popen( + ['git', 'rev-list', 'HEAD', '--count'], stdout=subprocess.PIPE + ).communicate()[0].strip() + print revision + revision = int(revision) - 118 + print revision + else: + revision = subprocess.Popen( + ['bzr', 'revno'], stdout=subprocess.PIPE + ).communicate()[0].strip() + return '0.1.%s' % revision + def build_oxjs(downloads=False, geo=False): base_path = os.path.dirname(__file__) @@ -24,10 +38,7 @@ def build_oxjs(downloads=False, geo=False): dev_path = root_path + 'dev/' locales = {} - version = '0.1.%s' % subprocess.Popen( - ['bzr', 'revno'], - stdout=subprocess.PIPE - ).communicate()[0].strip() + version = get_version() year = time.strftime('%Y', time.gmtime()) comment = ' OxJS %s (c) %s 0x2620, dual-licensed GPL/MIT, see https://oxjs.org for details ' % (version, year)