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
45b20eee
Commit
45b20eee
authored
Nov 30, 2021
by
finswimmer
Committed by
Bjorn Neergaard
Jan 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
alternative generic solution by returning sys.executable
parent
5b17d708
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
src/poetry/console/application.py
+14
-2
src/poetry/utils/env.py
+2
-1
No files found.
src/poetry/console/application.py
View file @
45b20eee
...
@@ -286,18 +286,30 @@ class Application(BaseApplication):
...
@@ -286,18 +286,30 @@ class Application(BaseApplication):
io
=
event
.
io
io
=
event
.
io
poetry
=
command
.
poetry
poetry
=
command
.
poetry
executable
=
None
executable
=
None
find_compatible
=
None
# add on option to trigger this
with
contextlib
.
suppress
(
CalledProcessError
):
with
contextlib
.
suppress
(
CalledProcessError
):
executable
=
decode
(
executable
=
decode
(
subprocess
.
check_output
(
subprocess
.
check_output
(
list_to_shell_command
([
"pyenv"
,
"which"
,
"python"
]),
list_to_shell_command
(
[
"python"
,
"-c"
,
'"import sys; print(sys.executable)"'
,
]
),
shell
=
True
,
shell
=
True
,
)
.
strip
()
)
.
strip
()
)
)
find_compatible
=
True
env_manager
=
EnvManager
(
poetry
)
env_manager
=
EnvManager
(
poetry
)
env
=
env_manager
.
create_venv
(
io
,
executable
=
executable
)
env
=
env_manager
.
create_venv
(
io
,
executable
=
executable
,
find_compatible
=
find_compatible
)
if
env
.
is_venv
()
and
io
.
is_verbose
():
if
env
.
is_venv
()
and
io
.
is_verbose
():
io
.
write_line
(
f
"Using virtualenv: <comment>{env.path}</>"
)
io
.
write_line
(
f
"Using virtualenv: <comment>{env.path}</>"
)
...
...
src/poetry/utils/env.py
View file @
45b20eee
...
@@ -763,6 +763,7 @@ class EnvManager:
...
@@ -763,6 +763,7 @@ class EnvManager:
name
:
Optional
[
str
]
=
None
,
name
:
Optional
[
str
]
=
None
,
executable
:
Optional
[
str
]
=
None
,
executable
:
Optional
[
str
]
=
None
,
force
:
bool
=
False
,
force
:
bool
=
False
,
find_compatible
:
Optional
[
bool
]
=
None
,
)
->
Union
[
"SystemEnv"
,
"VirtualEnv"
]:
)
->
Union
[
"SystemEnv"
,
"VirtualEnv"
]:
if
self
.
_env
is
not
None
and
not
force
:
if
self
.
_env
is
not
None
and
not
force
:
return
self
.
_env
return
self
.
_env
...
@@ -812,7 +813,7 @@ class EnvManager:
...
@@ -812,7 +813,7 @@ class EnvManager:
# If an executable has been specified, we stop there
# If an executable has been specified, we stop there
# and notify the user of the incompatibility.
# and notify the user of the incompatibility.
# Otherwise, we try to find a compatible Python version.
# Otherwise, we try to find a compatible Python version.
if
executable
:
if
executable
and
not
find_compatible
:
raise
NoCompatiblePythonVersionFound
(
raise
NoCompatiblePythonVersionFound
(
self
.
_poetry
.
package
.
python_versions
,
python_patch
self
.
_poetry
.
package
.
python_versions
,
python_patch
)
)
...
...
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