Rev 5329: (parthm) fixed import order of lazy_regex w.r.t _format_version_tuple in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Jul 1 05:58:19 BST 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5329 [merge]
revision-id: pqm at pqm.ubuntu.com-20100701045817-169zszf3yzg5gcxj
parent: pqm at pqm.ubuntu.com-20100701034120-zla513tk7pzf9rzn
parent: parth.malwankar at gmail.com-20100701031155-u24wi81x8c61alht
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2010-07-01 05:58:17 +0100
message:
  (parthm) fixed import order of lazy_regex w.r.t _format_version_tuple
   definition in bzrlib (Parth Malwankar)
modified:
  bzrlib/__init__.py             __init__.py-20050309040759-33e65acf91bbcd5d
=== modified file 'bzrlib/__init__.py'
--- a/bzrlib/__init__.py	2010-06-26 02:15:26 +0000
+++ b/bzrlib/__init__.py	2010-07-01 03:11:55 +0000
@@ -38,13 +38,6 @@
 _start_time = time.time()
 
 import sys
-if getattr(sys, '_bzr_lazy_regex', False):
-    # The 'bzr' executable sets _bzr_lazy_regex.  We install the lazy regex
-    # hack as soon as possible so that as much of the standard library can
-    # benefit, including the 'string' module.
-    del sys._bzr_lazy_regex
-    import bzrlib.lazy_regex
-    bzrlib.lazy_regex.install_lazy_compile()
 
 
 IGNORE_FILENAME = ".bzrignore"
@@ -126,6 +119,18 @@
     return main_version + sub_string
 
 
+# lazy_regex import must be done after _format_version_tuple definition
+# to avoid "no attribute '_format_version_tuple'" error when using
+# deprecated_function in the lazy_regex module.
+if getattr(sys, '_bzr_lazy_regex', False):
+    # The 'bzr' executable sets _bzr_lazy_regex.  We install the lazy regex
+    # hack as soon as possible so that as much of the standard library can
+    # benefit, including the 'string' module.
+    del sys._bzr_lazy_regex
+    import bzrlib.lazy_regex
+    bzrlib.lazy_regex.install_lazy_compile()
+
+
 __version__ = _format_version_tuple(version_info)
 version_string = __version__
 




More information about the bazaar-commits mailing list