Annotation of pkgsrc/lang/python310/patches/patch-setup.py, revision 1.1
1.1 ! adam 1: $NetBSD: patch-setup.py,v 1.4 2020/12/08 14:30:40 adam Exp $
! 2:
! 3: Disable certain modules, so they can be built as separate packages.
! 4: Do not look for ncursesw.
! 5: Assume panel_library is correct; this is a fix for ncurses' gnupanel
! 6: which will get transformed to panel in buildlink.
! 7: Also look for uuid/uuid.h.
! 8:
! 9: --- setup.py.orig 2021-07-10 00:51:07.000000000 +0000
! 10: +++ setup.py
! 11: @@ -45,6 +45,7 @@ with warnings.catch_warnings():
! 12: DeprecationWarning
! 13: )
! 14:
! 15: + from distutils import text_file
! 16: from distutils.command.build_ext import build_ext
! 17: from distutils.command.build_scripts import build_scripts
! 18: from distutils.command.install import install
! 19: @@ -58,7 +59,7 @@ with warnings.catch_warnings():
! 20: TEST_EXTENSIONS = (sysconfig.get_config_var('TEST_MODULES') == 'yes')
! 21:
! 22: # This global variable is used to hold the list of modules to be disabled.
! 23: -DISABLED_MODULE_LIST = []
! 24: +DISABLED_MODULE_LIST = ["_curses", "_curses_panel", "_elementtree", "_gdbm", "pyexpat", "readline", "_sqlite3", "_tkinter", "xxlimited"]
! 25:
! 26: # --list-module-names option used by Tools/scripts/generate_module_names.py
! 27: LIST_MODULE_NAMES = False
! 28: @@ -246,6 +247,16 @@ def grep_headers_for(function, headers):
! 29: return False
! 30:
! 31:
! 32: +def grep_headers_for(function, headers):
! 33: + for header in headers:
! 34: + try:
! 35: + with open(header, 'r') as f:
! 36: + if function in f.read():
! 37: + return True
! 38: + except UnicodeDecodeError:
! 39: + pass
! 40: + return False
! 41: +
! 42: def find_file(filename, std_dirs, paths):
! 43: """Searches for the directory where a given file is located,
! 44: and returns a possibly-empty list of additional directories, or None
! 45: @@ -804,15 +815,15 @@ class PyBuildExt(build_ext):
! 46: add_dir_to_list(dir_list, directory)
! 47:
! 48: def configure_compiler(self):
! 49: - # Ensure that /usr/local is always used, but the local build
! 50: - # directories (i.e. '.' and 'Include') must be first. See issue
! 51: - # 10520.
! 52: - if not CROSS_COMPILING:
! 53: - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
! 54: - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
! 55: - # only change this for cross builds for 3.3, issues on Mageia
! 56: - if CROSS_COMPILING:
! 57: - self.add_cross_compiling_paths()
! 58: + # Add the buildlink directories for pkgsrc
! 59: + if os.environ.get('BUILDLINK_DIR'):
! 60: + dir = os.environ['BUILDLINK_DIR']
! 61: + libdir = dir + '/lib'
! 62: + incdir = dir + '/include'
! 63: + if libdir not in self.compiler.library_dirs:
! 64: + self.compiler.library_dirs.insert(0, libdir)
! 65: + if incdir not in self.compiler.include_dirs:
! 66: + self.compiler.include_dirs.insert(0, incdir)
! 67: self.add_multiarch_paths()
! 68: self.add_ldflags_cppflags()
! 69:
! 70: @@ -860,6 +871,9 @@ class PyBuildExt(build_ext):
! 71: self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
! 72:
! 73: if MACOS:
! 74: + self.inc_dirs.append(macosx_sdk_root() + '/usr/include')
! 75: + self.lib_dirs.append(macosx_sdk_root() + '/usr/lib')
! 76: +
! 77: # This should work on any unixy platform ;-)
! 78: # If the user has bothered specifying additional -I and -L flags
! 79: # in OPT and LDFLAGS we might as well use them here.
! 80: @@ -1087,8 +1101,6 @@ class PyBuildExt(build_ext):
! 81: # use the same library for the readline and curses modules.
! 82: if 'curses' in readline_termcap_library:
! 83: curses_library = readline_termcap_library
! 84: - elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'):
! 85: - curses_library = 'ncursesw'
! 86: # Issue 36210: OSS provided ncurses does not link on AIX
! 87: # Use IBM supplied 'curses' for successful build of _curses
! 88: elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'):
! 89: @@ -1192,8 +1204,7 @@ class PyBuildExt(build_ext):
! 90: # If the curses module is enabled, check for the panel module
! 91: # _curses_panel needs some form of ncurses
! 92: skip_curses_panel = True if AIX else False
! 93: - if (curses_enabled and not skip_curses_panel and
! 94: - self.compiler.find_library_file(self.lib_dirs, panel_library)):
! 95: + if curses_enabled and not skip_curses_panel:
! 96: self.add(Extension('_curses_panel', ['_curses_panel.c'],
! 97: include_dirs=curses_includes,
! 98: define_macros=curses_defines,
! 99: @@ -1438,6 +1449,31 @@ class PyBuildExt(build_ext):
! 100: dbm_order = ['gdbm']
! 101: # The standard Unix dbm module:
! 102: if not CYGWIN:
! 103: + # Top half based on find_file
! 104: + def find_ndbm_h(dirs):
! 105: + ret = None
! 106: + if MACOS:
! 107: + sysroot = macosx_sdk_root()
! 108: + for dir in dirs:
! 109: + f = os.path.join(dir, 'ndbm.h')
! 110: + if MACOS and is_macosx_sdk_path(dir):
! 111: + f = os.path.join(sysroot, dir[1:], 'ndbm.h')
! 112: + if not os.path.exists(f):
! 113: + continue
! 114: +
! 115: + ret = True
! 116: + input = text_file.TextFile(f)
! 117: + while True:
! 118: + line = input.readline()
! 119: + if not line:
! 120: + break
! 121: + if re.search('This file is part of GDBM', line):
! 122: + ret = None
! 123: + break
! 124: + input.close()
! 125: + break
! 126: + return ret
! 127: +
! 128: config_args = [arg.strip("'")
! 129: for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
! 130: dbm_args = [arg for arg in config_args
! 131: @@ -1449,7 +1485,7 @@ class PyBuildExt(build_ext):
! 132: dbmext = None
! 133: for cand in dbm_order:
! 134: if cand == "ndbm":
! 135: - if find_file("ndbm.h", self.inc_dirs, []) is not None:
! 136: + if find_ndbm_h(self.inc_dirs) is not None:
! 137: # Some systems have -lndbm, others have -lgdbm_compat,
! 138: # others don't have either
! 139: if self.compiler.find_library_file(self.lib_dirs,
! 140: @@ -1845,6 +1881,8 @@ class PyBuildExt(build_ext):
! 141: def detect_uuid(self):
! 142: # Build the _uuid module if possible
! 143: uuid_incs = find_file("uuid.h", self.inc_dirs, ["/usr/include/uuid"])
! 144: + if uuid_incs is None:
! 145: + uuid_incs = find_file("uuid/uuid.h", self.inc_dirs, [])
! 146: if uuid_incs is not None:
! 147: if self.compiler.find_library_file(self.lib_dirs, 'uuid'):
! 148: uuid_libs = ['uuid']
! 149: @@ -2308,10 +2346,7 @@ class PyBuildExt(build_ext):
! 150: sources = ['_decimal/_decimal.c']
! 151: depends = ['_decimal/docstrings.h']
! 152: else:
! 153: - include_dirs = [os.path.abspath(os.path.join(self.srcdir,
! 154: - 'Modules',
! 155: - '_decimal',
! 156: - 'libmpdec'))]
! 157: + include_dirs = ['Modules/_decimal/libmpdec']
! 158: libraries = ['m']
! 159: sources = [
! 160: '_decimal/_decimal.c',
! 161: @@ -2727,7 +2762,7 @@ def main():
! 162: # If you change the scripts installed here, you also need to
! 163: # check the PyBuildScripts command above, and change the links
! 164: # created by the bininstall target in Makefile.pre.in
! 165: - scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
! 166: + scripts = ["Tools/scripts/pydoc3",
! 167: "Tools/scripts/2to3"]
! 168: )
! 169:
CVSweb <webmaster@jp.NetBSD.org>