Skip to content

Commit 625183d

Browse files
committed
Fix bdistapk for launcher
1 parent aacc461 commit 625183d

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

pythonforandroid/bdistapk.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def run(self):
8080

8181
def prepare_build_dir(self):
8282

83-
if argv_contains('--private'):
83+
if argv_contains('--private') and not argv_contains('--launcher'):
8484
print('WARNING: Received --private argument when this would '
8585
'normally be generated automatically.')
8686
print(' This is probably bad unless you meant to do '
@@ -101,27 +101,30 @@ def prepare_build_dir(self):
101101
filens.extend(glob(pattern))
102102

103103
main_py_dirs = []
104-
for filen in filens:
105-
new_dir = join(bdist_dir, dirname(filen))
106-
if not exists(new_dir):
107-
makedirs(new_dir)
108-
print('Including {}'.format(filen))
109-
copyfile(filen, join(bdist_dir, filen))
110-
if basename(filen) in ('main.py', 'main.pyo'):
111-
main_py_dirs.append(filen)
104+
if not argv_contains('--launcher'):
105+
for filen in filens:
106+
new_dir = join(bdist_dir, dirname(filen))
107+
if not exists(new_dir):
108+
makedirs(new_dir)
109+
print('Including {}'.format(filen))
110+
copyfile(filen, join(bdist_dir, filen))
111+
if basename(filen) in ('main.py', 'main.pyo'):
112+
main_py_dirs.append(filen)
112113

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

123-
sys.argv.append('--private={}'.format(join(realpath(curdir), bdist_dir,
124-
dirname(main_py_dirs[0]))))
124+
if not argv_contains('--launcher'):
125+
sys.argv.append('--private={}'.format(
126+
join(realpath(curdir), bdist_dir, dirname(main_py_dirs[0])))
127+
)
125128

126129

127130
def _set_user_options():
@@ -138,4 +141,4 @@ def _set_user_options():
138141

139142
BdistAPK.user_options = user_options
140143

141-
_set_user_options()
144+
_set_user_options()

0 commit comments

Comments
 (0)