diff options
author | Jürg Billeter <j@bitron.ch> | 2019-02-25 16:39:18 +0100 |
---|---|---|
committer | Abderrahim Kitouni <akitouni@gnome.org> | 2020-08-26 12:47:05 +0100 |
commit | 281f1d5bb3ae0089980462fa18fe509541f75bec (patch) | |
tree | 2e49eac62528b66914740df3e4b5a265b1513b81 | |
parent | 7d10de6152a8078a6018f2dc32537e8bbfc526da (diff) | |
download | buildstream-281f1d5bb3ae0089980462fa18fe509541f75bec.tar.gz |
storage/directory.py: Add _FileType enum
-rw-r--r-- | buildstream/storage/directory.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/buildstream/storage/directory.py b/buildstream/storage/directory.py index f44c648c1..1579e9ebf 100644 --- a/buildstream/storage/directory.py +++ b/buildstream/storage/directory.py @@ -31,6 +31,8 @@ See also: :ref:`sandboxing`. """ +from enum import Enum + from .._exceptions import BstError, ErrorDomain @@ -172,3 +174,26 @@ class Directory(): and all files and subdirectories in it. Storage space varies by implementation and effective space used may be lower than this number due to deduplication. """ raise NotImplementedError() + + +# FileType: +# +# Type of file or directory entry. +# +class _FileType(Enum): + + # Directory + DIRECTORY = 1 + + # Regular file + REGULAR_FILE = 2 + + # Symbolic link + SYMLINK = 3 + + # Special file (FIFO, character device, block device, or socket) + SPECIAL_FILE = 4 + + def __str__(self): + # https://github.com/PyCQA/pylint/issues/2062 + return self.name.lower().replace('_', ' ') # pylint: disable=no-member |