[cctbxbb] [Cctbx-cvs] SF.net SVN: cctbx:[25333] trunk/libtbx/env_config.py

markus.gerstel at diamond.ac.uk markus.gerstel at diamond.ac.uk
Thu Sep 8 02:26:32 PDT 2016


Hi,

I just spent some time tracking software crashes to this change. Is setting the default to en_US really appropriate and what we want?
In particular it affects the output of downstream, external software we run from within python.

What is the unicode issue you hint at in the commit message?

-Markus

Dr Markus Gerstel MBCS
Postdoctoral Research Associate
Tel: +44 1235 778698

Diamond Light Source Ltd.
Diamond House
Harwell Science & Innovation Campus
Didcot
Oxfordshire
OX11 0DE

-----Original Message-----
From: bkpoon at users.sourceforge.net [mailto:bkpoon at users.sourceforge.net] 
Sent: 07 September 2016 00:54
To: cctbx-cvs at lists.sourceforge.net
Subject: [Cctbx-cvs] SF.net SVN: cctbx:[25333] trunk/libtbx/env_config.py

Revision: 25333
          http://sourceforge.net/p/cctbx/code/25333
Author:   bkpoon
Date:     2016-09-06 23:54:29 +0000 (Tue, 06 Sep 2016)
Log Message:
-----------
Unicode support: set LC_ALL in dispatchers to the one in the user's environment (if available, and supports UTF-8), otherwise use the default setting of en_US.UTF-8; fixes unicode issue with python in Linux (e.g. os.path functions do not work correctly with unicode if LC_ALL=C

Modified Paths:
--------------
    trunk/libtbx/env_config.py

Modified: trunk/libtbx/env_config.py
===================================================================
--- trunk/libtbx/env_config.py	2016-09-06 21:15:34 UTC (rev 25332)
+++ trunk/libtbx/env_config.py	2016-09-06 23:54:29 UTC (rev 25333)
@@ -945,6 +945,15 @@
 
   def write_bin_sh_dispatcher(self,
         source_file, target_file, source_is_python_exe=False):
+
+    # determine LC_ALL from environment (Python UTF-8 compatibility in Linux)
+    LC_ALL = os.environ.get('LC_ALL')     # user setting
+    if (LC_ALL is not None):
+      if ( ('UTF-8' not in LC_ALL) and ('utf8' not in LC_ALL) ):
+        LC_ALL = None
+    if (LC_ALL is None):
+      LC_ALL = 'en_US.UTF-8'              # default
+
     f = target_file.open("w")
     if (source_file is not None):
       print >> f, '#! /bin/sh'
@@ -975,7 +984,7 @@
     print >> f, '#'
     print >> f, _SHELLREALPATH_CODE
     print >> f, 'unset PYTHONHOME'
-    print >> f, 'LC_ALL=C'
+    print >> f, 'LC_ALL=' + LC_ALL
     print >> f, 'export LC_ALL'
     print >> f, 'LIBTBX_BUILD="$(shellrealpath "$0" && cd "$(dirname "$RESULT")/.." && pwd)"'
     print >> f, 'export LIBTBX_BUILD'

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
Cctbx-cvs mailing list
Cctbx-cvs at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cctbx-cvs

-- 
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. 
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom




More information about the cctbxbb mailing list