#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import re import sys from pathlib import Path # ==================== 配置区 ==================== # 目标目录(脚本所在目录下的 deps 文件夹) TARGET_DIR = Path(__file__).parent / "deps" # 需要处理的文件扩展名和文件名模式(CMake 相关配置文件) INCLUDE_PATTERNS = [ "*.cmake", "CMakeLists.txt", "*.cmake.in", ] # 排除的目录名(不处理这些目录下的文件) EXCLUDE_DIRS = [ "build", "downloads", "src", "exports", "patches", ] # 替换规则:(旧前缀, 新前缀) REPLACE_RULE = ( "https://github.com/", "https://ghproxy.net/github.com/" ) # ============================================== def should_exclude_file(file_path: Path, target_dir: Path) - bool: """检查文件是否在排除目录中""" try: relative_path = file_path.relativ