| index 5bc5afe..d18d643 100644 |
| --- a/setup.py |
| +++ b/setup.py |
| @@ -15,6 +15,22 @@ from distutils.command.install_lib import install_lib |
| from distutils.command.build_scripts import build_scripts |
| from distutils.spawn import find_executable |
| + |
| +def _get_platform(): |
| + # Get value of host platform (set only if cross-compile) |
| + # otherwise value of sys.platform |
| + host_platform = os.environ.get('HOST_OS') |
| + if host_platform is None: |
| + host_platform = sys.platform |
| + for platform in ['linux', 'cygwin', 'darwin', 'osf1']: |
| + if host_platform.startswith(platform): |
| + return platform |
| + return host_platform |
| + |
| +host_platform = _get_platform() |
| +cross_compiling = (not os.environ.get('HOST_OS') is None) |
| + |
| + |
| # Were we compiled --with-pydebug or with #define Py_DEBUG? |
| COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount') |
| @@ -70,7 +86,7 @@ def find_file(filename, std_dirs, paths): |
| 'paths' is a list of additional locations to check; if the file is |
| found in one of them, the resulting list will contain the directory. |
| """ |
| - if sys.platform == 'darwin': |
| + if host_platform == 'darwin': |
| # Honor the MacOSX SDK setting when one was specified. |
| # An SDK is a directory with the same structure as a real |
| # system, but with only header files and libraries. |
| @@ -80,7 +96,7 @@ def find_file(filename, std_dirs, paths): |
| for dir in std_dirs: |
| f = os.path.join(dir, filename) |
| - if sys.platform == 'darwin' and is_macosx_sdk_path(dir): |
| + if host_platform == 'darwin' and is_macosx_sdk_path(dir): |
| f = os.path.join(sysroot, dir[1:], filename) |
| if os.path.exists(f): return [] |
| @@ -89,7 +105,7 @@ def find_file(filename, std_dirs, paths): |
| for dir in paths: |
| f = os.path.join(dir, filename) |
| - if sys.platform == 'darwin' and is_macosx_sdk_path(dir): |
| + if host_platform == 'darwin' and is_macosx_sdk_path(dir): |
| f = os.path.join(sysroot, dir[1:], filename) |
| if os.path.exists(f): |
| @@ -103,7 +119,7 @@ def find_library_file(compiler, libname, std_dirs, paths): |
| if result is None: |
| return None |
| - if sys.platform == 'darwin': |
| + if host_platform == 'darwin': |
| sysroot = macosx_sdk_root() |
| # Check whether the found file is in one of the standard directories |
| @@ -112,7 +128,7 @@ def find_library_file(compiler, libname, std_dirs, paths): |
| # Ensure path doesn't end with path separator |
| p = p.rstrip(os.sep) |
| - if sys.platform == 'darwin' and is_macosx_sdk_path(p): |
| + if host_platform == 'darwin' and is_macosx_sdk_path(p): |
| if os.path.join(sysroot, p[1:]) == dirname: |
| return [ ] |
| @@ -125,7 +141,7 @@ def find_library_file(compiler, libname, std_dirs, paths): |
| # Ensure path doesn't end with path separator |
| p = p.rstrip(os.sep) |
| - if sys.platform == 'darwin' and is_macosx_sdk_path(p): |
| + if host_platform == 'darwin' and is_macosx_sdk_path(p): |
| if os.path.join(sysroot, p[1:]) == dirname: |
| return [ p ] |
| @@ -187,7 +203,6 @@ class PyBuildExt(build_ext): |
| moddirlist = [os.path.join(srcdir, 'Modules')] |
| # Platform-dependent module source and include directories |
| - platform = self.get_platform() |
| # Fix up the paths for scripts, too |
| self.distribution.scripts = [os.path.join(srcdir, filename) |
| @@ -303,7 +318,7 @@ class PyBuildExt(build_ext): |
| ext.name) |
| return |
| - if self.get_platform() == 'darwin' and ( |
| + if host_platform == 'darwin' and ( |
| sys.maxsize > 2**32 and '-arch' in ext.extra_link_args): |
| # Don't bother doing an import check when an extension was |
| # build with an explicit '-arch' flag on OSX. That's currently |
| @@ -317,10 +332,14 @@ class PyBuildExt(build_ext): |
| # Workaround for Cygwin: Cygwin currently has fork issues when many |
| # modules have been imported |
| - if self.get_platform() == 'cygwin': |
| + if host_platform == 'cygwin': |
| self.announce('WARNING: skipping import check for Cygwin-based "%s"' |
| % ext.name) |
| return |
| + if cross_compiling: |
| + self.announce('WARNING: skipping import check for cross-compiled "%s"' |
| + % ext.name) |
| + return |
| ext_filename = os.path.join( |
| self.build_lib, |
| self.get_ext_filename(self.get_ext_fullname(ext.name))) |
| @@ -361,12 +380,6 @@ class PyBuildExt(build_ext): |
| level=3) |
| self.failed.append(ext.name) |
| - def get_platform(self): |
| - # Get value of sys.platform |
| - if sys.platform.startswith('osf1'): |
| - return 'osf1' |
| - return sys.platform |
| - |
| def add_multiarch_paths(self): |
| # Debian/Ubuntu multiarch support. |
| # https://wiki.ubuntu.com/MultiarchSpec |
| @@ -390,12 +403,16 @@ class PyBuildExt(build_ext): |
| os.unlink(tmpfile) |
| def detect_modules(self): |
| + pyconfig_h_data = open('pyconfig.h').read() |
| + setup_info_data = open('setup_info').read() |
| + |
| # Ensure that /usr/local is always used, but the local build |
| # directories (i.e. '.' and 'Include') must be first. See issue |
| # 10520. |
| - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') |
| - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') |
| - self.add_multiarch_paths() |
| + if not cross_compiling: |
| + add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') |
| + add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') |
| + self.add_multiarch_paths() |
| # Add paths specified in the environment variables LDFLAGS and |
| # CPPFLAGS for header and library files. |
| @@ -403,6 +420,9 @@ class PyBuildExt(build_ext): |
| # directly since an inconsistently reproducible issue comes up where |
| # the environment variable is not set even though the value were passed |
| # into configure and stored in the Makefile (issue found on OS X 10.3). |
| + # NOTE: In cross-compilation environment python for build system |
| + # is linked in top build directory under name syspython to get |
| + # above to work (distutils hack). |
| for env_var, arg_name, dir_list in ( |
| ('LDFLAGS', '-R', self.compiler.runtime_library_dirs), |
| ('LDFLAGS', '-L', self.compiler.library_dirs), |
| @@ -442,14 +462,17 @@ class PyBuildExt(build_ext): |
| add_dir_to_list(self.compiler.include_dirs, |
| sysconfig.get_config_var("INCLUDEDIR")) |
| - # lib_dirs and inc_dirs are used to search for files; |
| - # if a file is found in one of those directories, it can |
| - # be assumed that no additional -I,-L directives are needed. |
| - lib_dirs = self.compiler.library_dirs + [ |
| - '/lib64', '/usr/lib64', |
| - '/lib', '/usr/lib', |
| - ] |
| - inc_dirs = self.compiler.include_dirs + ['/usr/include'] |
| + lib_dirs = self.compiler.library_dirs |
| + inc_dirs = self.compiler.include_dirs |
| + if not cross_compiling: |
| + # lib_dirs and inc_dirs are used to search for files; |
| + # if a file is found in one of those directories, it can |
| + # be assumed that no additional -I,-L directives are needed. |
| + lib_dirs += [ |
| + '/lib64', '/usr/lib64', |
| + '/lib', '/usr/lib', |
| + ] |
| + inc_dirs += ['/usr/include'] |
| exts = [] |
| missing = [] |
| @@ -457,18 +480,17 @@ class PyBuildExt(build_ext): |
| with open(config_h) as file: |
| config_h_vars = sysconfig.parse_config_h(file) |
| - platform = self.get_platform() |
| srcdir = sysconfig.get_config_var('srcdir') |
| # OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb) |
| - if platform in ['osf1', 'unixware7', 'openunix8']: |
| + if host_platform in ['osf1', 'unixware7', 'openunix8']: |
| lib_dirs += ['/usr/ccs/lib'] |
| # HP-UX11iv3 keeps files in lib/hpux folders. |
| - if platform == 'hp-ux11': |
| + if host_platform == 'hp-ux11': |
| lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32'] |
| - if platform == 'darwin': |
| + if host_platform == 'darwin': |
| # This should work on any unixy platform ;-) |
| # If the user has bothered specifying additional -I and -L flags |
| # in OPT and LDFLAGS we might as well use them here. |
| @@ -488,7 +510,7 @@ class PyBuildExt(build_ext): |
| # Check for MacOS X, which doesn't need libm.a at all |
| math_libs = ['m'] |
| - if platform == 'darwin': |
| + if host_platform == 'darwin': |
| math_libs = [] |
| # XXX Omitted modules: gl, pure, dl, SGI-specific modules |
| @@ -590,11 +612,34 @@ class PyBuildExt(build_ext): |
| exts.append( Extension('audioop', ['audioop.c']) ) |
| # readline |
| - do_readline = self.compiler.find_library_file(lib_dirs, 'readline') |
| + do_readline = re.search(r"#s*define\s+HAVE_LIBREADLINE\s+1\s*", pyconfig_h_data) |
| + |
| readline_termcap_library = "" |
| curses_library = "" |
| # Determine if readline is already linked against curses or tinfo. |
| - if do_readline and find_executable('ldd'): |
| + # NOTE readline_termcap_library flag is used only if |
| + # cannot determine readline libs (see configure.in checks) |
| + readline_conf = False |
| + readline_conf_termcap = "" |
| + if do_readline: |
| + m = re.search( |
| + r"\s*READLINE_LIBS\s*=\s*(?P<rl>-l.*)", |
| + setup_info_data |
| + ) |
| + if m: |
| + readline_conf = True |
| + ln = m.group('rl') |
| + if 'curses' in ln: |
| + readline_conf_termcap = re.sub( |
| + r'.*-l(n?cursesw?).*', r'\1', ln |
| + ).rstrip() |
| + elif 'tinfo' in ln: # termcap interface split out from ncurses |
| + readline_conf_termcap = 'tinfo' |
| + else: # may be readline is linked with termcap interface library |
| + readline_conf = False |
| + |
| + if do_readline and not readline_conf and find_executable('ldd'): |
| + do_readline = self.compiler.find_library_file(lib_dirs, 'readline') |
| # Cannot use os.popen here in py3k. |
| tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib') |
| if not os.path.exists(self.build_temp): |
| @@ -615,7 +660,9 @@ class PyBuildExt(build_ext): |
| os.unlink(tmpfile) |
| # Issue 7384: If readline is already linked against curses, |
| # use the same library for the readline and curses modules. |
| - if 'curses' in readline_termcap_library: |
| + if 'curses' in readline_conf_termcap: |
| + curses_library = readline_conf_termcap |
| + elif 'curses' in readline_termcap_library: |
| curses_library = readline_termcap_library |
| elif self.compiler.find_library_file(lib_dirs, 'ncursesw'): |
| curses_library = 'ncursesw' |
| @@ -624,7 +671,7 @@ class PyBuildExt(build_ext): |
| elif self.compiler.find_library_file(lib_dirs, 'curses'): |
| curses_library = 'curses' |
| - if platform == 'darwin': |
| + if host_platform == 'darwin': |
| os_release = int(os.uname()[2].split('.')[0]) |
| dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') |
| if dep_target and dep_target.split('.') < ['10', '5']: |
| @@ -636,7 +683,7 @@ class PyBuildExt(build_ext): |
| if find_file('readline/rlconf.h', inc_dirs, []) is None: |
| do_readline = False |
| if do_readline: |
| - if platform == 'darwin' and os_release < 9: |
| + if host_platform == 'darwin' and os_release < 9: |
| # In every directory on the search path search for a dynamic |
| # library and then a static library, instead of first looking |
| # for dynamic libraries on the entire path. |
| @@ -717,7 +764,7 @@ class PyBuildExt(build_ext): |
| inc_dirs + search_for_ssl_incs_in) |
| if opensslv_h: |
| name = os.path.join(opensslv_h[0], 'openssl/opensslv.h') |
| - if sys.platform == 'darwin' and is_macosx_sdk_path(name): |
| + if host_platform == 'darwin' and is_macosx_sdk_path(name): |
| name = os.path.join(macosx_sdk_root(), name[1:]) |
| try: |
| with open(name, 'r') as incfile: |
| @@ -853,7 +900,7 @@ class PyBuildExt(build_ext): |
| db_ver_inc_map = {} |
| - if sys.platform == 'darwin': |
| + if host_platform == 'darwin': |
| sysroot = macosx_sdk_root() |
| class db_found(Exception): pass |
| @@ -862,7 +909,7 @@ class PyBuildExt(build_ext): |
| # search path. |
| for d in inc_dirs + db_inc_paths: |
| f = os.path.join(d, "db.h") |
| - if sys.platform == 'darwin' and is_macosx_sdk_path(d): |
| + if host_platform == 'darwin' and is_macosx_sdk_path(d): |
| f = os.path.join(sysroot, d[1:], "db.h") |
| if db_setup_debug: print("db: looking for db.h in", f) |
| @@ -913,7 +960,7 @@ class PyBuildExt(build_ext): |
| db_incdir.replace("include", 'lib'), |
| ] |
| - if sys.platform != 'darwin': |
| + if host_platform != 'darwin': |
| db_dirs_to_check = list(filter(os.path.isdir, db_dirs_to_check)) |
| else: |
| @@ -977,13 +1024,13 @@ class PyBuildExt(build_ext): |
| # Scan the default include directories before the SQLite specific |
| # ones. This allows one to override the copy of sqlite on OSX, |
| # where /usr/include contains an old version of sqlite. |
| - if sys.platform == 'darwin': |
| + if host_platform == 'darwin': |
| sysroot = macosx_sdk_root() |
| for d in inc_dirs + sqlite_inc_paths: |
| f = os.path.join(d, "sqlite3.h") |
| - if sys.platform == 'darwin' and is_macosx_sdk_path(d): |
| + if host_platform == 'darwin' and is_macosx_sdk_path(d): |
| f = os.path.join(sysroot, d[1:], "sqlite3.h") |
| if os.path.exists(f): |
| @@ -1033,7 +1080,7 @@ class PyBuildExt(build_ext): |
| '_sqlite/util.c', ] |
| sqlite_defines = [] |
| - if sys.platform != "win32": |
| + if host_platform != "win32": |
| sqlite_defines.append(('MODULE_NAME', '"sqlite3"')) |
| else: |
| sqlite_defines.append(('MODULE_NAME', '\\"sqlite3\\"')) |
| @@ -1043,7 +1090,7 @@ class PyBuildExt(build_ext): |
| if '--enable-loadable-sqlite-extensions' not in sysconfig.get_config_var("CONFIG_ARGS"): |
| sqlite_defines.append(("SQLITE_OMIT_LOAD_EXTENSION", "1")) |
| - if sys.platform == 'darwin': |
| + if host_platform == 'darwin': |
| # In every directory on the search path search for a dynamic |
| # library and then a static library, instead of first looking |
| # for dynamic libraries on the entire path. |
| @@ -1072,7 +1119,7 @@ class PyBuildExt(build_ext): |
| dbm_setup_debug = False # verbose debug prints from this script? |
| dbm_order = ['gdbm'] |
| # The standard Unix dbm module: |
| - if platform not in ['cygwin']: |
| + if host_platform not in ['cygwin']: |
| config_args = [arg.strip("'") |
| for arg in sysconfig.get_config_var("CONFIG_ARGS").split()] |
| dbm_args = [arg for arg in config_args |
| @@ -1150,14 +1197,14 @@ class PyBuildExt(build_ext): |
| missing.append('_gdbm') |
| # Unix-only modules |
| - if platform != 'win32': |
| + if host_platform != 'win32': |
| # Steen Lumholt's termios module |
| exts.append( Extension('termios', ['termios.c']) ) |
| # Jeremy Hylton's rlimit interface |
| exts.append( Extension('resource', ['resource.c']) ) |
| # Sun yellow pages. Some systems have the functions in libc. |
| - if (platform not in ['cygwin', 'qnx6'] and |
| + if (host_platform not in ['cygwin', 'qnx6'] and |
| find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None): |
| if (self.compiler.find_library_file(lib_dirs, 'nsl')): |
| libs = ['nsl'] |
| @@ -1173,7 +1220,13 @@ class PyBuildExt(build_ext): |
| # Curses support, requiring the System V version of curses, often |
| # provided by the ncurses library. |
| curses_defines = [] |
| - curses_includes = [] |
| + # Broken after commit: |
| + # Victor Stinner<victor.stinner@haypocalc.com>, 2011-11-29 01:08 |
| + # cleanup setup.py for curses options |
| + # => the user specified header paths are not posted to curses |
| + # module build, so lets restore them |
| + #curses_includes = [] |
| + curses_includes = inc_dirs |
| panel_library = 'panel' |
| if curses_library == 'ncursesw': |
| curses_defines.append(('HAVE_NCURSESW', '1')) |
| @@ -1188,7 +1241,7 @@ class PyBuildExt(build_ext): |
| include_dirs=curses_includes, |
| define_macros=curses_defines, |
| libraries = curses_libs) ) |
| - elif curses_library == 'curses' and platform != 'darwin': |
| + elif curses_library == 'curses' and host_platform != 'darwin': |
| # OSX has an old Berkeley curses, not good enough for |
| # the _curses module. |
| if (self.compiler.find_library_file(lib_dirs, 'terminfo')): |
| @@ -1241,7 +1294,7 @@ class PyBuildExt(build_ext): |
| break |
| if version >= version_req: |
| if (self.compiler.find_library_file(lib_dirs, 'z')): |
| - if sys.platform == "darwin": |
| + if host_platform == "darwin": |
| zlib_extra_link_args = ('-Wl,-search_paths_first',) |
| else: |
| zlib_extra_link_args = () |
| @@ -1273,7 +1326,7 @@ class PyBuildExt(build_ext): |
| # Gustavo Niemeyer's bz2 module. |
| if (self.compiler.find_library_file(lib_dirs, 'bz2')): |
| - if sys.platform == "darwin": |
| + if host_platform == "darwin": |
| bz2_extra_link_args = ('-Wl,-search_paths_first',) |
| else: |
| bz2_extra_link_args = () |
| @@ -1351,29 +1404,29 @@ class PyBuildExt(build_ext): |
| self.detect_ctypes(inc_dirs, lib_dirs) |
| # Richard Oudkerk's multiprocessing module |
| - if platform == 'win32': # Windows |
| + if host_platform == 'win32': |
| macros = dict() |
| libraries = ['ws2_32'] |
| - elif platform == 'darwin': # Mac OSX |
| + elif host_platform == 'darwin': |
| macros = dict() |
| libraries = [] |
| - elif platform == 'cygwin': # Cygwin |
| + elif host_platform == 'cygwin': |
| macros = dict() |
| libraries = [] |
| - elif platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'): |
| + elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'): |
| # FreeBSD's P1003.1b semaphore support is very experimental |
| # and has many known problems. (as of June 2008) |
| macros = dict() |
| libraries = [] |
| - elif platform.startswith('openbsd'): |
| + elif host_platform.startswith('openbsd'): |
| macros = dict() |
| libraries = [] |
| - elif platform.startswith('netbsd'): |
| + elif host_platform.startswith('netbsd'): |
| macros = dict() |
| libraries = [] |
| @@ -1381,7 +1434,7 @@ class PyBuildExt(build_ext): |
| macros = dict() |
| libraries = ['rt'] |
| - if platform == 'win32': |
| + if host_platform == 'win32': |
| multiprocessing_srcs = [ '_multiprocessing/multiprocessing.c', |
| '_multiprocessing/semaphore.c', |
| ] |
| @@ -1402,12 +1455,12 @@ class PyBuildExt(build_ext): |
| # End multiprocessing |
| # Platform-specific libraries |
| - if platform.startswith(('linux', 'freebsd', 'gnukfreebsd')): |
| + if host_platform.startswith(('linux', 'freebsd', 'gnukfreebsd')): |
| exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) ) |
| else: |
| missing.append('ossaudiodev') |
| - if sys.platform == 'darwin': |
| + if host_platform == 'darwin': |
| exts.append( |
| Extension('_gestalt', ['_gestalt.c'], |
| extra_link_args=['-framework', 'Carbon']) |
| @@ -1525,8 +1578,7 @@ class PyBuildExt(build_ext): |
| # Rather than complicate the code below, detecting and building |
| # AquaTk is a separate method. Only one Tkinter will be built on |
| # Darwin - either AquaTk, if it is found, or X11 based Tk. |
| - platform = self.get_platform() |
| - if (platform == 'darwin' and |
| + if (host_platform == 'darwin' and |
| self.detect_tkinter_darwin(inc_dirs, lib_dirs)): |
| return |
| @@ -1549,7 +1601,7 @@ class PyBuildExt(build_ext): |
| # Check for the include files on Debian and {Free,Open}BSD, where |
| # they're put in /usr/include/{tcl,tk}X.Y |
| dotversion = version |
| - if '.' not in dotversion and "bsd" in sys.platform.lower(): |
| + if '.' not in dotversion and "bsd" in host_platform.lower(): |
| # OpenBSD and FreeBSD use Tcl/Tk library names like libtcl83.a, |
| # but the include subdirs are named like .../include/tcl8.3. |
| dotversion = dotversion[:-1] + '.' + dotversion[-1] |
| @@ -1575,7 +1627,7 @@ class PyBuildExt(build_ext): |
| include_dirs.append(dir) |
| # Check for various platform-specific directories |
| - if platform == 'sunos5': |
| + if host_platform == 'sunos5': |
| include_dirs.append('/usr/openwin/include') |
| added_lib_dirs.append('/usr/openwin/lib') |
| elif os.path.exists('/usr/X11R6/include'): |
| @@ -1591,7 +1643,7 @@ class PyBuildExt(build_ext): |
| added_lib_dirs.append('/usr/X11/lib') |
| # If Cygwin, then verify that X is installed before proceeding |
| - if platform == 'cygwin': |
| + if host_platform == 'cygwin': |
| x11_inc = find_file('X11/Xlib.h', [], include_dirs) |
| if x11_inc is None: |
| return |
| @@ -1610,11 +1662,11 @@ class PyBuildExt(build_ext): |
| libs.append('tk'+ version) |
| libs.append('tcl'+ version) |
| - if platform in ['aix3', 'aix4']: |
| + if host_platform in ['aix3', 'aix4']: |
| libs.append('ld') |
| # Finally, link with the X11 libraries (not appropriate on cygwin) |
| - if platform != "cygwin": |
| + if host_platform != "cygwin": |
| libs.append('X11') |
| ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], |
| @@ -1670,7 +1722,7 @@ class PyBuildExt(build_ext): |
| def configure_ctypes(self, ext): |
| if not self.use_system_libffi: |
| - if sys.platform == 'darwin': |
| + if host_platform == 'darwin': |
| return self.configure_ctypes_darwin(ext) |
| srcdir = sysconfig.get_config_var('srcdir') |
| @@ -1688,12 +1740,17 @@ class PyBuildExt(build_ext): |
| ffi_configfile): |
| from distutils.dir_util import mkpath |
| mkpath(ffi_builddir) |
| - config_args = [] |
| + #NOTE: best solution is to add to configure script |
| + # as config subdirectory and to exclude darwin |
| + # (see configure_ctypes_darwin). |
| + #FIXME: lets for now pass all top configure arguments |
| + #and do not modify configure script. |
| + config_args = sysconfig.get_config_var("CONFIG_ARGS") |
| # Pass empty CFLAGS because we'll just append the resulting |
| # CFLAGS to Python's; -g or -O2 is to be avoided. |
| cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \ |
| - % (ffi_builddir, ffi_srcdir, " ".join(config_args)) |
| + % (ffi_builddir, ffi_srcdir, config_args) |
| res = os.system(cmd) |
| if res or not os.path.exists(ffi_configfile): |
| @@ -1730,7 +1787,7 @@ class PyBuildExt(build_ext): |
| '_ctypes/cfield.c'] |
| depends = ['_ctypes/ctypes.h'] |
| - if sys.platform == 'darwin': |
| + if host_platform == 'darwin': |
| sources.append('_ctypes/malloc_closure.c') |
| sources.append('_ctypes/darwin/dlfcn_simple.c') |
| extra_compile_args.append('-DMACOSX') |
| @@ -1738,7 +1795,7 @@ class PyBuildExt(build_ext): |
| # XXX Is this still needed? |
| ## extra_link_args.extend(['-read_only_relocs', 'warning']) |
| - elif sys.platform == 'sunos5': |
| + elif host_platform == 'sunos5': |
| # XXX This shouldn't be necessary; it appears that some |
| # of the assembler code is non-PIC (i.e. it has relocations |
| # when it shouldn't. The proper fix would be to rewrite |
| @@ -1749,7 +1806,7 @@ class PyBuildExt(build_ext): |
| # finding some -z option for the Sun compiler. |
| extra_link_args.append('-mimpure-text') |
| - elif sys.platform.startswith('hp-ux'): |
| + elif host_platform.startswith('hp-ux'): |
| extra_link_args.append('-fPIC') |
| ext = Extension('_ctypes', |
| @@ -1766,7 +1823,7 @@ class PyBuildExt(build_ext): |
| if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"): |
| return |
| - if sys.platform == 'darwin': |
| + if host_platform == 'darwin': |
| # OS X 10.5 comes with libffi.dylib; the include files are |
| # in /usr/include/ffi |
| inc_dirs.append('/usr/include/ffi') |
| @@ -1800,6 +1857,7 @@ class PyBuildExt(build_ext): |
| extra_compile_args = [] |
| undef_macros=['NDEBUG'] |
| if '--with-system-libmpdec' in sysconfig.get_config_var("CONFIG_ARGS"): |
| + # TODO: next ignore user specified header search path |
| include_dirs = [] |
| libraries = ['mpdec'] |
| sources = ['_decimal/_decimal.c'] |
| @@ -1859,7 +1917,7 @@ class PyBuildExt(build_ext): |
| 'universal': [('UNIVERSAL','1')] |
| } |
| - platform = self.get_platform() |
| + platform = host_platform |
| cc = sysconfig.get_config_var('CC') |
| sizeof_size_t = sysconfig.get_config_var('SIZEOF_SIZE_T') |
| machine = os.environ.get('PYTHON_DECIMAL_WITH_MACHINE') |