Repository navigation
Conversation
hqzing
requested review from
AA-Turner,
FFY00,
corona10,
emmatyping,
erlend-aasland and
itamaro
as code owners
November 20, 2026 12:39
Documentation build overview
7 files changed ·
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #162319.
Background
This PR adds basic build support for the OpenHarmony platform.
The OpenHarmony standard system uses a Linux kernel (or a Linux-compatible kernel) but not the GNU userland. This architecture is similar to Android, so this PR follows CPython's existing Android platform handling where applicable:
*-*-linux-android*is identified asLinux-android, withMACHDEP=android.*-*-linux-ohos*is identified asLinux-ohos, withMACHDEP=ohos.This preserves the existing Linux platform logic while providing the platform identity required for OpenHarmony, including its wheel platform tags.
The
linux-ohosidentifier is not an arbitrary name introduced by this PR. It follows the target triple assigned to OpenHarmony by the LLVM toolchain:<arch>-unknown-linux-ohos(shorthand:<arch>-linux-ohos).Changes
__OHOS__and*-*-linux-ohos*in native and cross-compilation paths, resulting insys.platform == "ohos".config.subto acceptlinux-ohos. This change was backported from GNU config commit5d8be4275fe9066e3322386213120e1d93af6020.oh-uni-package.jsonmetadata and record it asOHOS_API_LEVEL, since OpenHarmony does not provide an API-level compiler macro like Android's__ANDROID_API__.ohos-26-aarch64) and the corresponding wheel tag (for example,ohos_26_aarch64).platform.ohos_ver()to report the OS release and runtime API level.No existing branches for other platforms are changed.
Scope
This PR targets the three architectures supported by the OpenHarmony SDK: aarch64, arm, and x86_64.
Native compilation is detected automatically by
config.guess, so no explicit target triple is required:For cross-compilation, explicitly specify the target triple and provide the build machine's triple and
--with-build-pythonas required by CPython:Testing
I validated CPython's
mainbranch using both native compilation on aarch64 OpenHarmony and cross-compilation from x86_64 Linux with the official OpenHarmony SDK. I ran the resulting interpreters on aarch64 OpenHarmony and verified:sys.platform == "ohos".sysconfig.get_platform() == "ohos-26-aarch64".sysconfig.get_config_var("OHOS_API_LEVEL") == 26.build-details.jsoncontains"platform": "ohos-26-aarch64".platform.ohos_ver()returnsOhosVer(release='7.0.0.109', api_level=26).I also ran the full test suite for both configurations:
The remaining failures involve platform and libc differences and are outside the scope of this PR. Tests for unavailable optional modules are skipped.