[New-bugs-announce] [issue16907] Distutils fails to build extension in path with spaces

klo uo report at bugs.python.org
Wed Jan 9 13:22:42 CET 2013


New submission from klo uo:

I noticed this issue, while trying to compile Cython extension, when source file is in path with spaces. Extension wouldn't compile because LIBDIR is passed to MinGW g++ (though not to gcc) or MSVC compilers unquoted. I tracked the problem to "distutils/build_ext.py" in get_ext_fullpath() function.

I patched it, this way:

========================================
--- build_ext.bak
+++ build_ext.py
@@ -647,6 +647,11 @@
         package = '.'.join(modpath[0:-1])
         build_py = self.get_finalized_command('build_py')
         package_dir = os.path.abspath(build_py.get_package_dir(package))
+        try:
+            from win32api import GetShortPathName
+            package_dir = GetShortPathName(package_dir)
+        except:
+            pass
         # returning
         #   package_dir/filename
         return os.path.join(package_dir, filename)
========================================

which is just one way to do it.

----------
assignee: eric.araujo
components: Distutils
messages: 179434
nosy: eric.araujo, klo.uo, tarek
priority: normal
severity: normal
status: open
title: Distutils fails to build extension in path with spaces
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16907>
_______________________________________


More information about the New-bugs-announce mailing list