GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-116622: Android sysconfig updates by mhsmith · Pull Request #118352 · python/cpython

Conversation

@mhsmith

@mhsmith mhsmith commented Apr 27, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This is the final feature PR for adding Android support. All that remains after this is test infrastructure and documentation updates.

  • Implemented sysconfig.get_platform in the format specified by PEP 738.

  • Added the -Wl,--no-undefined linker flag, both for CPython itself, and for third-party packages built using the sysconfig LDFLAGS. Based on past experience of building packages for Android, this can save a lot of time by detecting problems at compile time which would otherwise happen at runtime.

  • Added Android to the Tier 3 support list.

  • Issue: Add support for Android as a target platform #116622

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
mhsmith added 3 commits April 27, 2024 20:24
@mhsmith
Implement sysconfig.get_platform for Android
8e65409
@mhsmith
Add -Wl,--no-undefined flag
8cffaa5
@mhsmith
Add Android to support tier list
6b68e53
@mhsmith
mhsmith requested review from FFY00, corona10 and erlend-aasland as code owners April 27, 2024 19:30
@bedevere-app bedevere-app Bot mentioned this pull request Apr 27, 2024
Add support for Android as a target platform #116622
Closed
@bedevere-app bedevere-app Bot added the awaiting review label Apr 27, 2024
@mhsmith
Add news entry
ddadfcc
@mhsmith

mhsmith commented May 1, 2024

Copy link
Copy Markdown
Member Author

@encukou: Thanks for your help on my Android PRs in the last few days. Could I trouble you to review this one as well? It's pretty small, and it's the final one that needs to get merged before the feature freeze on May 7.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

encukou
encukou reviewed May 1, 2024
View reviewed changes
Comment thread Lib/sysconfig/__init__.py
Comment on lines +610 to +613
"x86_64": "x86_64",
"i686": "x86",
"aarch64": "arm64_v8a",
"armv7l": "armeabi_v7a",

@encukou encukou May 1, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this is in the PEP (sorry I didn't catch it) but let me ask -- more to bring this to your attention than anything else:
Is there a specific reason to use Android arch names, rather than ones from configure?

For reference: Fedora used their own arch names, and spent several years migrating to the configure ones when wheels became more universal.
Android wheels will probably always be separate, but it seems they might be compared to other Linux-y wheels more often than other Android apps. Also, maintaining this dict in CPython might not be worth it.

If CPython-style arch names would be better, this is the time to change them.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mhsmith mhsmith May 1, 2024

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using autoconf-style architecture names everywhere else, including in extension module filenames (see test_android_ext_suffix in test_sysconfig.py). This PR really only affects the platform tag in wheel filenames.

The main reason to use this format is for consistency with the existing Chaquopy wheel repository, which contains over a thousand wheels for Python 3.8-3.12. Having two formats in use would complicate package installers such as pip (which we intend to contribute Android and iOS support for in the near future), and higher-level app building tools such as Briefcase.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@encukou encukou May 1, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using autoconf-style architecture names everywhere else

Right, and this inconsistency is somewhat jarring.
If you'd be interested in setting up aliases in the Chaquopy repository, or adding aliases to packaging, let me know & I can help.

But, no reason for that to hold this PR back.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@robertkirkman robertkirkman Mar 7, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, this line of code does not work on 32-bit ARM Python 3.13 when it is running on an Android device that has a 32-bit ARM /system folder but a 64-bit ARM kernel.

On 32-bit ARM Python 3.13 when it is running on an Android device that has a 32-bit ARM /system folder but a 64-bit ARM kernel, this command (and any other pip command):

pip install packaging

unfortunately results in this error:

ERROR: Exception:
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/pip/_internal/cli/base_command.py", line 107, in _run_wrapper
    status = _inner_run()
  File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/pip/_internal/cli/base_command.py", line 98, in _inner_run
    return self.run(options, args)
           ~~~~~~~~^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/pip/_internal/cli/req_command.py", line 96, in wrapper
    return func(self, options, args)
  File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/pip/_internal/commands/install.py", line 391, in run
    resolver = self.make_resolver(
        preparer=preparer,
    ...<8 lines>...
        py_version_info=options.python_version,
    )
  File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/pip/_internal/cli/req_command.py", line 256, in make_resolver
    return pip._internal.resolution.resolvelib.resolver.Resolver(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        preparer=preparer,
        ^^^^^^^^^^^^^^^^^^
    ...<9 lines>...
        py_version_info=py_version_info,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 61, in __init__
    self.factory = Factory(
                   ~~~~~~~^
        finder=finder,
        ^^^^^^^^^^^^^^
    ...<7 lines>...
        py_version_info=py_version_info,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 118, in __init__
    self._supported_tags_cache = get_supported()
                                 ~~~~~~~~~~~~~^^
  File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/pip/_internal/utils/compatibility_tags.py", line 178, in get_supported
    supported.extend(
    ~~~~~~~~~~~~~~~~^
        cpython_tags(
        ^^^^^^^^^^^^^
    ...<3 lines>...
        )
        ^
    )
    ^
  File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/pip/_vendor/packaging/tags.py", line 229, in cpython_tags
    platforms = list(platforms or platform_tags())
  File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/pip/_vendor/packaging/tags.py", line 558, in android_platforms
    abi = sysconfig.get_platform().split("-")[-1]
          ~~~~~~~~~~~~~~~~~~~~~~^^
  File "/data/data/com.termux/files/usr/lib/python3.13/sysconfig/__init__.py", line 647, in get_platform
    machine = {
              ~
    ...<3 lines>...
        "armv7l": "armeabi_v7a",
        ~~~~~~~~~~~~~~~~~~~~~~~~
    }[machine]
    ~^^^^^^^^^
KeyError: 'armv8l'

I have opened an issue here to catalog this:

  • pip install does not work in Python 3.13 on 32-bit ARM Android running on 64-bit ARM kernel #145616

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@encukou

encukou commented May 1, 2024

Copy link
Copy Markdown
Member

Hah, it was the next thing on my list when you wrote that!

Looks good, tell me to merge & I will :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

encukou
encukou approved these changes May 1, 2024
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels May 1, 2024
@encukou
encukou enabled auto-merge (squash) May 1, 2024 16:45
@encukou
encukou merged commit 7595511 into python:main May 1, 2024
@bedevere-app bedevere-app Bot removed the awaiting merge label May 1, 2024
SonicField pushed a commit to SonicField/cpython that referenced this pull request May 8, 2024
@mhsmith @SonicField
pythongh-116622: Android sysconfig updates (python#118352)
6beb616
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@encukou encukou encukou approved these changes
@FFY00 FFY00 Awaiting requested review from FFY00 FFY00 is a code owner
@erlend-aasland erlend-aasland Awaiting requested review from erlend-aasland erlend-aasland is a code owner
@corona10 corona10 Awaiting requested review from corona10 corona10 is a code owner
+1 more reviewer
@robertkirkman robertkirkman robertkirkman left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@mhsmith @encukou @robertkirkman
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.