Skip to content

Add OpenHarmony platform identifiers #162319

Description

@hqzing

Background

OpenHarmony is an open-source operating system running on devices such as PCs, tablets, and embedded systems.

Many developers are already porting CPython and third-party libraries to OpenHarmony. These porters and library maintainers need a shared set of OpenHarmony platform identifiers. Different names in different ports would make it harder for third-party packages to support the platform consistently.

Proposal

I would like to add minimal platform identification for OpenHarmony under the Unsupported platform category in PEP 11, while keeping the maintenance cost as low as possible. This is not a request for Tier 3 support or for the buildbot and core-developer commitments required by that tier.

The initial scope is:

  • Detect native OpenHarmony builds through the __OHOS__ macro in config.guess, and use an explicit <arch>-unknown-linux-ohos target for cross builds.
  • Provide the <arch>-linux-ohos platform triplet and the ohos-<arch> sysconfig platform tag.
  • Target the three architectures supported by the OpenHarmony SDK: aarch64, arm, and x86_64.

The main benefit is not just making one CPython port build. It is establishing common identifiers so that different ports and third-party libraries can handle OpenHarmony consistently.

Implementation

I have prepared a complete implementation in the ohos branch of my fork and will use it for the PR. CPython's main development branch builds successfully in an OpenHarmony environment, and both test_sysconfig and patchcheck pass.

The related platform patches have also been validated through automated builds and smoke tests in ohos-python, a downstream project I maintain.

Follow-up

I am also a maintainer of Harmonybrew, a Homebrew port for OpenHarmony, where I work on package ports and build infrastructure. This experience is relevant to porting and maintaining CPython for OpenHarmony and provides a foundation for a possible future Tier 3 effort for aarch64-unknown-linux-ohos.

Tier 3 is a larger goal that may require a longer implementation period. It should be handled as a separate effort, not as part of this round of work. If the CPython community wants to pursue it later, I can join that discussion separately.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Activity

  1. added a commit that references this issue on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-unsupportedbuildThe build process and cross-buildtype-featureA feature request or enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions