[2.7] bpo-32521: nis libnsl (GH-5190) (#5353) · python/cpython@38487a0 (original) (raw)
`@@ -1346,26 +1346,11 @@ class db_found(Exception): pass
`
1346
1346
`else:
`
1347
1347
`missing.append('resource')
`
1348
1348
``
1349
``
`-
Sun yellow pages. Some systems have the functions in libc.
`
1350
``
`-
if (host_platform not in ['cygwin', 'atheos', 'qnx6'] and
`
1351
``
`-
find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None):
`
1352
``
`-
nis_libs = []
`
1353
``
`-
nis_includes = []
`
1354
``
`-
if self.compiler.find_library_file(lib_dirs, 'nsl'):
`
1355
``
`-
nis_libs.append('nsl')
`
1356
``
`-
if self.compiler.find_library_file(lib_dirs, 'tirpc'):
`
1357
``
`-
Sun RPC has been moved from glibc to libtirpc
`
1358
``
`-
rpcsvc/yp_prot.h is still in /usr/include, but
`
1359
``
`-
rpc/rpc.h has been moved into tirpc/ subdir.
`
1360
``
`-
nis_libs.append('tirpc')
`
1361
``
`-
nis_includes.append('/usr/include/tirpc')
`
1362
``
`-
exts.append( Extension('nis', ['nismodule.c'],
`
1363
``
`-
libraries = nis_libs,
`
1364
``
`-
include_dirs=nis_includes) )
`
``
1349
`+
nis = self._detect_nis(inc_dirs, lib_dirs)
`
``
1350
`+
if nis is not None:
`
``
1351
`+
exts.append(nis)
`
1365
1352
`else:
`
1366
1353
`missing.append('nis')
`
1367
``
`-
else:
`
1368
``
`-
missing.extend(['nis', 'resource', 'termios'])
`
1369
1354
``
1370
1355
`# Curses support, requiring the System V version of curses, often
`
1371
1356
`# provided by the ncurses library.
`
`@@ -2164,6 +2149,51 @@ def detect_ctypes(self, inc_dirs, lib_dirs):
`
2164
2149
`ext.libraries.append(ffi_lib)
`
2165
2150
`self.use_system_libffi = True
`
2166
2151
``
``
2152
`+
def _detect_nis(self, inc_dirs, lib_dirs):
`
``
2153
`+
if host_platform in {'win32', 'cygwin', 'qnx6'}:
`
``
2154
`+
return None
`
``
2155
+
``
2156
`+
libs = []
`
``
2157
`+
library_dirs = []
`
``
2158
`+
includes_dirs = []
`
``
2159
+
``
2160
`+
bpo-32521: glibc has deprecated Sun RPC for some time. Fedora 28
`
``
2161
`+
moved headers and libraries to libtirpc and libnsl. The headers
`
``
2162
`+
are in tircp and nsl sub directories.
`
``
2163
`+
rpcsvc_inc = find_file(
`
``
2164
`+
'rpcsvc/yp_prot.h', inc_dirs,
`
``
2165
`+
[os.path.join(inc_dir, 'nsl') for inc_dir in inc_dirs]
`
``
2166
`+
)
`
``
2167
`+
rpc_inc = find_file(
`
``
2168
`+
'rpc/rpc.h', inc_dirs,
`
``
2169
`+
[os.path.join(inc_dir, 'tirpc') for inc_dir in inc_dirs]
`
``
2170
`+
)
`
``
2171
`+
if rpcsvc_inc is None or rpc_inc is None:
`
``
2172
`+
not found
`
``
2173
`+
return None
`
``
2174
`+
includes_dirs.extend(rpcsvc_inc)
`
``
2175
`+
includes_dirs.extend(rpc_inc)
`
``
2176
+
``
2177
`+
if self.compiler.find_library_file(lib_dirs, 'nsl'):
`
``
2178
`+
libs.append('nsl')
`
``
2179
`+
else:
`
``
2180
`+
libnsl-devel: check for libnsl in nsl/ subdirectory
`
``
2181
`+
nsl_dirs = [os.path.join(lib_dir, 'nsl') for lib_dir in lib_dirs]
`
``
2182
`+
libnsl = self.compiler.find_library_file(nsl_dirs, 'nsl')
`
``
2183
`+
if libnsl is not None:
`
``
2184
`+
library_dirs.append(os.path.dirname(libnsl))
`
``
2185
`+
libs.append('nsl')
`
``
2186
+
``
2187
`+
if self.compiler.find_library_file(lib_dirs, 'tirpc'):
`
``
2188
`+
libs.append('tirpc')
`
``
2189
+
``
2190
`+
return Extension(
`
``
2191
`+
'nis', ['nismodule.c'],
`
``
2192
`+
libraries=libs,
`
``
2193
`+
library_dirs=library_dirs,
`
``
2194
`+
include_dirs=includes_dirs
`
``
2195
`+
)
`
``
2196
+
2167
2197
``
2168
2198
`class PyBuildInstall(install):
`
2169
2199
`# Suppress the warning about installation into the lib_dynload
`