Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
497cacdf
Unverified
Commit
497cacdf
authored
Dec 06, 2019
by
Sébastien Eustace
Committed by
GitHub
Dec 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the site-packages directory detection (#1683)
parent
c349357b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
poetry/utils/env.py
+5
-0
tests/utils/test_env.py
+27
-0
No files found.
poetry/utils/env.py
View file @
497cacdf
...
@@ -757,6 +757,11 @@ class Env(object):
...
@@ -757,6 +757,11 @@ class Env(object):
@property
@property
def
site_packages
(
self
):
# type: () -> Path
def
site_packages
(
self
):
# type: () -> Path
# It seems that PyPy3 virtual environments
# have their site-packages directory at the root
if
self
.
_path
.
joinpath
(
"site-packages"
)
.
exists
():
return
self
.
_path
.
joinpath
(
"site-packages"
)
if
self
.
_is_windows
:
if
self
.
_is_windows
:
return
self
.
_path
/
"Lib"
/
"site-packages"
return
self
.
_path
/
"Lib"
/
"site-packages"
...
...
tests/utils/test_env.py
View file @
497cacdf
...
@@ -9,6 +9,7 @@ from clikit.io import NullIO
...
@@ -9,6 +9,7 @@ from clikit.io import NullIO
from
poetry.factory
import
Factory
from
poetry.factory
import
Factory
from
poetry.semver
import
Version
from
poetry.semver
import
Version
from
poetry.utils._compat
import
WINDOWS
from
poetry.utils._compat
import
Path
from
poetry.utils._compat
import
Path
from
poetry.utils.env
import
EnvCommandError
from
poetry.utils.env
import
EnvCommandError
from
poetry.utils.env
import
EnvManager
from
poetry.utils.env
import
EnvManager
...
@@ -696,3 +697,29 @@ def test_activate_with_in_project_setting_does_not_fail_if_no_venvs_dir(
...
@@ -696,3 +697,29 @@ def test_activate_with_in_project_setting_does_not_fail_if_no_venvs_dir(
envs_file
=
TomlFile
(
Path
(
tmp_dir
)
/
"virtualenvs"
/
"envs.toml"
)
envs_file
=
TomlFile
(
Path
(
tmp_dir
)
/
"virtualenvs"
/
"envs.toml"
)
assert
not
envs_file
.
exists
()
assert
not
envs_file
.
exists
()
def
test_env_site_packages_should_find_the_site_packages_directory_if_standard
(
tmp_dir
):
if
WINDOWS
:
site_packages
=
Path
(
tmp_dir
)
.
joinpath
(
"Lib/site-packages"
)
else
:
site_packages
=
Path
(
tmp_dir
)
.
joinpath
(
"lib/python{}/site-packages"
.
format
(
"."
.
join
(
str
(
v
)
for
v
in
sys
.
version_info
[:
2
])
)
)
site_packages
.
mkdir
(
parents
=
True
)
env
=
VirtualEnv
(
Path
(
tmp_dir
),
Path
(
tmp_dir
))
assert
site_packages
==
env
.
site_packages
def
test_env_site_packages_should_find_the_site_packages_directory_if_root
(
tmp_dir
):
site_packages
=
Path
(
tmp_dir
)
.
joinpath
(
"site-packages"
)
site_packages
.
mkdir
(
parents
=
True
)
env
=
VirtualEnv
(
Path
(
tmp_dir
),
Path
(
tmp_dir
))
assert
site_packages
==
env
.
site_packages
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment