idiap_devtools.utils¶
Functions
|
Return a human readable time string like "1 day, 2 hours". |
|
Run a command on a environment, logs output and reports status. |
|
Set up the environment variable and print debug message. |
|
Very fast, order preserving uniq function. |
- idiap_devtools.utils.set_environment(name, value, env=environ({'READTHEDOCS_VIRTUALENV_PATH': '/home/docs/checkouts/readthedocs.org/user_builds/idiap-devtools/envs/latest', 'READTHEDOCS_CANONICAL_URL': 'https://idiap-devtools.readthedocs.io/en/latest/', 'HOSTNAME': 'build-24377909-project-1009748-idiap-devtools', 'READTHEDOCS_GIT_CLONE_URL': 'https://gitlab.idiap.ch/software/idiap-devtools.git', 'HOME': '/home/docs', 'NO_COLOR': '1', 'READTHEDOCS': 'True', 'READTHEDOCS_PROJECT': 'idiap-devtools', 'READTHEDOCS_OUTPUT': '/home/docs/checkouts/readthedocs.org/user_builds/idiap-devtools/checkouts/latest/_readthedocs/', 'PATH': '/home/docs/checkouts/readthedocs.org/user_builds/idiap-devtools/envs/latest/bin:/home/docs/.asdf/shims:/home/docs/.asdf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'READTHEDOCS_VERSION_TYPE': 'branch', 'LANG': 'C.UTF-8', 'READTHEDOCS_LANGUAGE': 'en', 'DEBIAN_FRONTEND': 'noninteractive', 'READTHEDOCS_GIT_COMMIT_HASH': '7ee23f7e887685bfdb6c33b3edc081889f8b5b71', 'READTHEDOCS_VERSION_NAME': 'latest', 'READTHEDOCS_VERSION': 'latest', 'PWD': '/home/docs/checkouts/readthedocs.org/user_builds/idiap-devtools/checkouts/latest/doc', 'READTHEDOCS_GIT_IDENTIFIER': 'main', 'DOCUTILSCONFIG': '/home/docs/checkouts/readthedocs.org/user_builds/idiap-devtools/checkouts/latest/doc/docutils.conf'}))[source]¶
Set up the environment variable and print debug message.
- idiap_devtools.utils.human_time(seconds, granularity=2)[source]¶
Return a human readable time string like “1 day, 2 hours”.
This function will convert the provided time in seconds into weeks, days, hours, minutes and seconds.
- idiap_devtools.utils.run_cmdline(cmd, logger, **kwargs)[source]¶
Run a command on a environment, logs output and reports status.
- Parameters:
cmd (
list
[str
]) – The command to run, with parameters separated on a list of stringslogger (
Logger
) – A logger to log messages to consolekwargs – Further kwargs to be set on the call to
subprocess.Popen
.
- Return type:
- Returns:
The exit status of the command.