Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python Support (WIP) #94

Open
wants to merge 199 commits into
base: feature/python
Choose a base branch
from

Conversation

yqs112358
Copy link

@yqs112358 yqs112358 commented Mar 11, 2023

WIP

功能已经全部编写完毕并经过社区项目实际运行检验(https://github.com/LiteLDev/LiteLoaderBDS)
github actions测试还有些小问题(少量内存泄漏等),最近将修复,请暂时不要合并此PR

概况

如题,为ScriptX完成了Python后端支持。
此PR包含:完整的Python适配、针对Python测试进行适配的UnitTest、docs中的增加的双语文档。提交的代码去除了所有的私有commit,仅包含完整的适配代码。

测试情况

Windows下使用MSVC编译,单元测试全部通过:
image
在Ubuntu使用GCC编译,单元测试全部通过:
image
运行性能还麻烦作者大大亲自测试,截图时开着好几个IDE,机子负载较大,导致单测运行时间较长
经实际运行环境测试引擎工作正常。如果有什么需要修改的还请提出,我们将继续进行修改。

TODOs

现在剩余一些TODO需要协助,这些操作我们无法自行完成

  1. 在合并此PR之前,需要首先通过一下另一个PR
    Add python backend testlib for win64 (Python 3.10.9) LanderlYoung/ScriptXTestLibs#3
    这个PR上传了编译工具链自动下载的python头文件以及库文件。缺失这些会导致github actions中的单元测试无法正常编译通过。
  2. 由于手头没有Mac设备,因此TestLib仅附带了win64、linux64的CPython头文件和库,未对Mac版进行编译测试。如果需要的话您可以按下面的步骤提供Mac适配:
    1. 去项目 https://github.com/indygreg/python-build-standalone/releases 下载编译好的mac平台的Python portable,仅把其中的标准库打包成压缩包,放到ScriptXTestLibs中
    2. 对源码的test/cmake/TestEnv.cmake进行修改适配
    3. 打开源码backend/Python/PyRuntimeSettings.cc,对前面部分的平台特定宏进行检查、修改,以符合Mac平台上Python portable环境的实际情况
    4. 在.github/workflows/unit_test.yml中的man-clang-run小节加入Python相关测试
    5. 编译测试
  3. 最后,README中的Python和CPython框框需要改成实线

About

Python后端适配开发者:@yqs112358 @twoone-3
Fork的仓库地址:https://github.com/LiteLDev/ScriptX

@yqs112358 yqs112358 changed the title Add Python Support Add Python Support (WIP) Mar 17, 2023
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.

None yet

2 participants