| 17 | |
| 18 | |
| 19 | class BuildInfo: |
| 20 | def __init__(self): |
| 21 | self.files = set() |
| 22 | |
| 23 | def include(self, path): |
| 24 | matching_files = file_utils.search_glob(path, recursive=True) |
| 25 | |
| 26 | for file in matching_files: |
| 27 | self.files.add(file) |
| 28 | |
| 29 | def exclude(self, path): |
| 30 | matching_files = file_utils.search_glob(path, recursive=True) |
| 31 | |
| 32 | for excluded in matching_files: |
| 33 | if excluded in self.files: |
| 34 | self.files.remove(excluded) |
| 35 | |
| 36 | if os.path.isdir(excluded): |
| 37 | files_to_remove = [] |
| 38 | |
| 39 | for file in self.files: |
| 40 | common_path = os.path.commonprefix([excluded, file]) |
| 41 | |
| 42 | if common_path == excluded: |
| 43 | files_to_remove.append(file) |
| 44 | |
| 45 | for file_to_remove in files_to_remove: |
| 46 | self.files.remove(file_to_remove) |
| 47 | |
| 48 | def get_files(self): |
| 49 | return self.files |
| 50 | |
| 51 | |
| 52 | def get_npm_version(): |