Skip to content

Conversation

@Redbeanw44602
Copy link
Contributor

@Redbeanw44602 Redbeanw44602 commented Apr 5, 2025

  • drop py2.7.18, py3.7.9

They are all end-of-life. And it failed to pass the test on macosx due to some problems.

  • drop py3.11.9, py3.13.0

They were not present in the pre-builds, which resulted in different versions being available on different platforms and tests failing.

  • add py3.13.2.
  • add config for all features.
  • add config for potentially useful packages.

See cpython configure script for details.

  • setup pip (wheel, setuptool) only when ensurepip is enabled.
  • use openssl3 by default.
  • cross-compilation issues have been resolved.
  • support for more platforms (android, iphoneos, wasm).

android, iphoneos, wasm support should be complete, but are temporarily disabled due to issues with some dependencies in xrepo.

@star-hengxing star-hengxing requested review from SirLynix and waruqi and removed request for waruqi April 5, 2025 21:46
@Redbeanw44602
Copy link
Contributor Author

Any updates?

@waruqi
Copy link
Member

waruqi commented Apr 9, 2025

This patch is a big change, I'm not sure if it is reliable. @SirLynix And idea?

add_configs("builtin_hashlib_hashes", {description = "Builtin hash modules. (md5, sha1, sha2, sha3, blake2)", default = nil, type = "string"}) -- 3.9
add_configs("ssl_default_suites", {description = "Override default cipher suites string. (python, openssl)", default = nil, type = "string"}) -- 3.7, 3.10
add_configs("lto", {description = "Enable Link-Time-Optimization in any build.", default = nil, values = {true, false, "full", "thin", "no", "yes"}})
add_configs("ensurepip", {description = "'install' or 'upgrade' using bundled pip", default = nil, values = {true, false, "upgrade", "install", "no"}}) -- 3.6
Copy link
Member

Choose a reason for hiding this comment

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

it should be enabled by default to not break retrocompatibility


on_load("@windows", "@msys", "@cygwin", function (package)

on_load("windows", "msys", "mingw", "cygwin", function (package)
Copy link
Member

Choose a reason for hiding this comment

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

why changing from host platforms to target platforms?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I understand correctly, using @ actually breaks cross-compilation, and ensurepip is disabled by default for the same reason. Often we may only need to use CPython's API without a full Python environment.
Is there any way to achieve both ends?

Copy link
Member

Choose a reason for hiding this comment

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

It doesn't break cross compilation, it makes it target a host architecture. @linux means you target the linux host, even if it builds for Android or for Windows using mingw.
This is because the python package is about having a running python interpreter able to execute python programs such as meson, on the host.

I think we should make a different package for cpython API or anything the program links to

Copy link
Member

Choose a reason for hiding this comment

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

if use python as cli program. we should use @host , please do not modify it.

Even for cross-compilation, it will always use the python on the host instead of the python of the cross-compilation platform, otherwise python will not run.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see what you mean. But the purpose of cross-compilation is not to "run on the host", but to generate code for other platforms.

Copy link
Contributor Author

@Redbeanw44602 Redbeanw44602 Apr 9, 2025

Choose a reason for hiding this comment

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

Maybe we should create another package focused on users who only need the CPython API, how about libpython?

Copy link
Member

@waruqi waruqi Apr 9, 2025

Choose a reason for hiding this comment

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

Cross compile libpython? This will be a big job, as many of its dependent libraries will need to enable cross-compilation support.

If you want to do it, you can add libpython package to do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, it does it now at least on windows (precompiled), linux, macosx and bsd. As for android, iphoneos and wasm it is indeed temporarily disabled due to some dependency issues (see line 170).

I will make another pull request later and then close this one.


on_load("@macosx", "@linux", "@bsd", function (package)
local version = package:version()
on_load("macosx", "linux", "bsd", function (package)
Copy link
Member

Choose a reason for hiding this comment

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

same

on_fetch("fetch")

on_install("@windows|x86", "@windows|x64", "@msys", "@cygwin", function (package)
on_install("windows|x86", "windows|x64", "msys", "mingw", "cygwin", function (package)
Copy link
Member

Choose a reason for hiding this comment

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

same

on_install("@macosx", "@bsd", "@linux", function (package)
local version = package:version()
--- android, iphoneos, wasm unsupported: dependencies not resolved.
on_install("macosx", "linux", "bsd", function (package)
Copy link
Member

Choose a reason for hiding this comment

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

same

@Redbeanw44602 Redbeanw44602 deleted the refactor/python branch April 23, 2025 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants