openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #20483
[Merge] lp:~googol/openlp/python3-bzrlib into lp:openlp
Andreas Preikschat has proposed merging lp:~googol/openlp/python3-bzrlib into lp:openlp.
Requested reviews:
Raoul Snyman (raoul-snyman)
For more details, see:
https://code.launchpad.net/~googol/openlp/python3-bzrlib/+merge/159212
Hello,
- Removed some code not compatible with python 3
--
https://code.launchpad.net/~googol/openlp/python3-bzrlib/+merge/159212
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/.version'
--- openlp/.version 2013-01-08 20:44:56 +0000
+++ openlp/.version 2013-04-16 17:57:27 +0000
@@ -1,1 +1,1 @@
-2.1.0-bzr2141
+2.0.1-bzr2233
\ No newline at end of file
=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py 2013-04-05 17:41:01 +0000
+++ openlp/core/utils/__init__.py 2013-04-16 17:57:27 +0000
@@ -102,45 +102,24 @@
return APPLICATION_VERSION
if u'--dev-version' in sys.argv or u'-d' in sys.argv:
# If we're running the dev version, let's use bzr to get the version.
- try:
- # If bzrlib is available, use it.
- from bzrlib.branch import Branch
- b = Branch.open_containing('.')[0]
- b.lock_read()
- 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:
- full_version = u'%s' % tags[revision_id][0]
- else:
- full_version = '%s-bzr%s' % (sorted(b.tags.get_tag_dict().keys())[-1], revno)
- finally:
- b.unlock()
- except:
- # Otherwise run the command line bzr client.
- bzr = Popen((u'bzr', u'tags', u'--sort', u'time'), stdout=PIPE)
- output, error = bzr.communicate()
- code = bzr.wait()
- if code != 0:
- raise Exception(u'Error running bzr tags')
- lines = output.splitlines()
- if not lines:
- tag = u'0.0.0'
- revision = u'0'
- else:
- tag, revision = lines[-1].split()
- bzr = Popen((u'bzr', u'log', u'--line', u'-r', u'-1'), stdout=PIPE)
- output, error = bzr.communicate()
- code = bzr.wait()
- if code != 0:
- raise Exception(u'Error running bzr log')
- latest = output.split(u':')[0]
- full_version = latest == revision and tag or u'%s-bzr%s' % (tag, latest)
+ bzr = Popen((u'bzr', u'tags', u'--sort', u'time'), stdout=PIPE)
+ output, error = bzr.communicate()
+ code = bzr.wait()
+ if code != 0:
+ raise Exception(u'Error running bzr tags')
+ lines = output.splitlines()
+ if not lines:
+ tag = u'0.0.0'
+ revision = u'0'
+ else:
+ tag, revision = lines[-1].split()
+ bzr = Popen((u'bzr', u'log', u'--line', u'-r', u'-1'), stdout=PIPE)
+ output, error = bzr.communicate()
+ code = bzr.wait()
+ if code != 0:
+ raise Exception(u'Error running bzr log')
+ latest = output.split(u':')[0]
+ full_version = latest == revision and tag or u'%s-bzr%s' % (tag, latest)
else:
# We're not running the development version, let's use the file.
filepath = AppLocation.get_directory(AppLocation.VersionDir)
@@ -406,7 +385,7 @@
key = [int(part) if part.isdigit() else get_locale_key(part) for part in key]
# Python 3 does not support comparision of different types anymore. So make sure, that we do not compare str and int.
#if string[0].isdigit():
- # return [''] + key
+ # return [''] + key
return key
=== modified file 'setup.py'
--- setup.py 2013-02-03 16:40:39 +0000
+++ setup.py 2013-04-16 17:57:27 +0000
@@ -27,12 +27,15 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
+import re
from setuptools import setup, find_packages
-import re
+from subprocess import Popen, PIPE
+
VERSION_FILE = 'openlp/.version'
SPLIT_ALPHA_DIGITS = re.compile(r'(\d+|\D+)')
+
def try_int(s):
"""
Convert string s to an integer if possible. Fail silently and return
@@ -46,6 +49,7 @@
except Exception:
return s
+
def natural_sort_key(s):
"""
Return a tuple by which s is sorted.
@@ -55,6 +59,7 @@
"""
return map(try_int, SPLIT_ALPHA_DIGITS.findall(s))
+
def natural_compare(a, b):
"""
Compare two strings naturally and return the result.
@@ -67,6 +72,7 @@
"""
return cmp(natural_sort_key(a), natural_sort_key(b))
+
def natural_sort(seq, compare=natural_compare):
"""
Returns a copy of seq, sorted by natural string sort.
@@ -77,28 +83,27 @@
return temp
try:
- # Try to import Bazaar
- from bzrlib.branch import Branch
- b = Branch.open_containing('.')[0]
- b.lock_read()
- 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:
- version = u'%s' % tags[revision_id][0]
- else:
- version = '%s-bzr%s' % \
- (natural_sort(b.tags.get_tag_dict().keys())[-1], revno)
- ver_file = open(VERSION_FILE, u'w')
- ver_file.write(version)
- ver_file.close()
- finally:
- b.unlock()
+ bzr = Popen((u'bzr', u'tags', u'--sort', u'time'), stdout=PIPE)
+ output, error = bzr.communicate()
+ code = bzr.wait()
+ if code != 0:
+ raise Exception(u'Error running bzr tags')
+ lines = output.splitlines()
+ if not lines:
+ tag = u'0.0.0'
+ revision = u'0'
+ else:
+ tag, revision = lines[-1].split()
+ bzr = Popen((u'bzr', u'log', u'--line', u'-r', u'-1'), stdout=PIPE)
+ output, error = bzr.communicate()
+ code = bzr.wait()
+ if code != 0:
+ raise Exception(u'Error running bzr log')
+ latest = output.split(u':')[0]
+ version = latest == revision and tag or u'%s-bzr%s' % (tag, latest)
+ ver_file = open(VERSION_FILE, u'w')
+ ver_file.write(version)
+ ver_file.close()
except:
ver_file = open(VERSION_FILE, u'r')
version = ver_file.read().strip()
Follow ups