Annotation of pkgsrc/lang/python39/patches/patch-setup.py, revision 1.1
1.1 ! adam 1: $NetBSD: patch-setup.py,v 1.3 2020/07/14 19:12:31 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 2020-10-05 15:07:58.000000000 +0000
! 10: +++ setup.py
! 11: @@ -29,7 +29,7 @@ except ImportError:
! 12: SUBPROCESS_BOOTSTRAP = True
! 13:
! 14:
! 15: -from distutils import log
! 16: +from distutils import log, text_file
! 17: from distutils.command.build_ext import build_ext
! 18: from distutils.command.build_scripts import build_scripts
! 19: from distutils.command.install import install
! 20: @@ -43,7 +43,7 @@ from distutils.spawn import find_executa
! 21: TEST_EXTENSIONS = True
! 22:
! 23: # This global variable is used to hold the list of modules to be disabled.
! 24: -DISABLED_MODULE_LIST = []
! 25: +DISABLED_MODULE_LIST = ["_curses", "_curses_panel", "_elementtree", "_gdbm", "pyexpat", "readline", "_sqlite3", "_tkinter", "xxlimited"]
! 26:
! 27:
! 28: def get_platform():
! 29: @@ -740,15 +740,15 @@ class PyBuildExt(build_ext):
! 30: add_dir_to_list(dir_list, directory)
! 31:
! 32: def configure_compiler(self):
! 33: - # Ensure that /usr/local is always used, but the local build
! 34: - # directories (i.e. '.' and 'Include') must be first. See issue
! 35: - # 10520.
! 36: - if not CROSS_COMPILING:
! 37: - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
! 38: - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
! 39: - # only change this for cross builds for 3.3, issues on Mageia
! 40: - if CROSS_COMPILING:
! 41: - self.add_cross_compiling_paths()
! 42: + # Add the buildlink directories for pkgsrc
! 43: + if os.environ.get('BUILDLINK_DIR'):
! 44: + dir = os.environ['BUILDLINK_DIR']
! 45: + libdir = dir + '/lib'
! 46: + incdir = dir + '/include'
! 47: + if libdir not in self.compiler.library_dirs:
! 48: + self.compiler.library_dirs.insert(0, libdir)
! 49: + if incdir not in self.compiler.include_dirs:
! 50: + self.compiler.include_dirs.insert(0, incdir)
! 51: self.add_multiarch_paths()
! 52: self.add_ldflags_cppflags()
! 53:
! 54: @@ -1013,8 +1013,6 @@ class PyBuildExt(build_ext):
! 55: # use the same library for the readline and curses modules.
! 56: if 'curses' in readline_termcap_library:
! 57: curses_library = readline_termcap_library
! 58: - elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'):
! 59: - curses_library = 'ncursesw'
! 60: # Issue 36210: OSS provided ncurses does not link on AIX
! 61: # Use IBM supplied 'curses' for successful build of _curses
! 62: elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'):
! 63: @@ -1116,8 +1114,7 @@ class PyBuildExt(build_ext):
! 64: # If the curses module is enabled, check for the panel module
! 65: # _curses_panel needs some form of ncurses
! 66: skip_curses_panel = True if AIX else False
! 67: - if (curses_enabled and not skip_curses_panel and
! 68: - self.compiler.find_library_file(self.lib_dirs, panel_library)):
! 69: + if curses_enabled and not skip_curses_panel:
! 70: self.add(Extension('_curses_panel', ['_curses_panel.c'],
! 71: include_dirs=curses_includes,
! 72: define_macros=curses_defines,
! 73: @@ -1368,6 +1365,31 @@ class PyBuildExt(build_ext):
! 74: dbm_order = ['gdbm']
! 75: # The standard Unix dbm module:
! 76: if not CYGWIN:
! 77: + # Top half based on find_file
! 78: + def find_ndbm_h(dirs):
! 79: + ret = None
! 80: + if MACOS:
! 81: + sysroot = macosx_sdk_root()
! 82: + for dir in dirs:
! 83: + f = os.path.join(dir, 'ndbm.h')
! 84: + if MACOS and is_macosx_sdk_path(dir):
! 85: + f = os.path.join(sysroot, dir[1:], 'ndbm.h')
! 86: + if not os.path.exists(f):
! 87: + continue
! 88: +
! 89: + ret = True
! 90: + input = text_file.TextFile(f)
! 91: + while True:
! 92: + line = input.readline()
! 93: + if not line:
! 94: + break
! 95: + if re.search('This file is part of GDBM', line):
! 96: + ret = None
! 97: + break
! 98: + input.close()
! 99: + break
! 100: + return ret
! 101: +
! 102: config_args = [arg.strip("'")
! 103: for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
! 104: dbm_args = [arg for arg in config_args
! 105: @@ -1379,7 +1401,7 @@ class PyBuildExt(build_ext):
! 106: dbmext = None
! 107: for cand in dbm_order:
! 108: if cand == "ndbm":
! 109: - if find_file("ndbm.h", self.inc_dirs, []) is not None:
! 110: + if find_ndbm_h(self.inc_dirs) is not None:
! 111: # Some systems have -lndbm, others have -lgdbm_compat,
! 112: # others don't have either
! 113: if self.compiler.find_library_file(self.lib_dirs,
! 114: @@ -1779,6 +1801,8 @@ class PyBuildExt(build_ext):
! 115: def detect_uuid(self):
! 116: # Build the _uuid module if possible
! 117: uuid_incs = find_file("uuid.h", self.inc_dirs, ["/usr/include/uuid"])
! 118: + if uuid_incs is None:
! 119: + uuid_incs = find_file("uuid/uuid.h", self.inc_dirs, [])
! 120: if uuid_incs is not None:
! 121: if self.compiler.find_library_file(self.lib_dirs, 'uuid'):
! 122: uuid_libs = ['uuid']
! 123: @@ -2226,10 +2250,7 @@ class PyBuildExt(build_ext):
! 124: sources = ['_decimal/_decimal.c']
! 125: depends = ['_decimal/docstrings.h']
! 126: else:
! 127: - include_dirs = [os.path.abspath(os.path.join(self.srcdir,
! 128: - 'Modules',
! 129: - '_decimal',
! 130: - 'libmpdec'))]
! 131: + include_dirs = ['Modules/_decimal/libmpdec']
! 132: libraries = ['m']
! 133: sources = [
! 134: '_decimal/_decimal.c',
! 135: @@ -2609,7 +2630,7 @@ def main():
! 136: # If you change the scripts installed here, you also need to
! 137: # check the PyBuildScripts command above, and change the links
! 138: # created by the bininstall target in Makefile.pre.in
! 139: - scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
! 140: + scripts = ["Tools/scripts/pydoc3",
! 141: "Tools/scripts/2to3"]
! 142: )
! 143:
CVSweb <webmaster@jp.NetBSD.org>