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
e8f259a1
Commit
e8f259a1
authored
Jun 29, 2022
by
finswimmer
Committed by
Bjorn Neergaard
Jul 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: fix venv paths redirected by Python from MS Store
parent
03a64aa1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletions
+31
-1
src/poetry/utils/env.py
+14
-1
src/poetry/utils/helpers.py
+17
-0
No files found.
src/poetry/utils/env.py
View file @
e8f259a1
...
@@ -36,10 +36,12 @@ from poetry.core.toml.file import TOMLFile
...
@@ -36,10 +36,12 @@ from poetry.core.toml.file import TOMLFile
from
poetry.core.utils.helpers
import
temporary_directory
from
poetry.core.utils.helpers
import
temporary_directory
from
virtualenv.seed.wheels.embed
import
get_embed_wheel
from
virtualenv.seed.wheels.embed
import
get_embed_wheel
from
poetry.utils._compat
import
WINDOWS
from
poetry.utils._compat
import
decode
from
poetry.utils._compat
import
decode
from
poetry.utils._compat
import
encode
from
poetry.utils._compat
import
encode
from
poetry.utils._compat
import
list_to_shell_command
from
poetry.utils._compat
import
list_to_shell_command
from
poetry.utils._compat
import
metadata
from
poetry.utils._compat
import
metadata
from
poetry.utils.helpers
import
get_real_windows_path
from
poetry.utils.helpers
import
is_dir_writable
from
poetry.utils.helpers
import
is_dir_writable
from
poetry.utils.helpers
import
paths_csv
from
poetry.utils.helpers
import
paths_csv
from
poetry.utils.helpers
import
remove_directory
from
poetry.utils.helpers
import
remove_directory
...
@@ -960,7 +962,10 @@ class EnvManager:
...
@@ -960,7 +962,10 @@ class EnvManager:
return
self
.
get_system_env
()
return
self
.
get_system_env
()
io
.
write_line
(
f
"Creating virtualenv <c1>{name}</> in {venv_path!s}"
)
io
.
write_line
(
f
"Creating virtualenv <c1>{name}</> in"
f
" {venv_path if not WINDOWS else get_real_windows_path(venv_path)!s}"
)
else
:
else
:
create_venv
=
False
create_venv
=
False
if
force
:
if
force
:
...
@@ -1012,6 +1017,10 @@ class EnvManager:
...
@@ -1012,6 +1017,10 @@ class EnvManager:
with_setuptools
:
bool
|
None
=
None
,
with_setuptools
:
bool
|
None
=
None
,
prompt
:
str
|
None
=
None
,
prompt
:
str
|
None
=
None
,
)
->
virtualenv
.
run
.
session
.
Session
:
)
->
virtualenv
.
run
.
session
.
Session
:
if
WINDOWS
:
path
=
get_real_windows_path
(
path
)
executable
=
get_real_windows_path
(
executable
)
if
executable
else
None
flags
=
flags
or
{}
flags
=
flags
or
{}
flags
[
"no-pip"
]
=
(
flags
[
"no-pip"
]
=
(
...
@@ -1153,6 +1162,10 @@ class Env:
...
@@ -1153,6 +1162,10 @@ class Env:
self
.
_is_mingw
=
sysconfig
.
get_platform
()
.
startswith
(
"mingw"
)
self
.
_is_mingw
=
sysconfig
.
get_platform
()
.
startswith
(
"mingw"
)
self
.
_is_conda
=
bool
(
os
.
environ
.
get
(
"CONDA_DEFAULT_ENV"
))
self
.
_is_conda
=
bool
(
os
.
environ
.
get
(
"CONDA_DEFAULT_ENV"
))
if
self
.
_is_windows
:
path
=
get_real_windows_path
(
path
)
base
=
get_real_windows_path
(
base
)
if
base
else
None
if
not
self
.
_is_windows
or
self
.
_is_mingw
:
if
not
self
.
_is_windows
or
self
.
_is_mingw
:
bin_dir
=
"bin"
bin_dir
=
"bin"
else
:
else
:
...
...
src/poetry/utils/helpers.py
View file @
e8f259a1
...
@@ -240,3 +240,20 @@ def get_win_folder(csidl_name: str) -> Path:
...
@@ -240,3 +240,20 @@ def get_win_folder(csidl_name: str) -> Path:
return
Path
(
_get_win_folder
(
csidl_name
))
return
Path
(
_get_win_folder
(
csidl_name
))
raise
RuntimeError
(
"Method can only be called on Windows."
)
raise
RuntimeError
(
"Method can only be called on Windows."
)
def
get_real_windows_path
(
path
:
str
|
Path
)
->
Path
:
program_files
=
get_win_folder
(
"CSIDL_PROGRAM_FILES"
)
local_appdata
=
get_win_folder
(
"CSIDL_LOCAL_APPDATA"
)
path
=
Path
(
str
(
path
)
.
replace
(
str
(
program_files
/
"WindowsApps"
),
str
(
local_appdata
/
"Microsoft/WindowsApps"
),
)
)
if
path
.
as_posix
()
.
startswith
(
local_appdata
.
as_posix
()):
path
=
path
.
resolve
()
return
path
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