Skip to content

Commit a698516

Browse files
ericsongcopybara-github
authored andcommitted
Deduplicate paths between old and new PYTHONPATH
Resolves #15649 by deduplicating the PYTHONPATH after the old and new one has been joined. Closes #15648. PiperOrigin-RevId: 462362553 Change-Id: I031f693ba8d17c66436685270dc518ad97d7053a
1 parent 4df77f7 commit a698516

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -298,13 +298,14 @@ def Main():
298298
# keep first occurrence only.
299299
python_path_entries = [
300300
GetWindowsPathWithUNCPrefix(d)
301-
for d in Deduplicate(python_path_entries)
301+
for d in python_path_entries
302302
]
303303

304304
old_python_path = os.environ.get('PYTHONPATH')
305-
python_path = os.pathsep.join(python_path_entries)
306305
if old_python_path:
307-
python_path += os.pathsep + old_python_path
306+
python_path_entries += old_python_path.split(os.pathsep)
307+
308+
python_path = os.pathsep.join(Deduplicate(python_path_entries))
308309

309310
if IsWindows():
310311
python_path = python_path.replace('/', os.sep)

0 commit comments

Comments
 (0)