Allow Linux users to build Android even if Python 2 is their default Python
After this commit, users who have the `python` executable as Python 2 can do simply:
cd android/
./build-all.py
./build.py
Previously, the following would fail:
python3 build-all.py
since build-all.py did subcalls to `python build.py`.
Remove install-all.py as it is redundant with `build-all.py -deploy`,
instead of fixing it as well.
Introduce argparse since we are separating argument parsing out of
the `main()` function.
Tested in Ubuntu 16.04, behaviour should be unchanged for Windows.
This commit is contained in:
parent
542be437da
commit
848310ffdb
6 changed files with 142 additions and 139 deletions
19
android/build-all.py
Normal file → Executable file
19
android/build-all.py
Normal file → Executable file
|
|
@ -1,8 +1,11 @@
|
|||
# Build all examples
|
||||
# Pass -deploy to also install on connected device
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import build
|
||||
|
||||
EXAMPLES = [
|
||||
"bloom",
|
||||
"computecullandlod",
|
||||
|
|
@ -64,18 +67,16 @@ COLOR_END = '\033[0m'
|
|||
|
||||
CURR_INDEX = 0
|
||||
|
||||
BUILD_ARGUMENTS = ""
|
||||
for arg in sys.argv[1:]:
|
||||
if arg == "-deploy":
|
||||
BUILD_ARGUMENTS += "-deploy"
|
||||
if arg == "-validation":
|
||||
BUILD_ARGUMENTS += "-validation"
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-deploy', default=False, action='store_true', help="install examples on device")
|
||||
parser.add_argument('-validation', default=False, action='store_true')
|
||||
args = parser.parse_args()
|
||||
|
||||
print("Building all examples...")
|
||||
|
||||
for example in EXAMPLES:
|
||||
print(COLOR_GREEN + "Building %s (%d/%d)" % (example, CURR_INDEX, len(EXAMPLES)) + COLOR_END)
|
||||
if subprocess.call(("python build.py %s %s" % (example, BUILD_ARGUMENTS)).split(' ')) != 0:
|
||||
if not build.main(example, args.deploy, args.validation):
|
||||
print("Error during build process for %s" % example)
|
||||
sys.exit(-1)
|
||||
CURR_INDEX += 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue