python-setup: Fix site-package selection for unix
This commit is contained in:
Родитель
4bd9723e2b
Коммит
5ed1e985c2
|
@ -19,12 +19,16 @@ except ImportError:
|
||||||
# poetry/requests-3, I was not allowed to install pip! So I did not pursue this
|
# poetry/requests-3, I was not allowed to install pip! So I did not pursue this
|
||||||
# option further.
|
# option further.
|
||||||
#
|
#
|
||||||
# Instead, testing (on both Windows and Linux) shows that the last entry of
|
# Instead, testing `site.getsitepackages()` contains has the right path, whereas
|
||||||
# `site.getsitepackages()` has the right path (note: On linux there is only a single
|
# `site.getusersitepackages()` is about the system python (very confusing).
|
||||||
# entry), whereas `site.getusersitepackages()` is about the system python (very
|
|
||||||
# confusing).
|
|
||||||
#
|
#
|
||||||
# We can't use the environment variable POETRY_VIRTUALENVS_OPTIONS_NO_PIP because it
|
# We can't use the environment variable POETRY_VIRTUALENVS_OPTIONS_NO_PIP because it
|
||||||
# does not work, see https://github.com/python-poetry/poetry/issues/5906
|
# does not work, see https://github.com/python-poetry/poetry/issues/5906
|
||||||
import site
|
import site
|
||||||
|
|
||||||
|
if sys.platform.startswith("win32"):
|
||||||
|
# On windows, the last entry of `site.getsitepackages()` has the right path
|
||||||
print(site.getsitepackages()[-1])
|
print(site.getsitepackages()[-1])
|
||||||
|
else:
|
||||||
|
# on unix, the first entry of `site.getsitepackages()` has the right path
|
||||||
|
print(site.getsitepackages()[0])
|
||||||
|
|
Загрузка…
Ссылка в новой задаче