| Index: packager.py |
| diff --git a/packager.py b/packager.py |
| index 8e2c4eceb65636457e8e4cea244c7d85881c7c80..f85fccb6d8cbfd6819fb51b26a59c50c69d47c44 100644 |
| --- a/packager.py |
| +++ b/packager.py |
| @@ -94,19 +94,21 @@ class Files(dict): |
| dict.__setitem__(self, key, value) |
| def isIncluded(self, relpath): |
| + return relpath.split('/')[0] in self.includedFiles |
| + |
| + def isIgnored(self, relpath): |
|
Sebastian Noack
2016/05/12 12:00:24
Nit: New names should be lowercase.
|
| parts = relpath.split('/') |
| - if not parts[0] in self.includedFiles: |
| - return False |
| for part in parts: |
| if part in self.ignoredFiles: |
| - return False |
| - return True |
| + return True |
| + return False |
| def read(self, path, relpath='', skip=()): |
| if os.path.isdir(path): |
| for file in os.listdir(path): |
| name = relpath + ('/' if relpath != '' else '') + file |
| - if name not in skip and self.isIncluded(name): |
| + if (name not in skip and |
| + self.isIncluded(name) and not self.isIgnored(name)): |
|
Sebastian Noack
2016/05/12 12:00:24
Nit: The indentation here isn't compliant with PEP
|
| self.read(os.path.join(path, file), name, skip) |
| else: |
| with open(path, 'rb') as file: |
| @@ -118,9 +120,14 @@ class Files(dict): |
| for item in mappings: |
| target, source = item |
| - # Make sure the file is inside an included directory |
| - if '/' in target and not self.isIncluded(target): |
| - continue |
| + if '/' in target: |
| + # Make sure the file isn't ignored |
| + if self.isIgnored(target): |
| + continue |
| + # Make sure the directory is included |
| + if not self.isIncluded(target): |
| + self.includedFiles.add(target.split('/')[0]) |
|
Sebastian Noack
2016/05/12 12:00:24
Why is it necessary to add it add the directory to
|
| + |
| parts = source.split('/') |
| path = os.path.join(os.path.dirname(item.source), *parts) |
| if os.path.exists(path): |