hg: limit HGUNICODEPEDANTRY to py2
authortimeless <timeless@mozdev.org>
Tue, 05 Apr 2016 01:35:36 +0000
changeset 31563 2ea9c9aa6e60475ff2338722554fe1f24bfc43c9
parent 31562 de28dedd1ff178054dca89fca7984aa1833fe2fd
child 31564 fa9fae9a9372266cadef0516fac0bf8954ce3338
push id231
push usergszorc@mozilla.com
push dateThu, 26 May 2016 03:04:27 +0000
hg: limit HGUNICODEPEDANTRY to py2 reload is not available in py3, and py3 is fatal anyway
hg
--- a/hg
+++ b/hg
@@ -6,19 +6,21 @@
 #
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
 import os
 import sys
 
 if os.environ.get('HGUNICODEPEDANTRY', False):
-    reload(sys)
-    sys.setdefaultencoding("undefined")
-
+    try:
+        reload(sys)
+        sys.setdefaultencoding("undefined")
+    except NameError:
+        pass
 
 libdir = '@LIBDIR@'
 
 if libdir != '@' 'LIBDIR' '@':
     if not os.path.isabs(libdir):
         libdir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                               libdir)
         libdir = os.path.abspath(libdir)