Skip to content

Commit 72f4d64

Browse files
committed
Note: I'm merging these changes out of consistency, but they don't seem
to be needed in py3k (except perhaps for non-utf8 paths). Merged revisions 77466-77467 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r77466 | antoine.pitrou | 2010-01-13 12:47:49 +0100 (mer., 13 janv. 2010) | 5 lines Issue #7661: Allow ctypes to be built from a non-ASCII directory path. Patch by Florent Xicluna. ........ r77467 | antoine.pitrou | 2010-01-13 12:57:42 +0100 (mer., 13 janv. 2010) | 3 lines Use `with` ........
1 parent aa92589 commit 72f4d64

2 files changed

Lines changed: 6 additions & 11 deletions

File tree

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 & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,22 +1498,19 @@ def configure_ctypes(self, ext):
14981498
return False
14991499

15001500
fficonfig = {}
1501-
fp = open(ffi_configfile)
1502-
try:
1503-
script = fp.read()
1504-
finally:
1505-
fp.close()
1506-
exec(script, globals(), fficonfig)
1507-
ffi_srcdir = os.path.join(fficonfig['ffi_srcdir'], 'src')
1501+
with open(ffi_configfile) as f:
1502+
exec(f.read(), globals(), fficonfig)
15081503

15091504
# Add .S (preprocessed assembly) to C compiler source extensions.
15101505
self.compiler_obj.src_extensions.append('.S')
15111506

15121507
include_dirs = [os.path.join(ffi_builddir, 'include'),
1513-
ffi_builddir, ffi_srcdir]
1508+
ffi_builddir,
1509+
os.path.join(ffi_srcdir, 'src')]
15141510
extra_compile_args = fficonfig['ffi_cflags'].split()
15151511

1516-
ext.sources.extend(fficonfig['ffi_sources'])
1512+
ext.sources.extend(os.path.join(ffi_srcdir, f) for f in
1513+
fficonfig['ffi_sources'])
15171514
ext.include_dirs.extend(include_dirs)
15181515
ext.extra_compile_args.extend(extra_compile_args)
15191516
return True

0 commit comments

Comments
 (0)