From a750b53a10306be668ed5b0aedc6b0c3dbed30c9 Mon Sep 17 00:00:00 2001 From: Jacob Hinkle Date: Fri, 23 Sep 2022 20:15:41 -0400 Subject: [PATCH] Exclude ./nancy.db from FSEntry.from_path() scanning by default --- src/nancy/fs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/nancy/fs.py b/src/nancy/fs.py index c6a681d..7801f36 100644 --- a/src/nancy/fs.py +++ b/src/nancy/fs.py @@ -100,7 +100,7 @@ class FSEntry: self.sha256 = self.latest_version.sha256 @classmethod - def from_path(cls, root, relpath='.', filestat=None): + def from_path(cls, root, relpath='.', filestat=None, exclude=['./nancy.db']): """ Scan a path to instantiate (recursive). """ @@ -137,7 +137,8 @@ class FSEntry: relpath=os.path.join(relpath, e.name), filestat=e.stat(), ) - for e in direntries + for e in direntries \ + if os.path.join(relpath, e.name) not in exclude ] for c in children: # now hash concatenated sorted hashes # hash on perms+sha256 to enable recursively detecting perm