|
11 | 11 | import os |
12 | 12 | import hybkit |
13 | 13 | import glob |
| 14 | +import fnmatch |
14 | 15 |
|
15 | 16 | # Set project directory |
16 | 17 | proj_dir = os.path.abspath(os.path.dirname(__file__)) |
|
26 | 27 |
|
27 | 28 | # Dynamically generate reference data file tuples: |
28 | 29 | data_files = [] |
29 | | -data_file_dirs = ['scripts', 'scripts_extra', 'databases', 'reference_data', 'hybkit'] |
| 30 | +data_file_dirs = ['', 'scripts', 'scripts_extra', 'databases', 'reference_data', 'hybkit'] |
30 | 31 | sample_directory_dirs = glob.glob('sample_0*') |
31 | 32 | data_file_dirs += sample_directory_dirs |
32 | 33 | for item in glob.glob('docs/**', recursive=True): |
33 | 34 | if os.path.isdir(item) and not item.startswith(os.path.join('docs','_')): |
34 | 35 | data_file_dirs.append(item) |
35 | 36 |
|
| 37 | +ignore_file_patterns = [] |
| 38 | +with open('.gitignore', 'r') as git_ignore: |
| 39 | + for line in git_ignore: |
| 40 | + line = line.strip() |
| 41 | + if line.startswith('#') or not line: |
| 42 | + continue |
| 43 | + ignore_file_patterns.append(line) |
| 44 | + |
36 | 45 | for dir_name in data_file_dirs: |
37 | 46 | file_list = [f for f in glob.glob(os.path.join(dir_name, '*')) |
38 | 47 | if not ( |
39 | | - (os.path.isdir(f)) |
40 | | - or ('/output' in f) |
41 | | - or (f.endswith('.hyb')) |
42 | | - or (f.endswith('.viennad')) |
43 | | - or (f.endswith('.vienna')) |
44 | | - or (f.endswith('.ct')) |
45 | | - or (f.endswith('__')) |
46 | | - or (f.endswith('.pyc')) |
47 | | - |
| 48 | + os.path.isdir(f) |
| 49 | + or any(fnmatch.fnmatch(f, ignore) for ignore in ignore_file_patterns) |
48 | 50 | )] |
49 | 51 | target_dir_name = os.path.join(about_vars['name_and_version'], dir_name) |
50 | 52 | data_files.append((target_dir_name, file_list)) |
|
56 | 58 | long_description=long_description, |
57 | 59 | long_description_content_type='text/x-rst', |
58 | 60 | url=about_vars['project_url'], |
59 | | - download_url=about_vars['project_download_url'], |
60 | 61 | author=about_vars['__author__'], |
61 | 62 | author_email=about_vars['__contact__'], |
62 | 63 | classifiers=about_vars['classifiers'], |
|
0 commit comments