Skip to content

Commit 81fc5a1

Browse files
committed
Issue #7661: Allow ctypes to be built from a non-ASCII directory path.
Patch by Florent Xicluna.
1 parent acb6587 commit 81fc5a1

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

Misc/NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ Library
3939
Extension extra options may change the output without changing the .c
4040
file). Initial patch by Collin Winter.
4141

42+
Build
43+
-----
44+
45+
- Issue #7661: Allow ctypes to be built from a non-ASCII directory path.
46+
Patch by Florent Xicluna.
47+
4248

4349
What's New in Python 2.7 alpha 2?
4450
=================================

Modules/_ctypes/libffi/fficonfig.py.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ ffi_platforms = {
2828
'PA_HPUX': ['src/pa/hpux32.S', 'src/pa/ffi.c'],
2929
}
3030

31-
ffi_srcdir = '@srcdir@'
3231
ffi_sources += ffi_platforms['@TARGET@']
33-
ffi_sources = [os.path.join('@srcdir@', f) for f in ffi_sources]
3432

3533
ffi_cflags = '@CFLAGS@'

setup.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ class db_found(Exception): pass
813813
print "being ignored (4.6.x must be >= 4.6.21)"
814814
continue
815815

816-
if ( (not db_ver_inc_map.has_key(db_ver)) and
816+
if ( (db_ver not in db_ver_inc_map) and
817817
allow_db_ver(db_ver) ):
818818
# save the include directory with the db.h version
819819
# (first occurrence only)
@@ -1732,17 +1732,18 @@ def configure_ctypes(self, ext):
17321732
return False
17331733

17341734
fficonfig = {}
1735-
execfile(ffi_configfile, globals(), fficonfig)
1736-
ffi_srcdir = os.path.join(fficonfig['ffi_srcdir'], 'src')
1735+
exec open(ffi_configfile) in fficonfig
17371736

17381737
# Add .S (preprocessed assembly) to C compiler source extensions.
17391738
self.compiler_obj.src_extensions.append('.S')
17401739

17411740
include_dirs = [os.path.join(ffi_builddir, 'include'),
1742-
ffi_builddir, ffi_srcdir]
1741+
ffi_builddir,
1742+
os.path.join(ffi_srcdir, 'src')]
17431743
extra_compile_args = fficonfig['ffi_cflags'].split()
17441744

1745-
ext.sources.extend(fficonfig['ffi_sources'])
1745+
ext.sources.extend(os.path.join(ffi_srcdir, f) for f in
1746+
fficonfig['ffi_sources'])
17461747
ext.include_dirs.extend(include_dirs)
17471748
ext.extra_compile_args.extend(extra_compile_args)
17481749
return True

0 commit comments

Comments
 (0)