Skip to content

fix(pip): 修复 pip 的 getsrc#286

Merged
happy-game merged 1 commit into
RubyMetric:devfrom
happy-game:main
Sep 10, 2025
Merged

fix(pip): 修复 pip 的 getsrc#286
happy-game merged 1 commit into
RubyMetric:devfrom
happy-game:main

Conversation

@happy-game

Copy link
Copy Markdown
Collaborator

问题描述

在没有设置过源时 chsrc get pip会失败:

./chsrc get python
[chsrc 检查] x 命令 poetry 不存在
[chsrc 检查] x 命令 pdm 不存在
[chsrc 检查] x 命令 uv 不存在
[chsrc 检查] ✓ 命令 python3 存在
[chsrc 运行] python3 -m pip config get global.index-url
ERROR: No such key - global.index-url
[chsrc 运行] x 命令执行失败,退出状态: 256
chsrc: 关键错误,强制结束

Close: #272

方案与实现

使用 python -m pip config get global.index-url 2>/dev/null 获取源,失败时会退至显示默认源(Upstream)


使用  `python -m pip config get global.index-url 2>/dev/null`
获取源,失败时会退至显示默认源

Close: #272
@happy-game happy-game merged commit c7e5c1f into RubyMetric:dev Sep 10, 2025
3 of 4 checks passed
@ccmywish ccmywish added this to the v0.2.3 milestone Sep 12, 2025
@ccmywish ccmywish added the pl_target pl target label Sep 12, 2025

char *cmd = xy_2strcat (py_prog_name, " -m pip config get global.index-url");
chsrc_run (cmd, RunOpt_Default);
char *cmd = xy_2strcat (py_prog_name, " -m pip config get global.index-url 2>/dev/null");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2>/dev/null 疏忽了 Windows 上的情况,会报错找不到路径,从而走向 else 分支

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

已修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pl_target pl target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants