Skip to content

Commit a0049af

Browse files
committed
build: do not add <sys.prefix>/lib to library_dirs twice
build_ext.finalize_options unconditionally appended <sys.prefix>/lib. Skip the append when the directory is already in library_dirs, so a repeated finalize_options call or a pre-populated list does not produce a duplicate -L flag.
1 parent 02a542a commit a0049af

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎cuda_bindings/setup.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ def finalize_options(self):
3737
# library_dirs into the generated sources, and under build isolation
3838
# sys.prefix is a fresh /tmp/build-env-<random> per build, which
3939
# defeats sccache's preprocessor cache.
40-
self.library_dirs.append(os.path.join(sys.prefix, "lib"))
40+
prefix_lib = os.path.join(sys.prefix, "lib")
41+
if prefix_lib not in self.library_dirs:
42+
self.library_dirs.append(prefix_lib)
4143

4244
def build_extensions(self):
4345
if nthreads > 0:

0 commit comments

Comments
 (0)