29 '\x1b[101mCRITICAL %s\x1b[0m'
31 'Cannot find package "%s".'
36 '\x1b[37mINFO %s\x1b[0m'
38 'Install it using "pip". Then try again.')
52def run(args: argparse.Namespace) -> int:
58 if args.__contains__(
'select_set'):
64 log.error(
'Cannot set project properties.')
65 elif args.__contains__(
'select_unset'):
69 log.verbose(
'Project properties successfully unset.')
71 log.error(
'Cannot unset project properties.')
72 elif args.__contains__(
'select_list'):
73 log.verbose(
'Showing list of project properties ...')
77 'Project properties list successfully shown.'
80 log.error(
'Cannot show project properties.')
110 parser = argparse.ArgumentParser(
112 prog=
'pyenv virtualenv-props',
113 description=
'Manage virtual environment-related project ' +
117 subparsers = parser.add_subparsers(help=
'subcommand help')
119 parser_set = subparsers.add_parser(
122 description=
'Set project properties inside CWD = project folder.'
125 parser_set.add_argument(
127 help=
'Number of Python version, already installed in "pyenv".'
130 parser_set.add_argument(
132 help=
'Short name of required Python virtual environment.'
135 parser_set.add_argument(
138 help=argparse.SUPPRESS
141 parser_unset = subparsers.add_parser(
143 aliases=[
'u',
'unset',
'unlink',
'd',
'del',
'delete',
'r',
'rm',
'remove'],
144 description=
'Unset project properties inside CWD = project folder.'
147 parser_unset.add_argument(
150 help=argparse.SUPPRESS
153 parser_list = subparsers.add_parser(
156 description=
'Read and list local project properties.',
157 help=
'Read and list local project properties.'
160 parser_list.add_argument(
163 help=argparse.SUPPRESS
166 parser_list.add_argument(
169 action=argparse.BooleanOptionalAction,
170 help=
'Display project properties in local folder tree view.'
173 return parser.parse_args(), rc
220 except Exception
as exc:
225 '\x1b[91mERROR: Unexpected error "%s".\x1b[0m'
233if __name__ ==
"__main__":
int listProjectProperties(bool show_tree=False)
Display the table, which shows a list about project properties.
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.
int unsetProjectProperties()
Set project property files.
int setProjectProperties(str ver, str env)
Set/override project property files.
debug((str, tuple) msg)
Log debug message colored to console only.
verbose((str, tuple) msg)
Log verbose message colored to console only.
initLogging()
Initialize the logging.
error((str, tuple) msg)
Log error message colored to console only.
tuple[(argparse.Namespace, None), int] parseCliArguments()
Parse CLI arguments for this application.
int run(argparse.Namespace args)
Sub routine to run the application.
int main()
Main routine of the application.