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