Skip to content

Commit 67d6175

Browse files
authored
Add a compatibility shim for migrating Android build tools to Platforms (#699)
1 parent 940551c commit 67d6175

File tree

1 file changed

+30
-22
lines changed

1 file changed

+30
-22
lines changed

master/custom/factories.py

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,10 +1185,7 @@ def py313_setup(self, branch, worker, test_with_PTY=False, **kwargs):
11851185
)
11861186

11871187
def current_setup(self, branch, worker, test_with_PTY=False, **kwargs):
1188-
build_environ = {
1189-
"CACHE_DIR": "/Users/buildbot/downloads",
1190-
}
1191-
1188+
apple_py = ["python3", "Platforms/Apple"]
11921189
self.addSteps([
11931190
# This symlink is needed to support Python 3.14 builds - it makes the
11941191
# top level Apple folder appear in the new Platforms/Apple location.
@@ -1197,23 +1194,24 @@ def current_setup(self, branch, worker, test_with_PTY=False, **kwargs):
11971194
# supported.
11981195
ShellCommand(
11991196
name="Set up compatibility symlink",
1200-
command="[ -e Platforms/Apple ] || ln -s ../Apple Platforms/Apple",
1197+
command=(
1198+
"if [ ! -e Platforms/Apple ]; then"
1199+
" ln -s ../Apple Platforms/Apple; "
1200+
"fi"
1201+
),
12011202
),
12021203
# Build the full iOS XCframework, including a multi-arch simulator slice.
12031204
Compile(
12041205
name="Configure and compile build Python",
1205-
command=["python3", "Platforms/Apple", "build", "iOS", "build"],
1206-
env=build_environ,
1206+
command=apple_py + ["build", "iOS", "build"],
12071207
),
12081208
Compile(
12091209
name="Configure and compile host Pythons",
1210-
command=["python3", "Platforms/Apple", "build", "iOS", "hosts"],
1211-
env=build_environ,
1210+
command=apple_py + ["build", "iOS", "hosts"],
12121211
),
12131212
Compile(
12141213
name="Package XCframework",
1215-
command=["python3", "Platforms/Apple", "package", "iOS"],
1216-
env=build_environ,
1214+
command=apple_py + ["package", "iOS"],
12171215
),
12181216
Test(
12191217
name="Run test suite",
@@ -1224,13 +1222,11 @@ def current_setup(self, branch, worker, test_with_PTY=False, **kwargs):
12241222
"iOS",
12251223
"--slow-ci",
12261224
],
1227-
env=build_environ,
12281225
timeout=step_timeout(self.test_timeout),
12291226
),
12301227
Clean(
12311228
name="Clean the builds",
1232-
command=["python3", "Platforms/Apple", "clean", "iOS"],
1233-
env=build_environ,
1229+
command=apple_py + ["clean", "iOS"],
12341230
),
12351231
])
12361232

@@ -1273,8 +1269,22 @@ class AndroidBuild(BaseBuild):
12731269
"""
12741270

12751271
def setup(self, **kwargs):
1276-
android_py = "Android/android.py"
1272+
android_py = ["python3", "Platforms/Android"]
12771273
self.addSteps([
1274+
# This symlink is needed to support pre Python 3.15 builds - it makes the
1275+
# top level Android folder appear in the new Platforms/Android location,
1276+
# and links `__main__.py` to the older `android.py` script. This step can
1277+
# be removed when 3.14 is no longer supported.
1278+
ShellCommand(
1279+
name="Set up compatibility symlink",
1280+
command=(
1281+
"if [ ! -e Platforms/Android ]; then"
1282+
" mkdir -p Platforms;"
1283+
" ln -s ../Android Platforms/Android;"
1284+
" ln -s ./android.py Platforms/Android/__main__.py; "
1285+
"fi"
1286+
),
1287+
),
12781288
SetPropertyFromCommand(
12791289
name="Get build triple",
12801290
command=["./config.guess"],
@@ -1283,24 +1293,22 @@ def setup(self, **kwargs):
12831293
),
12841294
Configure(
12851295
name="Configure build Python",
1286-
command=[android_py, "configure-build"],
1296+
command=android_py + ["configure-build"],
12871297
),
12881298
Compile(
12891299
name="Compile build Python",
1290-
command=[android_py, "make-build"],
1300+
command=android_py + ["make-build"],
12911301
),
12921302
Configure(
12931303
name="Configure host Python",
1294-
command=[android_py, "configure-host", self.host_triple],
1304+
command=android_py + ["configure-host", self.host_triple],
12951305
),
12961306
Compile(
12971307
name="Compile host Python",
1298-
command=[android_py, "make-host", self.host_triple],
1308+
command=android_py + ["make-host", self.host_triple],
12991309
),
13001310
Test(
1301-
command=[
1302-
android_py, "test", "--managed", "maxVersion", "-v", "--slow-ci"
1303-
],
1311+
command=android_py + ["test", "--managed", "maxVersion", "-v", "--slow-ci"],
13041312
timeout=step_timeout(self.test_timeout),
13051313
),
13061314
])

0 commit comments

Comments
 (0)