Skip to content

Commit 9168221

Browse files
authored
Merge pull request #896 from KeyWeeUsr/fix_bdist
Fix bdistapk for launcher
2 parents 8731695 + 625183d commit 9168221

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

pythonforandroid/bdistapk.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def run(self):
8484

8585
def prepare_build_dir(self):
8686

87-
if argv_contains('--private'):
87+
if argv_contains('--private') and not argv_contains('--launcher'):
8888
print('WARNING: Received --private argument when this would '
8989
'normally be generated automatically.')
9090
print(' This is probably bad unless you meant to do '
@@ -105,27 +105,30 @@ def prepare_build_dir(self):
105105
filens.extend(glob(pattern))
106106

107107
main_py_dirs = []
108-
for filen in filens:
109-
new_dir = join(bdist_dir, dirname(filen))
110-
if not exists(new_dir):
111-
makedirs(new_dir)
112-
print('Including {}'.format(filen))
113-
copyfile(filen, join(bdist_dir, filen))
114-
if basename(filen) in ('main.py', 'main.pyo'):
115-
main_py_dirs.append(filen)
108+
if not argv_contains('--launcher'):
109+
for filen in filens:
110+
new_dir = join(bdist_dir, dirname(filen))
111+
if not exists(new_dir):
112+
makedirs(new_dir)
113+
print('Including {}'.format(filen))
114+
copyfile(filen, join(bdist_dir, filen))
115+
if basename(filen) in ('main.py', 'main.pyo'):
116+
main_py_dirs.append(filen)
116117

117118
# This feels ridiculous, but how else to define the main.py dir?
118119
# Maybe should just fail?
119-
if len(main_py_dirs) == 0:
120+
if not main_py_dirs and not argv_contains('--launcher'):
120121
print('ERROR: Could not find main.py, so no app build dir defined')
121122
print('You should name your app entry point main.py')
122123
exit(1)
123124
if len(main_py_dirs) > 1:
124125
print('WARNING: Multiple main.py dirs found, using the shortest path')
125126
main_py_dirs = sorted(main_py_dirs, key=lambda j: len(split(j)))
126127

127-
sys.argv.append('--private={}'.format(join(realpath(curdir), bdist_dir,
128-
dirname(main_py_dirs[0]))))
128+
if not argv_contains('--launcher'):
129+
sys.argv.append('--private={}'.format(
130+
join(realpath(curdir), bdist_dir, dirname(main_py_dirs[0])))
131+
)
129132

130133

131134
def _set_user_options():

0 commit comments

Comments
 (0)