1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
Fix for bpo-32521: nis libnsl (#5190) backported to python 3.5
Index: b/setup.py
===================================================================
*** a/setup.py
--- b/setup.py
*************** class PyBuildExt(build_ext):
*** 1301,1320 ****
exts.append( Extension('termios', ['termios.c']) )
# Jeremy Hylton's rlimit interface
exts.append( Extension('resource', ['resource.c']) )
! # Sun yellow pages. Some systems have the functions in libc.
! if (host_platform not in ['cygwin', 'qnx6'] and
! find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None):
! if (self.compiler.find_library_file(lib_dirs, 'nsl')):
! libs = ['nsl']
! else:
! libs = []
! exts.append( Extension('nis', ['nismodule.c'],
! libraries = libs) )
! else:
! missing.append('nis')
else:
! missing.extend(['nis', 'resource', 'termios'])
# Curses support, requiring the System V version of curses, often
# provided by the ncurses library.
--- 1301,1314 ----
exts.append( Extension('termios', ['termios.c']) )
# Jeremy Hylton's rlimit interface
exts.append( Extension('resource', ['resource.c']) )
+ else:
+ missing.extend(['resource', 'termios'])
! nis = self._detect_nis(inc_dirs, lib_dirs)
! if nis is not None:
! exts.append(nis)
else:
! missing.append('nis')
# Curses support, requiring the System V version of curses, often
# provided by the ncurses library.
*************** class PyBuildExt(build_ext):
*** 2153,2158 ****
--- 2147,2198 ----
)
return ext
+ def _detect_nis(self, inc_dirs, lib_dirs):
+ if host_platform in {'win32', 'cygwin', 'qnx6'}:
+ return None
+
+ libs = []
+ library_dirs = []
+ includes_dirs = []
+
+ # bpo-32521: glibc has deprecated Sun RPC for some time. Fedora 28
+ # moved headers and libraries to libtirpc and libnsl. The headers
+ # are in tircp and nsl sub directories.
+ rpcsvc_inc = find_file(
+ 'rpcsvc/yp_prot.h', inc_dirs,
+ [os.path.join(inc_dir, 'nsl') for inc_dir in inc_dirs]
+ )
+ rpc_inc = find_file(
+ 'rpc/rpc.h', inc_dirs,
+ [os.path.join(inc_dir, 'tirpc') for inc_dir in inc_dirs]
+ )
+ if rpcsvc_inc is None or rpc_inc is None:
+ # not found
+ return None
+ includes_dirs.extend(rpcsvc_inc)
+ includes_dirs.extend(rpc_inc)
+
+ if self.compiler.find_library_file(lib_dirs, 'nsl'):
+ libs.append('nsl')
+ else:
+ # libnsl-devel: check for libnsl in nsl/ subdirectory
+ nsl_dirs = [os.path.join(lib_dir, 'nsl') for lib_dir in lib_dirs]
+ libnsl = self.compiler.find_library_file(nsl_dirs, 'nsl')
+ if libnsl is not None:
+ library_dirs.append(os.path.dirname(libnsl))
+ libs.append('nsl')
+
+ if self.compiler.find_library_file(lib_dirs, 'tirpc'):
+ libs.append('tirpc')
+
+ return Extension(
+ 'nis', ['nismodule.c'],
+ libraries=libs,
+ library_dirs=library_dirs,
+ include_dirs=includes_dirs
+ )
+
+
class PyBuildInstall(install):
# Suppress the warning about installation into the lib_dynload
# directory, which is not in sys.path when running Python during
|