From 8c510e704e3823df66c2c3ad85912c9a9dda7f14 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Wed, 13 Jan 2010 11:47:49 +0000 Subject: Issue #7661: Allow ctypes to be built from a non-ASCII directory path. Patch by Florent Xicluna. --- Misc/NEWS | 6 ++++++ Modules/_ctypes/libffi/fficonfig.py.in | 2 -- setup.py | 11 ++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS index 20cdf88..82f3d92 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -39,6 +39,12 @@ Library Extension extra options may change the output without changing the .c file). Initial patch by Collin Winter. +Build +----- + +- Issue #7661: Allow ctypes to be built from a non-ASCII directory path. + Patch by Florent Xicluna. + What's New in Python 2.7 alpha 2? ================================= diff --git a/Modules/_ctypes/libffi/fficonfig.py.in b/Modules/_ctypes/libffi/fficonfig.py.in index 1029327..045d7c3 100644 --- a/Modules/_ctypes/libffi/fficonfig.py.in +++ b/Modules/_ctypes/libffi/fficonfig.py.in @@ -28,8 +28,6 @@ ffi_platforms = { 'PA_HPUX': ['src/pa/hpux32.S', 'src/pa/ffi.c'], } -ffi_srcdir = '@srcdir@' ffi_sources += ffi_platforms['@TARGET@'] -ffi_sources = [os.path.join('@srcdir@', f) for f in ffi_sources] ffi_cflags = '@CFLAGS@' diff --git a/setup.py b/setup.py index 30f2e85..3df20b6 100644 --- a/setup.py +++ b/setup.py @@ -813,7 +813,7 @@ class PyBuildExt(build_ext): print "being ignored (4.6.x must be >= 4.6.21)" continue - if ( (not db_ver_inc_map.has_key(db_ver)) and + if ( (db_ver not in db_ver_inc_map) and allow_db_ver(db_ver) ): # save the include directory with the db.h version # (first occurrence only) @@ -1732,17 +1732,18 @@ class PyBuildExt(build_ext): return False fficonfig = {} - execfile(ffi_configfile, globals(), fficonfig) - ffi_srcdir = os.path.join(fficonfig['ffi_srcdir'], 'src') + exec open(ffi_configfile) in fficonfig # Add .S (preprocessed assembly) to C compiler source extensions. self.compiler_obj.src_extensions.append('.S') include_dirs = [os.path.join(ffi_builddir, 'include'), - ffi_builddir, ffi_srcdir] + ffi_builddir, + os.path.join(ffi_srcdir, 'src')] extra_compile_args = fficonfig['ffi_cflags'].split() - ext.sources.extend(fficonfig['ffi_sources']) + ext.sources.extend(os.path.join(ffi_srcdir, f) for f in + fficonfig['ffi_sources']) ext.include_dirs.extend(include_dirs) ext.extra_compile_args.extend(extra_compile_args) return True -- cgit v0.12