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
fa4c1162
Unverified
Commit
fa4c1162
authored
Oct 18, 2018
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix debug:info not showing the current project’s virtualenv
parent
817276f6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
3 deletions
+41
-3
CHANGELOG.md
+1
-0
poetry/console/commands/debug/info.py
+0
-1
poetry/utils/env.py
+40
-2
No files found.
CHANGELOG.md
View file @
fa4c1162
...
...
@@ -9,6 +9,7 @@
-
Fixed an error when installing current package in development mode if the generated
`setup.py`
had special characters.
-
Fixed an error in
`install`
for applications not following a known structure.
-
Fixed an error when trying to retrieve the current environment.
-
Fixed
`debug:info`
not showing the current project's virtualenv.
## [0.12.2] - 2018-10-17
...
...
poetry/console/commands/debug/info.py
View file @
fa4c1162
...
...
@@ -15,7 +15,6 @@ class DebugInfoCommand(Command):
from
....utils.env
import
Env
poetry
=
self
.
poetry
package
=
poetry
.
package
env
=
Env
.
get
(
cwd
=
poetry
.
file
.
parent
)
poetry_python_version
=
"."
.
join
(
str
(
s
)
for
s
in
sys
.
version_info
[:
3
])
...
...
poetry/utils/env.py
View file @
fa4c1162
...
...
@@ -108,7 +108,32 @@ class Env(object):
return
VirtualEnv
(
Path
(
venv
))
return
SystemEnv
(
Path
(
sys
.
prefix
))
config
=
Config
.
create
(
"config.toml"
)
create_venv
=
config
.
setting
(
"settings.virtualenvs.create"
,
True
)
if
not
create_venv
:
return
SystemEnv
(
Path
(
sys
.
prefix
))
venv_path
=
config
.
setting
(
"settings.virtualenvs.path"
)
if
venv_path
is
None
:
venv_path
=
Path
(
CACHE_DIR
)
/
"virtualenvs"
else
:
venv_path
=
Path
(
venv_path
)
if
cwd
is
None
:
cwd
=
Path
.
cwd
()
name
=
cwd
.
name
name
=
"{}-py{}"
.
format
(
name
,
"."
.
join
([
str
(
v
)
for
v
in
sys
.
version_info
[:
2
]])
)
venv
=
venv_path
/
name
if
not
venv
.
exists
():
return
SystemEnv
(
Path
(
sys
.
prefix
))
return
VirtualEnv
(
venv
)
if
os
.
environ
.
get
(
"VIRTUAL_ENV"
)
is
not
None
:
prefix
=
Path
(
os
.
environ
[
"VIRTUAL_ENV"
])
...
...
@@ -146,7 +171,10 @@ class Env(object):
venv_path
=
Path
(
venv_path
)
if
not
name
:
name
=
Path
.
cwd
()
.
name
if
not
cwd
:
cwd
=
Path
.
cwd
()
name
=
cwd
.
name
name
=
"{}-py{}"
.
format
(
name
,
"."
.
join
([
str
(
v
)
for
v
in
sys
.
version_info
[:
2
]]))
...
...
@@ -233,6 +261,12 @@ class Env(object):
def
is_valid_for_marker
(
self
,
marker
):
# type: (BaseMarker) -> bool
return
marker
.
validate
(
self
.
marker_env
)
def
is_sane
(
self
):
# type: () -> bool
"""
Checks whether the current environment is sane or not.
"""
return
True
def
run
(
self
,
bin
,
*
args
,
**
kwargs
):
"""
Run a command inside the Python environment.
...
...
@@ -427,6 +461,10 @@ class VirtualEnv(Env):
def
is_venv
(
self
):
# type: () -> bool
return
True
def
is_sane
(
self
):
# A virtualenv is considered sane if both "python" and "pip" exist.
return
os
.
path
.
exists
(
self
.
_bin
(
"python"
))
and
os
.
path
.
exists
(
self
.
_bin
(
"pip"
))
def
run
(
self
,
bin
,
*
args
,
**
kwargs
):
with
self
.
temp_environ
():
os
.
environ
[
"PATH"
]
=
self
.
_updated_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