30 '\x1b[101mCRITICAL %s\x1b[0m'
32 'Cannot find package "%s".'
37 '\x1b[37mINFO %s\x1b[0m'
39 'Install it using "pip". Then try again.')
60 'Listing Python virtual environments in "pyenv".'
65 versions_dir = os.path.join(
66 os.environ[
'PYENV_ROOT'],
69 if not os.path.isdir(versions_dir):
70 log.error(
'Cannot find any Python version in "pyenv".')
71 log.info(
'Install a Python version 3.3+ into "pyenv".')
80 log.error(
'Cannot find a Python version in "pyenv".')
81 log.info(
'Install a Python version 3.3+ into "pyenv".')
84 per = os.environ[
'PYENV_ROOT']
87 [tbl.HEADER,
'G',
'Venv-Capable',
'Version',
'"pyenv" Location'],
95 os.path.basename(ver),
96 '%PYENV_ROOT%' + os.sep + ver[len(per):]
98 pyts.append(pyts_item)
100 pyts.append([tbl.SEPARATOR])
103 [tbl.HEADER,
'A',
'Version',
'Name',
'"pyenv" Location'],
111 (
'PROMPT' in os.environ)
113 (f
'({os.path.basename(venv)})' in os.environ[
'PROMPT'])
119 os.path.basename(ver),
120 os.path.basename(venv),
121 '%PYENV_ROOT%' + os.sep + venv[len(per):]
124 pves.append([tbl.SEPARATOR])
128 headline=
'INSTALLED PYTHON VERSIONS (G = global):'
134 headline=
'AVAILABLE PYTHON VIRTUAL ENVIRONMENTS (A = active):'
166 parser = argparse.ArgumentParser(
168 prog=
'pyenv virtualenvs',
169 description=
'Output lists of Python versions, virtual environments and related project properties.'
172 return parser.parse_args(), rc
218 except Exception
as exc:
223 '\x1b[91mERROR: Unexpected error "%s".\x1b[0m'
231if __name__ ==
"__main__":
int auditPyEnv(str min_ver)
Check if "pyenv" version is greater or equal the given minimal version.
int auditGlobalPythonVersion(str min_ver)
Check if Python version is greater or equal the given minimal version.
int auditPlatform(str name)
Check if the program in running on the required platform.
str getGlobalStar(str ver)
Get the "*" marker for this version, if it is the globally selected version in "pyenv".
list[str] getEnvs(str ver, str name=' *', bool as_paths=False)
Get list of installed virtual environments for a specific Python version in "pyenv".
int listProjectProperties()
Display the table, which shows a list about project properties.
list[str] getPythonVersions(str version=' *', bool venv_capable=False, bool as_paths=False)
Get list of installed Python version directories in "pyenv".
str getColoredVenvCapability(str ver)
Get the colored virtual environment capability str for the specific version number or path.
verbose((str, tuple) msg)
Log verbose message colored to console only.
initLogging()
Initialize the logging.
info((str, tuple) msg)
Log info message colored to console only.
error((str, tuple) msg)
Log error message colored to console only.
int run()
Sub routine to run the application.
int main()
Main routine of the application.
tuple[(argparse.Namespace, None), int] parseCliArguments()
Parse CLI arguments for this application.