The branch, 2.0.x, has been updated.

- Log -----------------------------------------------------------------

commit 3967b7b0db949838ef87abcd3bc137c60d3bfc21
Author: Enrico Forestieri <for...@lyx.org>
Date:   Wed Jul 18 22:20:46 2012 +0200

    Fix bug #8254: An encoding problem
    
    Use the short version of a path, which is guaranteed to be ascii and
    works even if the path is not encodable in the current codepage.
    
    (cherry picked from commit 08b3d492fac48e1b36d46cb236b19eb04ebd1098)

diff --git a/lib/configure.py b/lib/configure.py
index 88981f5..07cf653 100644
--- a/lib/configure.py
+++ b/lib/configure.py
@@ -62,7 +62,7 @@ def cmdOutput(cmd):
     '''
     if os.name == 'nt':
         b = False
-        cmd = 'cmd /d /c pushd ' + os.getcwd() + '&' + cmd
+        cmd = 'cmd /d /c pushd ' + shortPath(os.getcwdu()) + '&' + cmd
     else:
         b = True
     pipe = subprocess.Popen(cmd, shell=b, close_fds=b, stdin=subprocess.PIPE, \
@@ -73,6 +73,18 @@ def cmdOutput(cmd):
     return output.strip()
 
 
+def shortPath(path):
+    ''' On Windows, return the short version of "path" if possible '''
+    if os.name == 'nt':
+        from ctypes import windll, create_unicode_buffer
+        GetShortPathName = windll.kernel32.GetShortPathNameW
+        shortlen = GetShortPathName(path, 0, 0)
+        shortpath = create_unicode_buffer(shortlen)
+        if GetShortPathName(path, shortpath, shortlen):
+            return shortpath.value
+    return path
+
+
 def setEnviron():
     ''' I do not really know why this is useful, but we might as well keep it.
         NLS nuisances.
@@ -110,18 +122,10 @@ def checkTeXPaths():
         fd, tmpfname = mkstemp(suffix='.ltx')
         if os.name == 'nt':
             from locale import getdefaultlocale
-            from ctypes import windll, create_unicode_buffer
-            GetShortPathName = windll.kernel32.GetShortPathNameW
             language, encoding = getdefaultlocale()
             if encoding == None:
                 encoding = 'latin1'
-            longname = unicode(tmpfname, encoding)
-            shortlen = GetShortPathName(longname, 0, 0)
-            shortname = create_unicode_buffer(shortlen)
-            if GetShortPathName(longname, shortname, shortlen):
-                inpname = shortname.value.replace('\\', '/')
-            else:
-                inpname = tmpfname.replace('\\', '/')
+            inpname = shortPath(unicode(tmpfname, encoding)).replace('\\', '/')
         else:
             inpname = cmdOutput('cygpath -m ' + tmpfname)
         logname = os.path.basename(re.sub("(?i).ltx", ".log", inpname))
diff --git a/status.20x b/status.20x
index e994325..0b0878d 100644
--- a/status.20x
+++ b/status.20x
@@ -105,6 +105,9 @@ What's new
 
 - Set math display format when showing XHTML in View>Source.
 
+- Fix problem with configure.py when the user profile path on Windows
+  contains non-ascii characters (bug 8254).
+
 
 * DOCUMENTATION AND LOCALIZATION
 

-----------------------------------------------------------------------

Summary of changes:
 lib/configure.py |   24 ++++++++++++++----------
 status.20x       |    3 +++
 2 files changed, 17 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to