1
0
Fork 0
mirror of https://github.com/python-poetry/install.python-poetry.org.git synced 2024-11-21 21:50:58 -05:00

Fix poetry installer with homebrew python

This commit is contained in:
Yuriy Ostapenko 2023-09-17 15:20:08 +02:00 committed by GitHub
parent e518c55933
commit 53bcf30fa7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -314,7 +314,14 @@ class VirtualEnvironment:
import ensurepip # noqa: F401
import venv
builder = venv.EnvBuilder(clear=True, with_pip=True, symlinks=False)
use_symlinks = False
if os.path.islink(sys.executable):
link_target = os.readlink(sys.executable)
# if sys.executable is a relative symlink, such as python, installed
# from homebrew on MacOS, it will not work once copied
use_symlinks = not os.path.isabs(link_target)
builder = venv.EnvBuilder(clear=True, with_pip=True, symlinks=use_symlinks)
context = builder.ensure_directories(target)
if (