Skip to content

Fix python module#6636

Closed
star-hengxing wants to merge 1 commit intoxmake-io:devfrom
star-hengxing:patch-1
Closed

Fix python module#6636
star-hengxing wants to merge 1 commit intoxmake-io:devfrom
star-hengxing:patch-1

Conversation

@star-hengxing
Copy link
Contributor

@star-hengxing star-hengxing commented Jul 17, 2025

When using xrepo python, it should not find the system python library.

$ xmake
[ 93%]: linking.release xxx.cpython-310-x86_64-linux-gnu.so
[100%]: build ok, spent 4.133s
$ xrepo env python --version
Python 3.11.9

local python = assert(find_tool("python3"), "python not found!")

local envs = target:pkgenvs()
local python = assert(find_tool("python3", {envs = envs}), "python not found!")
Copy link
Member

Choose a reason for hiding this comment

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

按理 add_packages("python") 后,rule script 会自动绑定 python env ,优先找包里面的 python ,不需要额外设置 envs。。

如果没有 add_packages("python"),只有 系统 python 的情况下,我不确定是否会有反效果,导致系统 python 始终找不到

Copy link
Contributor Author

Choose a reason for hiding this comment

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

我这里只 add_packages("pybind11"),间接依赖 python 没处理好?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

rule script 会自动绑定 python env

这个是绑定了 pkgenvs 还是针对 python 开洞

Copy link
Member

Choose a reason for hiding this comment

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

on_load/build/install 等脚本都会统一绑定 pkgenvs,通用的

local oldenvs = os.addenvs(self:pkgenvs())

if target:pkgenvs() then

local oldenvs = os.addenvs(target:pkgenvs())

不过 on_config 好像忘记绑定 pkgenvs 了,这应该是 on_config 的问题,跟特定 python rule 无关

function sandbox_core_project._config_target(target, opt)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

那应该就是 on_config 没加的问题。

Copy link
Member

Choose a reason for hiding this comment

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

那等下个版本我改下,这个版本就不动了,这个地方影响范围有点多。

@star-hengxing star-hengxing deleted the patch-1 branch July 18, 2025 02:35
@waruqi
Copy link
Member

waruqi commented Jul 18, 2025

试试这个 patch #6641

@star-hengxing
Copy link
Contributor Author

试试这个 patch #6641

没问题了。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Try this patch #6641

No problem.

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