Commit a23a6b5
authored
fix: platform.system() on Android for Python 3.13+ (#2992)
Python from 3.13 onwards supports Android as an official platform. As a
part of this official support, there were a bunch of changes including
`platform.system()` returning "Android" and `sys.platform` being
"android" instead of "Linux" and "linux" on earlier versions. This is a
breaking change.
Also try to be backwards compatible while running on Android for older
python versions in environments like Termux
This maturin bug was found as a part of testing of builds of python
packages for Termux as part of Python 3.13 migration. Downstream Python
distribution update PR:
termux/termux-packages#27739
Ideally we would like to ensure that get_python_os() returns "linux" for
Python versions <= 3.12, but that'd require additional work in supplying
python version to get_python_os(), but that'd complicate some things.
This works well enough, and shouldn't be necessary in future when Python
>= 3.13 becomes the standard target by most (which should ideally happen
soon since upstream Python is supporting Android from this version).
My analysis of maturin reveal that get_python_os() returning "android"
shouldn't cause any side effects for Python <= 3.12 on Android.
Issue also reported to maturin in
#2945
Partially based of off work by @robertkirkman in the linked issue.
Further fixup was done to ensure suitability for upstream acceptance.
Ref: python/cpython#116215
CC @mhsmith Android support for Python1 parent 5e31a16 commit a23a6b5
File tree
4 files changed
+85
-54
lines changed- src
- python_interpreter
- target
4 files changed
+85
-54
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
391 | 417 | | |
392 | | - | |
393 | | - | |
394 | | - | |
| 418 | + | |
395 | 419 | | |
396 | 420 | | |
397 | 421 | | |
398 | | - | |
399 | | - | |
| 422 | + | |
400 | 423 | | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
426 | 428 | | |
427 | 429 | | |
428 | 430 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
303 | 312 | | |
304 | 313 | | |
305 | 314 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
| |||
161 | 163 | | |
162 | 164 | | |
163 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
164 | 174 | | |
165 | 175 | | |
166 | 176 | | |
| |||
278 | 288 | | |
279 | 289 | | |
280 | 290 | | |
281 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
282 | 295 | | |
283 | 296 | | |
284 | 297 | | |
| |||
458 | 471 | | |
459 | 472 | | |
460 | 473 | | |
| 474 | + | |
461 | 475 | | |
462 | 476 | | |
463 | 477 | | |
| |||
571 | 585 | | |
572 | 586 | | |
573 | 587 | | |
574 | | - | |
| 588 | + | |
| 589 | + | |
575 | 590 | | |
576 | 591 | | |
577 | 592 | | |
| |||
671 | 686 | | |
672 | 687 | | |
673 | 688 | | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
674 | 694 | | |
675 | 695 | | |
676 | 696 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
0 commit comments