Skip to content

Commit e3d27ac

Browse files
committed
Miscellaneous cleanups
1 parent 71cccb3 commit e3d27ac

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

Android/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ it:
2525
`android-sdk/cmdline-tools/latest`.
2626
* `export ANDROID_HOME=/path/to/android-sdk`
2727

28-
The `android.py` script also requires the following commands to be on the `PATH`:
28+
The `android.py` script will automatically use the SDK's `sdkmanager` to install
29+
any packages it needs.
30+
31+
The script also requires the following commands to be on the `PATH`:
2932

3033
* `curl`
3134
* `java` (or set the `JAVA_HOME` environment variable)
32-
* `tar`
3335

3436

3537
## Building
@@ -97,7 +99,7 @@ similar to the `Android` directory of the CPython source tree.
9799
The Python test suite can be run on Linux, macOS, or Windows:
98100

99101
* On Linux, the emulator needs access to the KVM virtualization interface, and
100-
a DISPLAY environment variable pointing at an X server.
102+
a DISPLAY environment variable pointing at an X server. Xvfb is acceptable.
101103

102104
The test suite can usually be run on a device with 2 GB of RAM, but this is
103105
borderline, so you may need to increase it to 4 GB. As of Android

Android/android.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -163,19 +163,19 @@ def make_build_python(context):
163163
run(["make", "-j", str(os.cpu_count())])
164164

165165

166-
def unpack_deps(host):
166+
def unpack_deps(host, prefix_dir):
167167
deps_url = "https://github.com/beeware/cpython-android-source-deps/releases/download"
168168
for name_ver in ["bzip2-1.0.8-2", "libffi-3.4.4-3", "openssl-3.0.15-4",
169169
"sqlite-3.49.1-0", "xz-5.4.6-1"]:
170170
filename = f"{name_ver}-{host}.tar.gz"
171171
download(f"{deps_url}/{name_ver}/{filename}")
172-
run(["tar", "-xf", filename])
172+
shutil.unpack_archive(filename, prefix_dir)
173173
os.remove(filename)
174174

175175

176176
def download(url, target_dir="."):
177177
out_path = f"{target_dir}/{basename(url)}"
178-
run(["curl", "-Lf", "-o", out_path, url])
178+
run(["curl", "-Lf", "--retry", "5", "--retry-all-errors", "-o", out_path, url])
179179
return out_path
180180

181181

@@ -187,8 +187,7 @@ def configure_host_python(context):
187187
prefix_dir = host_dir / "prefix"
188188
if not prefix_dir.exists():
189189
prefix_dir.mkdir()
190-
os.chdir(prefix_dir)
191-
unpack_deps(context.host)
190+
unpack_deps(context.host, prefix_dir)
192191

193192
os.chdir(host_dir)
194193
command = [
@@ -266,16 +265,15 @@ def setup_sdk():
266265
# the Gradle wrapper is not included in the CPython repository. Instead, we
267266
# extract it from the Gradle GitHub repository.
268267
def setup_testbed():
269-
# The Gradle version used for the build is specified in
270-
# testbed/gradle/wrapper/gradle-wrapper.properties. This wrapper version
271-
# doesn't need to match, as any version of the wrapper can download any
272-
# version of Gradle.
273-
version = "8.9.0"
274268
paths = ["gradlew", "gradlew.bat", "gradle/wrapper/gradle-wrapper.jar"]
275-
276269
if all((TESTBED_DIR / path).exists() for path in paths):
277270
return
278271

272+
# The wrapper version isn't important, as any version of the wrapper can
273+
# download any version of Gradle. The Gradle version actually used for the
274+
# build is specified in testbed/gradle/wrapper/gradle-wrapper.properties.
275+
version = "8.9.0"
276+
279277
for path in paths:
280278
out_path = TESTBED_DIR / path
281279
out_path.parent.mkdir(exist_ok=True)

0 commit comments

Comments
 (0)