(self)
| 82 | main() |
| 83 | |
| 84 | def prepare_build_dir(self): |
| 85 | |
| 86 | if argv_contains('--private') and not argv_contains('--launcher'): |
| 87 | print('WARNING: Received --private argument when this would ' |
| 88 | 'normally be generated automatically.') |
| 89 | print(' This is probably bad unless you meant to do ' |
| 90 | 'that.') |
| 91 | |
| 92 | bdist_dir = 'build/bdist.android-{}'.format(self.arch) |
| 93 | rmdir(bdist_dir) |
| 94 | ensure_dir(bdist_dir) |
| 95 | |
| 96 | globs = [] |
| 97 | for directory, patterns in self.distribution.package_data.items(): |
| 98 | for pattern in patterns: |
| 99 | globs.append(join(directory, pattern)) |
| 100 | |
| 101 | filens = [] |
| 102 | for pattern in globs: |
| 103 | filens.extend(glob(pattern)) |
| 104 | |
| 105 | main_py_dirs = [] |
| 106 | if not argv_contains('--launcher'): |
| 107 | for filen in filens: |
| 108 | new_dir = join(bdist_dir, dirname(filen)) |
| 109 | ensure_dir(new_dir) |
| 110 | print('Including {}'.format(filen)) |
| 111 | copyfile(filen, join(bdist_dir, filen)) |
| 112 | if basename(filen) in ('main.py', 'main.pyc'): |
| 113 | main_py_dirs.append(filen) |
| 114 | |
| 115 | # This feels ridiculous, but how else to define the main.py dir? |
| 116 | # Maybe should just fail? |
| 117 | if not main_py_dirs and not argv_contains('--launcher'): |
| 118 | print('ERROR: Could not find main.py, so no app build dir defined') |
| 119 | print('You should name your app entry point main.py') |
| 120 | exit(1) |
| 121 | if len(main_py_dirs) > 1: |
| 122 | print('WARNING: Multiple main.py dirs found, using the shortest path') |
| 123 | main_py_dirs = sorted(main_py_dirs, key=lambda j: len(split(j))) |
| 124 | |
| 125 | if not argv_contains('--launcher'): |
| 126 | sys.argv.append('--private={}'.format( |
| 127 | join(realpath(curdir), bdist_dir, dirname(main_py_dirs[0]))) |
| 128 | ) |
| 129 | |
| 130 | |
| 131 | class BdistAPK(Bdist): |
no test coverage detected