6
6
import re
7
7
import shutil
8
8
import site
9
+ import subprocess
9
10
import sys
10
11
import tempfile
11
12
import textwrap
@@ -112,8 +113,8 @@ def test_build_ext(self, copy_so):
112
113
)
113
114
elif sys .platform == 'linux' :
114
115
libz_so = glob .glob ('/usr/lib*/libz.so*' )
115
- shutil .copyfile (libz_so [0 ], '/tmp/libxx_z.so' )
116
-
116
+ shutil .copyfile (libz_so [- 1 ], '/tmp/libxx_z.so' )
117
+
117
118
xx_ext = Extension (
118
119
'xx' ,
119
120
[xx_c ],
@@ -140,7 +141,7 @@ def test_build_ext(self, copy_so):
140
141
141
142
with safe_extension_import ('xx' , self .tmp_dir ):
142
143
self ._test_xx (copy_so )
143
-
144
+
144
145
if sys .platform == 'linux' and copy_so :
145
146
os .unlink ('/tmp/libxx_z.so' )
146
147
@@ -159,9 +160,11 @@ def _test_xx(copy_so):
159
160
assert xx .__doc__ == doc
160
161
assert isinstance (xx .Null (), xx .Null )
161
162
assert isinstance (xx .Str (), xx .Str )
162
-
163
+
163
164
if sys .platform == 'linux' :
164
- so_headers = subprocess .check_output (["readelf" , "-d" , xx .__file__ ], universal_newlines = True )
165
+ so_headers = subprocess .check_output (
166
+ ["readelf" , "-d" , xx .__file__ ], universal_newlines = True
167
+ )
165
168
if not copy_so :
166
169
# Linked against a library in /usr/lib{,64}
167
170
assert 'RPATH' not in so_headers and 'RUNPATH' not in so_headers
0 commit comments