From eb1dc880cb9d231710cb58a1eee31114f762104b Mon Sep 17 00:00:00 2001 From: Matthias Hub Date: Thu, 10 Mar 2011 03:09:23 +0100 Subject: [PATCH] using raouls get_version script from http://wiki.openlp.org/Packaging:Version_Script to create the .version file --- resources/osx/build.py | 5 +---- resources/osx/get_version.py | 36 ++++++++++++++++++++++++++++++++++++ resources/osx/openlp.cfg | 1 - resources/osx/version.master | 1 - 4 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 resources/osx/get_version.py delete mode 100755 resources/osx/version.master diff --git a/resources/osx/build.py b/resources/osx/build.py index 93fe453ad..ff7f6bdfd 100644 --- a/resources/osx/build.py +++ b/resources/osx/build.py @@ -394,10 +394,7 @@ if __name__ == '__main__': --template Info.plist.master \ --expandto %(target_directory)s/Info.plist' \ % { 'config_file' : options.config, 'target_directory' : os.getcwd() }) - os.system('python expander.py --config %(config_file)s \ - --template version.master \ - --expandto %(target_directory)s/.version' \ - % { 'config_file' : options.config, 'target_directory' : os.getcwd() }) + os.system('python get_version.py > .version') # prepare variables app_name_lower = settings['openlp_appname'].lower() diff --git a/resources/osx/get_version.py b/resources/osx/get_version.py new file mode 100644 index 000000000..30ebd7886 --- /dev/null +++ b/resources/osx/get_version.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +import sys +import os +from bzrlib.branch import Branch + +def get_version(path): + b = Branch.open_containing(path)[0] + b.lock_read() + result = '0.0.0' + try: + # Get the branch's latest revision number. + revno = b.revno() + # Convert said revision number into a bzr revision id. + revision_id = b.dotted_revno_to_revision_id((revno,)) + # Get a dict of tags, with the revision id as the key. + tags = b.tags.get_reverse_tag_dict() + # Check if the latest + if revision_id in tags: + result = tags[revision_id][0] + else: + result = '%s-bzr%s' % (sorted(b.tags.get_tag_dict().keys())[-1], revno) + finally: + b.unlock() + return result + +def get_path(): + if len(sys.argv) > 1: + return os.path.abspath(sys.argv[1]) + else: + return os.path.abspath('.') + +if __name__ == u'__main__': + path = get_path() + print get_version(path) + diff --git a/resources/osx/openlp.cfg b/resources/osx/openlp.cfg index 1f04861b5..3be085dc0 100755 --- a/resources/osx/openlp.cfg +++ b/resources/osx/openlp.cfg @@ -2,7 +2,6 @@ openlp_appname = OpenLP openlp_dmgname = OpenLP-1.9.4-bzrXXXX openlp_version = XXXX -openlp_full_version = 1.9.4-latest openlp_basedir = /Users/openlp/trunk openlp_icon_file = openlp-logo-with-text.icns openlp_dmg_icon_file = openlp-logo-420x420.png diff --git a/resources/osx/version.master b/resources/osx/version.master deleted file mode 100755 index d517a51bc..000000000 --- a/resources/osx/version.master +++ /dev/null @@ -1 +0,0 @@ -%(openlp_full_version)s