Skip to content

Commit 11cda28

Browse files
author
Martin Larralde
committed
Fix wrong dylib being copied from multiple target directory
1 parent 302054c commit 11cda28

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

setuptools_rust/build.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,19 @@ def build_extension(self, ext):
181181
target_dir)
182182
else:
183183
if sys.platform == "win32":
184-
wildcard_so = "*.dll"
184+
dylib_ext = "dll"
185185
elif sys.platform == "darwin":
186-
wildcard_so = "*.dylib"
186+
dylib_ext = "dylib"
187187
else:
188-
wildcard_so = "*.so"
188+
dylib_ext = "so"
189+
wildcard_so = "*{}.{}".format(ext.basename, dylib_ext)
189190

190191
try:
191-
dylib_paths.append(
192-
(ext.name, glob.glob(
193-
os.path.join(artifactsdir, wildcard_so))[0]))
194-
except IndexError:
192+
dylib_paths.append((
193+
ext.name,
194+
next(glob.iglob(os.path.join(artifactsdir, wildcard_so)))
195+
))
196+
except StopIteration:
195197
raise DistutilsExecError(
196198
"rust build failed; unable to find any %s in %s" %
197199
(wildcard_so, artifactsdir))

0 commit comments

Comments
 (0)