Skip to content

feat: refactor dde-first-run and add fcixt5-theme config#65

Merged
xzl01 merged 5 commits into
linuxdeepin:masterfrom
xzl01:master
Jun 9, 2025
Merged

feat: refactor dde-first-run and add fcixt5-theme config#65
xzl01 merged 5 commits into
linuxdeepin:masterfrom
xzl01:master

Conversation

@xzl01

@xzl01 xzl01 commented May 9, 2025

Copy link
Copy Markdown
Contributor

Log:

@github-actions

github-actions Bot commented May 9, 2025

Copy link
Copy Markdown

TAG Bot

TAG: 2025.05.09
EXISTED: no
DISTRIBUTION: unstable

@BLumia BLumia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

有能力的话注释用英文。

Comment thread dde-first-run Outdated
))
deploy_desktop_icons(desktop_dir)

configure_chrome() # 配置Chrome浏览器

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

这个现在真的还有用吗?我们应该已经没有预装chrome了吧?

Comment thread dde-first-run Outdated

def main():
"""主执行流程"""
# 初始化系统组件

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

这行为和注释不匹配啊,怎么就成初始化系统组件了。

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

代码审查意见:

  1. 文件格式和编码

    • .reuse/dep5文件中,License: Artistic-1.0重复出现,应该删除重复的行。
    • dde-first-run脚本中,第一行的#!/usr/bin/env python3和第二行的# -*- coding: utf-8 -*-之间应该有一个空行,以符合PEP 8的缩进规则。
  2. 函数命名

    • querySystemType函数应该重命名为get_system_type,以更清晰地表达其功能。
    • queryXDGDesktopDir函数应该重命名为get_xdg_desktop_dir,以更准确地反映其返回的是XDG桌面目录。
  3. 代码重复

    • configure_chrome函数中,config_files列表中的路径重复了两次,应该合并为一个路径列表。
  4. 路径拼接

    • configure_chrome函数中,使用Path对象的/操作符进行路径拼接,这是Python 3.4及以上版本的新特性,确保代码的兼容性。
  5. 异常处理

    • configure_chrome函数中,tarfile.openopen操作没有进行异常处理,应该添加try-except块来捕获可能的异常。
  6. 字符串替换

    • configure_chrome函数中,使用re.sub进行字符串替换,但是没有使用正则表达式来匹配deepin,应该使用re.sub(r'deepin', user_name, line)
  7. 文件路径拼接

    • modify_fcitx5_theme_config_file函数中,使用os.path.expanduseros.path.exists来处理文件路径,建议使用Path对象来处理路径,以提高代码的可读性和可维护性。
  8. 打印信息

    • modify_fcitx5_theme_config_file函数中,使用print语句输出信息,建议使用日志模块来记录信息,以便于调试和日志记录。
  9. 代码注释

    • main函数中,注释应该更详细地描述每个步骤的目的和功能,以便于其他开发者理解代码。
  10. 代码风格

    • main函数中,函数调用应该遵循PEP 8的缩进规则,每个函数调用应该在新的一行开始。
  11. 依赖管理

    • dde-first-run脚本中,使用了subprocess.Popen来执行命令,建议使用subprocess.run来替代,以更好地处理命令执行的结果。
  12. 代码重构

    • deploy_desktop_icons函数中的system_icons列表可以提取为一个常量,以提高代码的可维护性。

总体来说,代码已经有所改进,但仍有一些细节需要进一步优化,以提高代码的质量和可读性。

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BLumia, xzl01

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@xzl01
xzl01 merged commit deeb331 into linuxdeepin:master Jun 9, 2025
15 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants