Skip to content

Commit 283debe

Browse files
committed
Make the cross-build dir customizable.
1 parent 57dd50f commit 283debe

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

Android/android.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ def add_parser(*args, **kwargs):
864864
"make-host")
865865
configure_build = add_parser(
866866
"configure-build", help="Run `configure` for the build Python")
867-
add_parser(
867+
make_build = add_parser(
868868
"make-build", help="Run `make` for the build Python")
869869
configure_host = add_parser(
870870
"configure-host", help="Run `configure` for Android")
@@ -891,6 +891,31 @@ def add_parser(*args, **kwargs):
891891
env = add_parser("env", help="Print environment variables")
892892

893893
# Common arguments
894+
# --cross-build-dir argument
895+
for cmd in [
896+
clean,
897+
configure_build,
898+
make_build,
899+
configure_host,
900+
make_host,
901+
build,
902+
package,
903+
test,
904+
ci,
905+
]:
906+
cmd.add_argument(
907+
"--cross-build-dir",
908+
action="store",
909+
default=os.environ.get("CROSS_BUILD_DIR"),
910+
dest="cross_build_dir",
911+
type=Path,
912+
help=(
913+
"Path to the cross-build directory "
914+
f"(default: {CROSS_BUILD_DIR}). Can also be set "
915+
"with the CROSS_BUILD_DIR environment variable."
916+
),
917+
)
918+
894919
# --cache-dir option
895920
for cmd in [configure_host, build, ci]:
896921
cmd.add_argument(
@@ -967,6 +992,12 @@ def main():
967992
stream.reconfigure(line_buffering=True)
968993

969994
context = parse_args()
995+
996+
# Set the CROSS_BUILD_DIR if an argument was provided
997+
if context.cross_build_dir:
998+
global CROSS_BUILD_DIR
999+
CROSS_BUILD_DIR = context.cross_build_dir.resolve()
1000+
9701001
dispatch = {
9711002
"configure-build": configure_build_python,
9721003
"make-build": make_build_python,

0 commit comments

Comments
 (0)