@@ -381,7 +381,8 @@ def configure_host_python(
381381 with group (f"Downloading dependencies ({ host } )" ):
382382 if not prefix_dir .exists ():
383383 prefix_dir .mkdir ()
384- unpack_deps (context .platform , host , prefix_dir , context .cache_dir )
384+ cache_dir = context .cache_dir or CROSS_BUILD_DIR / "downloads"
385+ unpack_deps (context .platform , host , prefix_dir , cache_dir )
385386 else :
386387 print ("Dependencies already installed" )
387388
@@ -898,7 +899,7 @@ def parse_args() -> argparse.Namespace:
898899 configure_build = subcommands .add_parser (
899900 "configure-build" , help = "Run `configure` for the build Python"
900901 )
901- subcommands .add_parser (
902+ make_build = subcommands .add_parser (
902903 "make-build" , help = "Run `make` for the build Python"
903904 )
904905 configure_host = subcommands .add_parser (
@@ -954,6 +955,31 @@ def parse_args() -> argparse.Namespace:
954955 ),
955956 )
956957
958+ # --cross-build-dir argument
959+ for cmd in [
960+ clean ,
961+ configure_build ,
962+ make_build ,
963+ configure_host ,
964+ make_host ,
965+ build ,
966+ package ,
967+ test ,
968+ ci ,
969+ ]:
970+ cmd .add_argument (
971+ "--cross-build-dir" ,
972+ action = "store" ,
973+ default = os .environ .get ("CROSS_BUILD_DIR" ),
974+ dest = "cross_build_dir" ,
975+ type = Path ,
976+ help = (
977+ "Path to the cross-build directory "
978+ f"(default: { CROSS_BUILD_DIR } ). Can also be set "
979+ "with the CROSS_BUILD_DIR environment variable."
980+ ),
981+ )
982+
957983 # --clean option
958984 for cmd in [configure_build , configure_host , build , package , test , ci ]:
959985 cmd .add_argument (
@@ -968,7 +994,6 @@ def parse_args() -> argparse.Namespace:
968994 for cmd in [configure_host , build , ci ]:
969995 cmd .add_argument (
970996 "--cache-dir" ,
971- default = "./cross-build/downloads" ,
972997 help = "The directory to store cached downloads." ,
973998 )
974999
@@ -1035,6 +1060,12 @@ def signal_handler(*args):
10351060
10361061 # Process command line arguments
10371062 context = parse_args ()
1063+
1064+ # Set the CROSS_BUILD_DIR if an argument was provided
1065+ if context .cross_build_dir :
1066+ global CROSS_BUILD_DIR
1067+ CROSS_BUILD_DIR = context .cross_build_dir .resolve ()
1068+
10381069 dispatch : dict [str , Callable ] = {
10391070 "clean" : clean ,
10401071 "configure-build" : configure_build_python ,
0 commit comments