Files
Joshua Root 9719fb3cf8 python27: libffi detection fixes
Fix getting libffi include dir from pkgconfig. Fix ffi.h validation to
recognise muniversal builds.

See: https://trac.macports.org/ticket/63730
2022-01-08 23:51:42 +11:00

105 lines
4.4 KiB
Diff

--- setup.py.orig 2020-04-20 07:13:39.000000000 +1000
+++ setup.py 2022-01-08 23:39:54.000000000 +1100
@@ -33,7 +33,7 @@
COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
# This global variable is used to hold the list of modules to be disabled.
-disabled_module_list = []
+disabled_module_list = ['_tkinter', 'gdbm']
def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (at the front) if
@@ -500,10 +500,6 @@
os.unlink(tmpfile)
def detect_modules(self):
- # Ensure that /usr/local is always used
- 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')
if cross_compiling:
self.add_gcc_paths()
self.add_multiarch_paths()
@@ -854,10 +850,7 @@
depends=['socketmodule.h'],
libraries=math_libs) )
# Detect SSL support for the socket module (via _ssl)
- search_for_ssl_incs_in = [
- '/usr/local/ssl/include',
- '/usr/contrib/ssl/include/'
- ]
+ search_for_ssl_incs_in = []
ssl_incs = find_file('openssl/ssl.h', inc_dirs,
search_for_ssl_incs_in
)
@@ -867,9 +860,7 @@
if krb5_h:
ssl_incs += krb5_h
ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
- ['/usr/local/ssl/lib',
- '/usr/contrib/ssl/lib/'
- ] )
+ [] )
if (ssl_incs is not None and
ssl_libs is not None):
@@ -990,34 +981,7 @@
# construct a list of paths to look for the header file in on
# top of the normal inc_dirs.
- db_inc_paths = [
- '/usr/include/db4',
- '/usr/local/include/db4',
- '/opt/sfw/include/db4',
- '/usr/include/db3',
- '/usr/local/include/db3',
- '/opt/sfw/include/db3',
- # Fink defaults (http://fink.sourceforge.net/)
- '/sw/include/db4',
- '/sw/include/db3',
- ]
- # 4.x minor number specific paths
- for x in gen_db_minor_ver_nums(4):
- db_inc_paths.append('/usr/include/db4%d' % x)
- db_inc_paths.append('/usr/include/db4.%d' % x)
- db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x)
- db_inc_paths.append('/usr/local/include/db4%d' % x)
- db_inc_paths.append('/pkg/db-4.%d/include' % x)
- db_inc_paths.append('/opt/db-4.%d/include' % x)
- # MacPorts default (http://www.macports.org/)
- db_inc_paths.append('/opt/local/include/db4%d' % x)
- # 3.x minor number specific paths
- for x in gen_db_minor_ver_nums(3):
- db_inc_paths.append('/usr/include/db3%d' % x)
- db_inc_paths.append('/usr/local/BerkeleyDB.3.%d/include' % x)
- db_inc_paths.append('/usr/local/include/db3%d' % x)
- db_inc_paths.append('/pkg/db-3.%d/include' % x)
- db_inc_paths.append('/opt/db-3.%d/include' % x)
+ db_inc_paths = []
if cross_compiling:
db_inc_paths = []
@@ -2163,11 +2127,6 @@
if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"):
return
- 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')
-
ffi_inc = [sysconfig.get_config_var("LIBFFI_INCLUDEDIR")]
if not ffi_inc or ffi_inc[0] == '':
ffi_inc = find_file('ffi.h', [], inc_dirs)
@@ -2177,7 +2136,9 @@
for line in f:
line = line.strip()
if line.startswith(('#define LIBFFI_H',
- '#define ffi_wrapper_h')):
+ '#define ffi_wrapper_h')) \
+ or (line.startswith('#include "') and
+ line.endswith('-ffi.h"')):
break
else:
ffi_inc = None