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

[tools/env]统一tools中env相关的接口,优化env部分路径拼接 #9185

Merged
merged 2 commits into from
Jul 30, 2024

Conversation

ComerLater
Copy link
Contributor

@ComerLater ComerLater commented Jul 13, 2024

拉取/合并请求描述:(PR description)

[

为什么提交这份PR (why to submit this PR)

目前tools中env相关的操作接口分散到各个py脚本(menukconfig.py、env.py、install_env.py、building.py等),且部分函数重复实现,甚至部分实现还不统一,影响env的统一行为。

该修改便于后续rtt统一对接env。

你的解决方案是什么 (what is your solution)

将menukconfig.py、env.py、install_env.py的功能统一到env_helper.py上,其他需要用到env接口/路径的,通过import env_helper进行调用。优化了对kconfiglib是否安装提示,优化了pkgs_dir环境变量是否存在的提示。

请提供验证的bsp和config (provide the config and bsp)

  • BSP:
  • .config:
  • action:

]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification

Sorry, something went wrong.

@ComerLater ComerLater requested a review from supperthomas as a code owner July 13, 2024 05:13
@Rbb666 Rbb666 added the env env build tool label Jul 13, 2024
@ComerLater
Copy link
Contributor Author

需要同时合并RT-Thread/pkgs-test#34,pkgs-test相关的ci才能全部通过

"* If your system is linux, you can use command below to install git.\n"
"* $ sudo yum install git\n"
"* $ sudo apt-get install git\n"
"* If your system is windows, you should download git software(msysGit).\n"
Copy link
Member

Choose a reason for hiding this comment

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

通过install_windows.ps 脚本是可以安装git的呀,为什么需要手动安装git?

Copy link
Member

Choose a reason for hiding this comment

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

还是说这个提示是假设install脚本不存在的情况下给用户提供一个全流程的提示?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个是历史遗留的,就以前在tools/menukconfig.py中有一个touch_env()函数,也可以用来安装env,但是会跟install_ubuntu.sh安装的env,在生成最后的env.sh上有区别。

这个touch_env()函数在部分ci以及pkgs-test中有调用,因此保留了下来。

另外,在scons --menuconfig的时候会自动判断kconfiglib和pkgs是否安装,如果没有这会调用touch_env()安装env

Copy link
Member

Choose a reason for hiding this comment

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

把touch_env干掉吧,保留我们的install脚本安装方式即可。

Copy link
Contributor Author

@ComerLater ComerLater Jul 14, 2024

Choose a reason for hiding this comment

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

是的 安装env应该使用统一的脚本,不应该各种开花,维护太难了

Copy link
Contributor Author

Choose a reason for hiding this comment

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

目前env仓库还有touch_env.sh和touch_env.ps1两个文件,其实我一直想把他们合并了,直接用python写一个,这样出口只有一个了

Copy link
Member

Choose a reason for hiding this comment

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

touch_env是用于安装env,这部分功能还是需要有的,这样可以自动触发安装。

# Change Logs:
# Date Author Notes
# 2024-04-20 Bernard the first version

Copy link
Member

@mysterywolf mysterywolf Jul 14, 2024

Choose a reason for hiding this comment

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

这个文件叫env_utility.py怎么样?

Copy link
Member

Choose a reason for hiding this comment

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

env_utility.py 我觉得这个名字更好一些

Copy link
Contributor Author

Choose a reason for hiding this comment

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

嗯嗯,文件名env_utility.py更好,rtenv.py估计后续会留给env那个仓库,这个文件主要是为了对接env的,避免tools和env重复或者不一致

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@mysterywolf mysterywolf merged commit 4c5b203 into RT-Thread:master Jul 30, 2024
43 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
env env build tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants