Annotation of pkgsrc/lang/python39/patches/patch-setup.py, revision 1.5
1.5 ! adam 1: $NetBSD: patch-setup.py,v 1.4 2020/12/08 14:30:40 adam 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.
1.1 adam 7:
1.5 ! adam 8: --- setup.py.orig 2021-11-05 19:21:41.000000000 +0000
1.1 adam 9: +++ setup.py
1.4 adam 10: @@ -30,7 +30,7 @@ except ImportError:
1.1 adam 11: SUBPROCESS_BOOTSTRAP = True
12:
13:
14: -from distutils import log
15: +from distutils import log, 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
1.4 adam 19: @@ -44,7 +44,7 @@ from distutils.spawn import find_executa
1.1 adam 20: TEST_EXTENSIONS = True
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:
27: def get_platform():
1.4 adam 28: @@ -224,6 +224,16 @@ def grep_headers_for(function, headers):
29: return True
30: return False
1.2 sjmulder 31:
32: +def grep_headers_for(function, headers):
33: + for header in headers:
1.3 bsiegert 34: + try:
35: + with open(header, 'r') as f:
36: + if function in f.read():
37: + return True
38: + except UnicodeDecodeError:
39: + pass
1.2 sjmulder 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
1.5 ! adam 45: @@ -728,15 +738,15 @@ class PyBuildExt(build_ext):
1.1 adam 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:
1.5 ! adam 70: @@ -784,6 +794,9 @@ class PyBuildExt(build_ext):
1.2 sjmulder 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.
1.5 ! adam 80: @@ -1001,8 +1014,6 @@ class PyBuildExt(build_ext):
1.1 adam 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'):
1.5 ! adam 89: @@ -1104,8 +1115,7 @@ class PyBuildExt(build_ext):
1.1 adam 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,
1.5 ! adam 99: @@ -1356,6 +1366,31 @@ class PyBuildExt(build_ext):
1.1 adam 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
1.5 ! adam 131: @@ -1367,7 +1402,7 @@ class PyBuildExt(build_ext):
1.1 adam 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,
1.5 ! adam 140: @@ -2207,10 +2242,7 @@ class PyBuildExt(build_ext):
1.1 adam 141: sources = ['_decimal/_decimal.c']
142: depends = ['_decimal/docstrings.h']
143: else:
144: - include_dirs = [os.path.abspath(os.path.join(self.srcdir,
145: - 'Modules',
146: - '_decimal',
147: - 'libmpdec'))]
148: + include_dirs = ['Modules/_decimal/libmpdec']
149: libraries = ['m']
150: sources = [
151: '_decimal/_decimal.c',
1.5 ! adam 152: @@ -2595,7 +2627,7 @@ def main():
1.1 adam 153: # If you change the scripts installed here, you also need to
154: # check the PyBuildScripts command above, and change the links
155: # created by the bininstall target in Makefile.pre.in
156: - scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
157: + scripts = ["Tools/scripts/pydoc3",
158: "Tools/scripts/2to3"]
159: )
160:
CVSweb <webmaster@jp.NetBSD.org>