diff options
author | Jürg Billeter <j@bitron.ch> | 2019-02-25 16:39:18 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2019-02-26 12:12:46 +0100 |
commit | 1bb0f8506da0055713caa373c45383c027756069 (patch) | |
tree | 7bb079185e436183a83b1411a8401fafa4388520 | |
parent | 7fed161b02f62e2f2b58cc0094ed7db1beb80f34 (diff) | |
download | buildstream-1bb0f8506da0055713caa373c45383c027756069.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 4b83b38e7..9022b8770 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 from ..utils import _magic_timestamp @@ -183,3 +185,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 |