diff options
author | Jürg Billeter <j@bitron.ch> | 2020-04-22 17:25:04 +0200 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2020-04-27 08:32:32 +0000 |
commit | ac7e20f1fb084ebe3c91cc85e0f865662115e372 (patch) | |
tree | 5b4394bc1affdab0c82e861a60d0eaa239ac9a23 | |
parent | 5e6dc5f1bbe43907804377f1c4598b9273afd3ab (diff) | |
download | buildstream-ac7e20f1fb084ebe3c91cc85e0f865662115e372.tar.gz |
storage: Directory.open_file(): Allow w+ and x+ modes
-rw-r--r-- | src/buildstream/storage/_casbaseddirectory.py | 2 | ||||
-rw-r--r-- | src/buildstream/storage/_filebaseddirectory.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/buildstream/storage/_casbaseddirectory.py b/src/buildstream/storage/_casbaseddirectory.py index 484dc0789..6fe200de1 100644 --- a/src/buildstream/storage/_casbaseddirectory.py +++ b/src/buildstream/storage/_casbaseddirectory.py @@ -734,7 +734,7 @@ class CasBasedDirectory(Directory): if entry and entry.type != _FileType.REGULAR_FILE: raise VirtualDirectoryError("{} in {} is not a file".format(path[-1], str(subdir))) - if mode not in ["r", "rb", "w", "wb", "x", "xb"]: + if mode not in ["r", "rb", "w", "wb", "w+", "w+b", "x", "xb", "x+", "x+b"]: raise ValueError("Unsupported mode: `{}`".format(mode)) if "b" in mode: diff --git a/src/buildstream/storage/_filebaseddirectory.py b/src/buildstream/storage/_filebaseddirectory.py index a2708c4eb..f9a830590 100644 --- a/src/buildstream/storage/_filebaseddirectory.py +++ b/src/buildstream/storage/_filebaseddirectory.py @@ -257,7 +257,7 @@ class FileBasedDirectory(Directory): subdir = self.descend(*path[:-1]) newpath = os.path.join(subdir.external_directory, path[-1]) - if mode not in ["r", "rb", "w", "wb", "x", "xb"]: + if mode not in ["r", "rb", "w", "wb", "w+", "w+b", "x", "xb", "x+", "x+b"]: raise ValueError("Unsupported mode: `{}`".format(mode)) if "b" in mode: |