(ignore_file)
| 43 | |
| 44 | |
| 45 | def excludes_from_file(ignore_file): |
| 46 | excludes = [] |
| 47 | try: |
| 48 | with io.open(ignore_file, "r", encoding="utf-8") as f: |
| 49 | for line in f: |
| 50 | if line.startswith("#"): |
| 51 | # ignore comments |
| 52 | continue |
| 53 | pattern = line.rstrip() |
| 54 | if not pattern: |
| 55 | # allow empty lines |
| 56 | continue |
| 57 | excludes.append(pattern) |
| 58 | except EnvironmentError as e: |
| 59 | if e.errno != errno.ENOENT: |
| 60 | raise |
| 61 | return excludes |
| 62 | |
| 63 | |
| 64 | def list_files(files, recursive=False, extensions=None, exclude=None): |