6 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3cf5b2264e | |||
| fe3508036e | |||
| 64e9fbff59 | |||
| 94eee5c4bb | |||
| 0d6eeeadcf | |||
| 4f98fd6c78 |
Renamed from src/python/jw/pkg/lib/FileTransfer.py (Browse further)
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
| 3cf5b2264e |
lib.FileContext: Add file methods
Add the following methods, meant to do the obvious: unlink(self, path: str) -> None erase(self, path: str) -> None rename(self, src: str, dst: str) -> None mktemp(self, tmpl: str, directory: bool=False) -> None chown(self, path: str, owner: str|None=None, group: str|None=None) -> None chmod(self, path: str, mode: int) -> None stat(self, path: str, follow_symlinks: bool=True) -> StatResult file_exists(self, path: str) -> bool is_dir(self, path: str) -> bool All methods are async and call their protected counterpart, which is designed to be overridden. If possible, default implementations do something meaningful, if not, they just raise plain NotImplementedError. Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| fe3508036e |
lib.FileContext.put(): Change param mode type str -> int
Don't pass mode as a string to put(). Given the multitunde of possible string representations for numbers, some understood by int(string, 0) and some not, there's too much room for passing strings which are unparseable, or worse, prone to be parsed wrongly. However, pass mode down to _put() as a string for convenience, because that's what most _put() implementations will need to use. If they don't, converting to int is easy from the one defined string format. Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| 64e9fbff59 |
lib.FileContext.put(): Swap params path and content
Swap the positions of the "path" and "content" parameters of put(). Path comes always first, in every path related function I know. Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| 94eee5c4bb |
lib.FileContext.put(): Add parameter "atomic"
Add the parameter "atomic" to put() / _put(). If instructs the implementation to take extra precautions to make sure the operation either succeeds or fails entirely, i.e. doesn't leave a broken target file behind. Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| 0d6eeeadcf |
lib.FileContext.log_name: Beautify
Prepend the class name to .log_name. Not sure if that makes logs more legible, but we'll try it out for a while. Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| 4f98fd6c78 |
lib.FileTransfer: Rename to FileContext
Rename class FileTransfer to FileContext because that's the better name. It's the base class of ExecContext and also a context. Signed-off-by: Jan Lindemann <jan@janware.com> |