Rev 5084: (jameinel) Use setlocale only on posix systems which avoids console output in file:///home/pqm/archives/thelove/bzr/2.2/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Sep 9 02:29:14 BST 2010


At file:///home/pqm/archives/thelove/bzr/2.2/

------------------------------------------------------------
revno: 5084 [merge]
revision-id: pqm at pqm.ubuntu.com-20100909012913-ll8vz460ylcbdj2m
parent: pqm at pqm.ubuntu.com-20100908094908-3mje9kjg540g9bql
parent: gzlist at googlemail.com-20100908132516-yiv2ndmxlfuovohf
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.2
timestamp: Thu 2010-09-09 02:29:13 +0100
message:
  (jameinel) Use setlocale only on posix systems which avoids console output
   breakage on windows with Python 2.6+ (Martin [gz])
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzr                            bzr.py-20050313053754-5485f144c7006fa6
=== modified file 'NEWS'
--- a/NEWS	2010-08-17 04:55:44 +0000
+++ b/NEWS	2010-09-08 13:25:16 +0000
@@ -32,6 +32,11 @@
   directory that was a symlink in the previous commit.
   (Martin Pool, #192859)
 
+* Only call ``setlocale`` in the bzr startup script on posix systems. This
+  avoids an issue with the newer windows C runtimes used by Python 2.6 and
+  later which can mangle bytestrings printed to the console.
+  (Martin [gz], #631350)
+
 Improvements
 ************
 

=== modified file 'bzr'
--- a/bzr	2010-06-22 22:40:29 +0000
+++ b/bzr	2010-09-07 11:54:33 +0000
@@ -75,6 +75,16 @@
 else:
     import locale
 
+if os.name == "posix":
+    try:
+        locale.setlocale(locale.LC_ALL, '')
+    except locale.Error, e:
+        sys.stderr.write('bzr: warning: %s\n'
+            '  bzr could not set the application locale.\n'
+            '  Although this should be no problem for bzr itself, it might\n'
+            '  cause problems with some plugins. To investigate the issue,\n'
+            '  look at the output of the locale(1p) tool.\n' % e)
+
 
 # The python2.6 release includes some libraries that have deprecation warnings
 # against the interpreter - see https://bugs.launchpad.net/bzr/+bug/387139
@@ -86,17 +96,6 @@
     )
 
 
-try:
-    locale.setlocale(locale.LC_ALL, '')
-except locale.Error, e:
-    sys.stderr.write('bzr: warning: %s\n'
-                     '  bzr could not set the application locale.\n'
-                     '  Although this should be no problem for bzr itself,\n'
-                     '  it might cause problems with some plugins.\n'
-                     '  To investigate the issue, look at the output\n'
-                     '  of the locale(1p) tool available on POSIX systems.\n'
-                     % e)
-
 # instruct bzrlib/__init__.py to install lazy_regex
 sys._bzr_lazy_regex = True
 try:




More information about the bazaar-commits mailing list