bpo-32521: nis libnsl (#5190) · python/cpython@29a7df7 (original) (raw)
`@@ -1315,27 +1315,14 @@ class db_found(Exception): pass
`
1315
1315
`exts.append( Extension('termios', ['termios.c']) )
`
1316
1316
`# Jeremy Hylton's rlimit interface
`
1317
1317
`exts.append( Extension('resource', ['resource.c']) )
`
``
1318
`+
else:
`
``
1319
`+
missing.extend(['resource', 'termios'])
`
1318
1320
``
1319
``
`-
Sun yellow pages. Some systems have the functions in libc.
`
1320
``
`-
if (host_platform not in ['cygwin', 'qnx6'] and
`
1321
``
`-
find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None):
`
1322
``
`-
nis_libs = []
`
1323
``
`-
nis_includes = []
`
1324
``
`-
if self.compiler.find_library_file(lib_dirs, 'nsl'):
`
1325
``
`-
nis_libs.append('nsl')
`
1326
``
`-
if self.compiler.find_library_file(lib_dirs, 'tirpc'):
`
1327
``
`-
Sun RPC has been moved from glibc to libtirpc
`
1328
``
`-
rpcsvc/yp_prot.h is still in /usr/include, but
`
1329
``
`-
rpc/rpc.h has been moved into tirpc/ subdir.
`
1330
``
`-
nis_libs.append('tirpc')
`
1331
``
`-
nis_includes.append('/usr/include/tirpc')
`
1332
``
`-
exts.append( Extension('nis', ['nismodule.c'],
`
1333
``
`-
libraries = nis_libs,
`
1334
``
`-
include_dirs=nis_includes) )
`
1335
``
`-
else:
`
1336
``
`-
missing.append('nis')
`
``
1321
`+
nis = self._detect_nis(inc_dirs, lib_dirs)
`
``
1322
`+
if nis is not None:
`
``
1323
`+
exts.append(nis)
`
1337
1324
`else:
`
1338
``
`-
missing.extend(['nis', 'resource', 'termios'])
`
``
1325
`+
missing.append('nis')
`
1339
1326
``
1340
1327
`# Curses support, requiring the System V version of curses, often
`
1341
1328
`# provided by the ncurses library.
`
`@@ -2175,6 +2162,51 @@ def split_var(name, sep):
`
2175
2162
``
2176
2163
`return ssl_ext, hashlib_ext
`
2177
2164
``
``
2165
`+
def _detect_nis(self, inc_dirs, lib_dirs):
`
``
2166
`+
if host_platform in {'win32', 'cygwin', 'qnx6'}:
`
``
2167
`+
return None
`
``
2168
+
``
2169
`+
libs = []
`
``
2170
`+
library_dirs = []
`
``
2171
`+
includes_dirs = []
`
``
2172
+
``
2173
`+
bpo-32521: glibc has deprecated Sun RPC for some time. Fedora 28
`
``
2174
`+
moved headers and libraries to libtirpc and libnsl. The headers
`
``
2175
`+
are in tircp and nsl sub directories.
`
``
2176
`+
rpcsvc_inc = find_file(
`
``
2177
`+
'rpcsvc/yp_prot.h', inc_dirs,
`
``
2178
`+
[os.path.join(inc_dir, 'nsl') for inc_dir in inc_dirs]
`
``
2179
`+
)
`
``
2180
`+
rpc_inc = find_file(
`
``
2181
`+
'rpc/rpc.h', inc_dirs,
`
``
2182
`+
[os.path.join(inc_dir, 'tirpc') for inc_dir in inc_dirs]
`
``
2183
`+
)
`
``
2184
`+
if rpcsvc_inc is None or rpc_inc is None:
`
``
2185
`+
not found
`
``
2186
`+
return None
`
``
2187
`+
includes_dirs.extend(rpcsvc_inc)
`
``
2188
`+
includes_dirs.extend(rpc_inc)
`
``
2189
+
``
2190
`+
if self.compiler.find_library_file(lib_dirs, 'nsl'):
`
``
2191
`+
libs.append('nsl')
`
``
2192
`+
else:
`
``
2193
`+
libnsl-devel: check for libnsl in nsl/ subdirectory
`
``
2194
`+
nsl_dirs = [os.path.join(lib_dir, 'nsl') for lib_dir in lib_dirs]
`
``
2195
`+
libnsl = self.compiler.find_library_file(nsl_dirs, 'nsl')
`
``
2196
`+
if libnsl is not None:
`
``
2197
`+
library_dirs.append(os.path.dirname(libnsl))
`
``
2198
`+
libs.append('nsl')
`
``
2199
+
``
2200
`+
if self.compiler.find_library_file(lib_dirs, 'tirpc'):
`
``
2201
`+
libs.append('tirpc')
`
``
2202
+
``
2203
`+
return Extension(
`
``
2204
`+
'nis', ['nismodule.c'],
`
``
2205
`+
libraries=libs,
`
``
2206
`+
library_dirs=library_dirs,
`
``
2207
`+
include_dirs=includes_dirs
`
``
2208
`+
)
`
``
2209
+
2178
2210
``
2179
2211
`class PyBuildInstall(install):
`
2180
2212
`# Suppress the warning about installation into the lib_dynload
`