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
ce3e1cdf
Unverified
Commit
ce3e1cdf
authored
Aug 19, 2021
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix system environment detection
parent
cd511298
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
poetry/utils/env.py
+10
-7
No files found.
poetry/utils/env.py
View file @
ce3e1cdf
...
@@ -996,7 +996,7 @@ class EnvManager:
...
@@ -996,7 +996,7 @@ class EnvManager:
shutil
.
rmtree
(
str
(
file_path
))
shutil
.
rmtree
(
str
(
file_path
))
@classmethod
@classmethod
def
get_system_env
(
cls
,
naive
:
bool
=
False
)
->
"SystemEnv"
:
def
get_system_env
(
cls
,
naive
:
bool
=
False
)
->
Union
[
"SystemEnv"
,
"GenericEnv"
]
:
"""
"""
Retrieve the current Python environment.
Retrieve the current Python environment.
...
@@ -1009,16 +1009,14 @@ class EnvManager:
...
@@ -1009,16 +1009,14 @@ class EnvManager:
want to retrieve Poetry's custom virtual environment
want to retrieve Poetry's custom virtual environment
(e.g. plugin installation or self update).
(e.g. plugin installation or self update).
"""
"""
prefix
,
base_prefix
=
Path
(
sys
.
prefix
),
cls
.
get_base_prefix
()
prefix
,
base_prefix
=
Path
(
sys
.
prefix
),
Path
(
cls
.
get_base_prefix
())
if
naive
is
False
:
if
not
naive
:
from
poetry.locations
import
data_dir
try
:
try
:
prefix
.
relative_to
(
data_dir
()
)
Path
(
__file__
)
.
relative_to
(
prefix
)
except
ValueError
:
except
ValueError
:
pass
pass
else
:
else
:
prefix
=
base_prefix
return
GenericEnv
(
base_prefix
)
return
SystemEnv
(
prefix
)
return
SystemEnv
(
prefix
)
...
@@ -1586,6 +1584,11 @@ class VirtualEnv(Env):
...
@@ -1586,6 +1584,11 @@ class VirtualEnv(Env):
return
os
.
pathsep
.
join
([
str
(
self
.
_bin_dir
),
os
.
environ
.
get
(
"PATH"
,
""
)])
return
os
.
pathsep
.
join
([
str
(
self
.
_bin_dir
),
os
.
environ
.
get
(
"PATH"
,
""
)])
class
GenericEnv
(
VirtualEnv
):
def
is_venv
(
self
)
->
bool
:
return
self
.
_path
!=
self
.
_base
class
NullEnv
(
SystemEnv
):
class
NullEnv
(
SystemEnv
):
def
__init__
(
def
__init__
(
self
,
path
:
Path
=
None
,
base
:
Optional
[
Path
]
=
None
,
execute
:
bool
=
False
self
,
path
:
Path
=
None
,
base
:
Optional
[
Path
]
=
None
,
execute
:
bool
=
False
...
...
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