"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "poetry/console/commands/env/info.py" between
poetry-1.1.15.tar.gz and poetry-1.2.0.tar.gz

About: Poetry is a tool for dependency management and packaging in Python.

info.py  (poetry-1.1.15):info.py  (poetry-1.2.0)
from cleo import option from __future__ import annotations
from ..command import Command from typing import TYPE_CHECKING
class EnvInfoCommand(Command): from cleo.helpers import option
from poetry.console.commands.command import Command
name = "info" if TYPE_CHECKING:
from poetry.utils.env import Env
class EnvInfoCommand(Command):
name = "env info"
description = "Displays information about the current environment." description = "Displays information about the current environment."
options = [option("path", "p", "Only display the environment's path.")] options = [option("path", "p", "Only display the environment's path.")]
def handle(self): def handle(self) -> int:
from poetry.utils.env import EnvManager from poetry.utils.env import EnvManager
env = EnvManager(self.poetry).get() env = EnvManager(self.poetry).get()
if self.option("path"): if self.option("path"):
if not env.is_venv(): if not env.is_venv():
return 1 return 1
self.line(str(env.path)) self.line(str(env.path))
return return 0
self._display_complete_info(env) self._display_complete_info(env)
return 0
def _display_complete_info(self, env): def _display_complete_info(self, env: Env) -> None:
env_python_version = ".".join(str(s) for s in env.version_info[:3]) env_python_version = ".".join(str(s) for s in env.version_info[:3])
self.line("") self.line("")
self.line("<b>Virtualenv</b>") self.line("<b>Virtualenv</b>")
listing = [ listing = [
"<info>Python</info>: <comment>{}</>".format(env_python_vers f"<info>Python</info>: <comment>{env_python_version}</>",
ion), f"<info>Implementation</info>: <comment>{env.python_implementation}<
"<info>Implementation</info>: <comment>{}</>".format( />",
env.python_implementation "<info>Path</info>: "
), f" <comment>{env.path if env.is_venv() else 'NA'}</>",
"<info>Path</info>: <comment>{}</>".format( "<info>Executable</info>: "
env.path if env.is_venv() else "NA" f" <comment>{env.python if env.is_venv() else 'NA'}</>",
] ]
if env.is_venv(): if env.is_venv():
listing.append( listing.append(
"<info>Valid</info>: <{tag}>{is_valid}</{tag}>".format( "<info>Valid</info>: "
tag="comment" if env.is_sane() else "error", is_valid=env.is f" <{'comment' if env.is_sane() else 'error'}>{env.is_sane()}</>
_sane() "
) )
self.line("\n".join(listing)) self.line("\n".join(listing))
self.line("") self.line("")
system_env = env.parent_env
python = ".".join(str(v) for v in system_env.version_info[:3])
self.line("<b>System</b>") self.line("<b>System</b>")
self.line( self.line(
"\n".join( "\n".join(
[ [
"<info>Platform</info>: <comment>{}</>".format(env.platform) f"<info>Platform</info>: <comment>{env.platform}</>",
, f"<info>OS</info>: <comment>{env.os}</>",
"<info>OS</info>: <comment>{}</>".format(env.os), f"<info>Python</info>: <comment>{python}</>",
"<info>Python</info>: <comment>{}</>".format(env.base), f"<info>Path</info>: <comment>{system_env.path}</>",
f"<info>Executable</info>: <comment>{system_env.python}</>",
] ]
) )
) )
 End of changes. 12 change blocks. 
23 lines changed or deleted 31 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)