|
1 | 1 |
|
2 | 2 | from setuptools import setup, find_packages |
| 3 | +from os import walk |
| 4 | +from os.path import join, dirname |
| 5 | +import os |
| 6 | +import glob |
| 7 | + |
| 8 | +# NOTE: All package data should also be set in MANIFEST.in |
| 9 | + |
| 10 | +packages = find_packages() |
| 11 | + |
| 12 | +package_data = {'': ['*.tmpl', |
| 13 | + '*.patch', ], } |
| 14 | + |
| 15 | + |
| 16 | +data_files = [] |
| 17 | + |
| 18 | +# Include any patches under recipes |
| 19 | +# recipes = {} |
| 20 | +# recipes_allowed_ext = ('patch', ) |
| 21 | +# for root, subfolders, files in walk('pythonforandroid/recipes'): |
| 22 | +# for fn in files: |
| 23 | +# ext = fn.split('.')[-1].lower() |
| 24 | +# if ext not in recipes_allowed_ext: |
| 25 | +# continue |
| 26 | +# filename = join(root, fn) |
| 27 | +# # directory = '%s%s' % (data_file_prefix, dirname(filename)) |
| 28 | +# directory = root |
| 29 | +# if not directory in recipes: |
| 30 | +# recipes[directory] = [] |
| 31 | +# recipes[directory].append(filename) |
| 32 | + |
| 33 | +# print('recipes is', recipes) |
| 34 | +# data_files = recipes.items() |
| 35 | + |
| 36 | +def recursively_include(results, directory, allowed_exts): |
| 37 | + for root, subfolders, files in walk(directory): |
| 38 | + for fn in files: |
| 39 | + if not any([glob.fnmatch.fnmatch(fn, pattern) for pattern in allowed_exts]): |
| 40 | + continue |
| 41 | + # ext = fn.split('.')[-1].lower() |
| 42 | + # if ext not in allowed_exts: |
| 43 | + # continue |
| 44 | + filename = join(root, fn) |
| 45 | + directory = root |
| 46 | + if directory not in results: |
| 47 | + results[directory] = [] |
| 48 | + results[directory].append(filename) |
| 49 | + |
| 50 | +data_files = {} |
| 51 | +recursively_include(data_files, 'pythonforandroid/recipes', ['*.patch', ]) |
| 52 | +recursively_include(data_files, 'pythonforandroid/bootstraps', |
| 53 | + ['*.properties', '*.xml', '*.java', '*.tmpl', '*.txt', '*.png']) |
3 | 54 |
|
4 | | -# NOTE: All package data is set in MANIFEST.in |
5 | 55 |
|
6 | 56 | setup(name='python-for-android', |
7 | 57 | version='0.2', |
|
34 | 84 | 'Topic :: Software Development', |
35 | 85 | 'Topic :: Utilities', |
36 | 86 | ], |
| 87 | + packages=packages, |
| 88 | + package_data=package_data, |
| 89 | + data_files=data_files.items(), |
37 | 90 | ) |
0 commit comments