1 # Copyright (c) Microsoft Corporation. All rights reserved. 2 # Licensed under the MIT License. See LICENSE in the project root 3 # for license information. 4 5 from . import VENDORED_ROOT 6 from ._util import cwd, iter_all_files 7 8 9 INCLUDES = [ 10 'setup_pydevd_cython.py', 11 ] 12 13 14 def iter_files(): 15 # From the root of pydevd repo, we want only scripts and 16 # subdirectories that constitute the package itself (not helper 17 # scripts, tests etc). But when walking down into those 18 # subdirectories, we want everything below. 19 20 with cwd(VENDORED_ROOT): 21 return iter_all_files('pydevd', prune_dir, exclude_file) 22 23 24 def prune_dir(dirname, basename): 25 if basename == '__pycache__': 26 return True 27 elif dirname != 'pydevd': 28 return False 29 elif basename.startswith('pydev'): 30 return False 31 elif basename.startswith('_pydev'): 32 return False 33 return True 34 35 36 def exclude_file(dirname, basename): 37 if dirname == 'pydevd': 38 if basename in INCLUDES: 39 return False 40 elif not basename.endswith('.py'): 41 return True 42 elif 'pydev' not in basename: 43 return True 44 return False 45 46 if basename.endswith('.pyc'): 47 return True 48 return False 49