Skip to content

Commit

Permalink
Fix test_zippath_from_non_installed_posix
Browse files Browse the repository at this point in the history
When build with shared enabled, we need to set `LD_LIBRARY_PATH`
for the non-installed python environment in
test_zippath_from_non_installed_posix so that the python binary
and find and link the libpython.so.
  • Loading branch information
kkpattern committed Nov 14, 2022
1 parent 65dd745 commit 7082899
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Lib/test/test_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,17 @@ def test_zippath_from_non_installed_posix(self):
# venv module correctly.
pythonpath = os.pathsep.join(
additional_pythonpath_for_non_installed)
subprocess.check_call(cmd, env={"PYTHONPATH": pythonpath})
# For python built with shared enabled. We need to set
# LD_LIBRARY_PATH so the non-installed python can find and link
# libpython.so
ld_library_path = os.path.abspath(os.path.dirname(sys.executable))
if sys.platform == 'darwin':
ld_library_path_env = "DYLD_LIBRARY_PATH"
else:
ld_library_path_env = "LD_LIBRARY_PATH"
subprocess.check_call(cmd,
env={"PYTHONPATH": pythonpath,
ld_library_path_env: ld_library_path})
envpy = os.path.join(self.env_dir, self.bindir, self.exe)
# Now check the venv created from the non-installed python has
# correct zip path in pythonpath.
Expand Down

0 comments on commit 7082899

Please sign in to comment.