Skip to content

Commit

Permalink
fix(file): File scan now yield directories so you can use permission …
Browse files Browse the repository at this point in the history
…on directories

Close #133
  • Loading branch information
Toilal committed Dec 21, 2020
1 parent c81fd76 commit eb232d8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ddb/utils/file.py
Expand Up @@ -200,9 +200,11 @@ def _walk(self, *args, recursive=True, **kwargs):
_walk_generator = os.walk(*args, **kwargs)
for root, dirs, files in os.walk(*args, **kwargs):
for dirs_item in list(dirs):
dirpath = os.path.join(root, dirs_item)
dirpath = os.path.relpath(os.path.join(root, dirs_item))
if self._is_excluded(dirpath, *self.excludes):
dirs.remove(dirs_item)
else:
yield dirpath

for files_item in list(files):
filepath = os.path.relpath(os.path.join(root, files_item))
Expand Down
@@ -1,4 +1,5 @@
permissions:
specs:
"*.sh": "+x"
"subdirectory/*.sh": "+x"
"subdirectory/*.sh": "+x"
"denied": "-w"
@@ -0,0 +1 @@
*
2 changes: 2 additions & 0 deletions tests/feature/permissions/test_permissions.py
Expand Up @@ -59,3 +59,5 @@ def test_project3(self, project_loader):

assert os.access("script.sh", os.X_OK)
assert os.access(os.path.join("subdirectory", "another-script.sh"), os.X_OK)
assert os.access(os.path.join("subdirectory"), os.W_OK)
assert not os.access(os.path.join("denied"), os.W_OK)

0 comments on commit eb232d8

Please sign in to comment.