diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-04-25 13:28:37 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-04-25 13:28:37 +0000 |
commit | fef7f220e2385ccfb423201958021a33c26b69c9 (patch) | |
tree | b8ff5b6438252a5c08ae00c796625a00ae453643 /subplot | |
parent | 6ee2450e2c0478440c56f9a0f754edaaa901d957 (diff) | |
parent | 9c3893cf616279e4101b1ccf52d0a82b7a334b3b (diff) | |
download | obnam2-fef7f220e2385ccfb423201958021a33c26b69c9.tar.gz |
Merge branch 'feature/78-cachedir-tag' into 'main'
feat: add support for CACHEDIR.TAG
Closes #78
See merge request larswirzenius/obnam!138
Diffstat (limited to 'subplot')
-rw-r--r-- | subplot/data.py | 7 | ||||
-rw-r--r-- | subplot/data.yaml | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/subplot/data.py b/subplot/data.py index 3833f2e..d134e5f 100644 --- a/subplot/data.py +++ b/subplot/data.py @@ -29,6 +29,13 @@ def create_fifo(ctx, filename=None): os.mkfifo(filename) +def create_cachedir_tag_in(ctx, dirpath=None): + filepath = f"{dirpath}/CACHEDIR.TAG" + logging.debug(f"creating {filepath}") + os.makedirs(dirpath, exist_ok=True) + open(filepath, "w").write("Signature: 8a477f597d28d172789f06886806bc55") + + def create_nonutf8_filename(ctx, dirname=None): filename = "\x88" os.mkdir(dirname) diff --git a/subplot/data.yaml b/subplot/data.yaml index 699c5b1..dcc6807 100644 --- a/subplot/data.yaml +++ b/subplot/data.yaml @@ -10,6 +10,9 @@ - given: "a named pipe {filename}" function: create_fifo +- given: a cache directory tag in {dirpath} + function: create_cachedir_tag_in + - given: "a file in {dirname} with a non-UTF8 filename" function: create_nonutf8_filename |