requirements.txt

pull/7/head
zhangzhichao 4 weeks ago
parent d30f2e3bf1
commit d8b641b63b

@ -0,0 +1,28 @@
import re
def simplify_editable_git_path(line: str) -> str:
if not line.strip().startswith("-e"):
return line
# 匹配 subdirectory 参数
match = re.search(r"subdirectory=([^\s&#]+)", line)
if match:
sub_path = match.group(1)
if sub_path.startswith("third_party/"):
return f"-e {sub_path}\n"
return line
def fix_requirements():
with open('requirements.txt', "r") as infile:
lines = infile.readlines()
fixed_lines = [simplify_editable_git_path(line) for line in lines]
with open('requirements.txt', "w") as outfile:
outfile.writelines(fixed_lines)
print(f"✅ 已更新 requirements.txt简化了包含 third_party 的 git 路径。")
if __name__ == "__main__":
fix_requirements()
Loading…
Cancel
Save