11 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6916d7edc8 | |||
| b3fd624a3f | |||
| 2d1beeebb0 | |||
| e104fa2e46 | |||
| 82c6a44ad6 | |||
| f8dc8ee6d1 | |||
| 75faf02232 | |||
| 7eb15f2477 | |||
| b1d4e20295 | |||
| 4274a71c62 | |||
| 2e69639362 |
Renamed from src/python/jw/pkg/build/lib/util.py (Browse further)
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
| 6916d7edc8 |
jw.pkg.lib.util.run_sudo(): Add parameter verbose
Add parameter verbose to run_sudo() and pass it on to run_cmd(). Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| b3fd624a3f |
jw.pkg.lib.util.get_profile_env(): add -> keep
Replace the boolean parameter "add" with the richer "keep": - False -> Don't keep anything - True -> Keep what's in the current environment - List of strings -> Keep those variables Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| 2d1beeebb0 |
jw.pkg.lib.util.get_profile_env(): Add function
Add a function get_profile_env(), a function returning environment variables from /etc/profile. Pass add=True to add its contents to the existing environment dictionary, overwriting old entries, or pass False to get the pristine content. Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| e104fa2e46 |
jw.pkg.lib.util.run_cmd(): Add output_encoding
Add a parameter "output_encoding" to run_cmd(). The parameter allows the caller to specify if the output encoding should be detected as is by passing None (the default), if the output should be returned as undecoded bytes by passing the special string "bytes", or if the output should be treated as the encoding with the specified name and decoded to strings. Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| 82c6a44ad6 |
jw.pkg.lib.util.run_cmd(): Fix mode:auto
In cmd_input == "mode:auto", the interactive variable is currently not set due to a typo. Fix that. Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| f8dc8ee6d1 |
jw.pkg.lib.util.run_cmd(): Honour env in PTY mode
The evironment passed to run_cmd() via env is currently not honoured with mode:interactive. Fix that. Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| 75faf02232 |
jw.pkg.lib.util.run_cmd(): Add title parameter
Allow the caller to choose which title should be used for the command's logging output box. Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| 7eb15f2477 |
jw.pkg.lib: Don't log {e}
Don't log an Exception as {e} but as str(e) producing nicer output. Or as repr(e) if a backtrace is requested, because to people who can read backtraces, type info might be of interest. Also, remove pointless time stamps, those belong into the logging framework. Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| b1d4e20295 |
jw.pkg.util: Add sudo()
Move the body of BackendCmd.sudo() into a function. The rationale behind that is that its functionality is independent of the calling object for the most part, so having it in a function instead of a method is the more modular pattern. Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| 4274a71c62 |
lib.util.run_cmd(): Rewrite it to be async
run_cmd() is synchronous. Now that all commands are asynchronous, we can await it, so rewrite it to be asynchronous, too. Other changes: - Make it return stderr as well in case its needed - Drop into a pseuto-tty if
- cmd_input == "mode:interactive" or
- cmd_input == "mode:auto" and stdin is a TTY - Add argument env, defaulting to None. If it's a dict, it will be
the environment the command is run in This entails making all functions using run_cmd() async, too, including run_curl(), get_username() and get_password(). Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| 2e69639362 |
jw.pkg.build.lib: Move to jw.pkg.lib
In preparation of reorganizing the tree below cmds, move the lib subdirectory a level up. Signed-off-by: Jan Lindemann <jan@janware.com> |