Skip to content

Commit 3d5e1df

Browse files
committed
Cleanups from review.
1 parent 6de0434 commit 3d5e1df

1 file changed

Lines changed: 15 additions & 16 deletions

File tree

Android/android.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -219,17 +219,17 @@ def download(url, cache_dir):
219219
out_path = cache_dir / basename(url)
220220
cache_dir.mkdir(parents=True, exist_ok=True)
221221
if not out_path.is_file():
222-
run(["curl", "-Lf", "--retry", "5", "--retry-all-errors", "-o", str(out_path), url])
222+
run(["curl", "-Lf", "--retry", "5", "--retry-all-errors", "-o", out_path, url])
223223
else:
224224
print(f"Using cached version of {basename(url)}")
225225
return out_path
226226

227227

228228
def configure_host_python(context, host=None):
229-
if context.clean:
230-
clean(context.host)
231229
if host is None:
232230
host = context.host
231+
if context.clean:
232+
clean(host)
233233

234234
host_dir = subdir(host, create=True)
235235
prefix_dir = host_dir / "prefix"
@@ -295,13 +295,10 @@ def build_targets(context):
295295
configure_build_python(context)
296296
make_build_python(context)
297297

298-
if context.target == "hosts":
299-
for host in HOSTS:
298+
for host in HOSTS:
299+
if context.target in {"all", "build", host}:
300300
configure_host_python(context, host)
301301
make_host_python(context, host)
302-
elif context.target not in {"all", "build"}:
303-
configure_host_python(context, context.target)
304-
make_host_python(context, context.target)
305302

306303

307304
def clean(host):
@@ -312,11 +309,9 @@ def clean_targets(context):
312309
if context.target in {"all", "build"}:
313310
clean("build")
314311

315-
if context.target in {"all", "hosts"}:
316-
for host in HOSTS:
312+
for host in HOSTS:
313+
if context.target in {"all", "hosts", host}:
317314
clean(host)
318-
elif context.target != "build":
319-
clean(context.target)
320315

321316

322317
def setup_ci():
@@ -879,8 +874,9 @@ def add_parser(*args, **kwargs):
879874

880875
# Subcommands
881876
build = add_parser(
882-
"build", help="Run configure-build, make-build, configure-host and "
883-
"make-host")
877+
"build",
878+
help="Run configure and make for the selected target"
879+
)
884880
configure_build = add_parser(
885881
"configure-build", help="Run `configure` for the build Python")
886882
make_build = add_parser(
@@ -890,7 +886,10 @@ def add_parser(*args, **kwargs):
890886
make_host = add_parser(
891887
"make-host", help="Run `make` for Android")
892888

893-
clean = add_parser("clean", help="Delete all build directories")
889+
clean = add_parser(
890+
"clean",
891+
help="Delete build directories for the selected target"
892+
)
894893

895894
add_parser("build-testbed", help="Build the testbed app")
896895
test = add_parser("test", help="Run the testbed app")
@@ -946,7 +945,7 @@ def add_parser(*args, **kwargs):
946945
default="all",
947946
choices=["all", "build", "hosts"] + HOSTS,
948947
help=(
949-
"The host triple to build (e.g., aarch64-linux-android), "
948+
"The host triplet (e.g., aarch64-linux-android), "
950949
"or 'build' for just the build platform, or 'hosts' for all "
951950
"host platforms, or 'all' for the build platform and all "
952951
"hosts. Defaults to 'all'"

0 commit comments

Comments
 (0)