mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 16:00:43 +00:00
chore: 排除 dist/ 构建产物(改用 release 附件分发)
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
r"""修两个 BOM 问题。
|
||||
|
||||
PowerShell 5.1 的 -Encoding UTF8 会**写 BOM**,害了两处:
|
||||
1. .gitignore 开头多了 \ufeff -> 第一条规则失效
|
||||
(结果 dist/ 被提交进去,3195 个文件)
|
||||
2. ~/.ssh/config 开头多了 \ufeff -> ssh 直接报
|
||||
"no argument after keyword '\357\273\277'"
|
||||
|
||||
统一改成**不带 BOM 的 UTF-8**。
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote")
|
||||
SSH_CONFIG = Path.home() / ".ssh" / "config"
|
||||
|
||||
GITIGNORE = """# ---- 构建产物(不提交,release 里单独发)----
|
||||
/dist/
|
||||
/dist_exe/
|
||||
/dist_preview/
|
||||
/_build/jc*/
|
||||
/_build/out*/
|
||||
/_build/*.png
|
||||
/_build/icon_source.png
|
||||
/_build/icon_preview.png
|
||||
/_build/admin_preview*.png
|
||||
/_build/ui_preview.png
|
||||
/_build/_unit.txt
|
||||
/_tests/out_java/
|
||||
/_tests/out_app/
|
||||
/_tests/received/
|
||||
/_tests/_stubdata/
|
||||
/_tests/shots/
|
||||
|
||||
# ---- Python ----
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*.egg-info/
|
||||
.venv/
|
||||
venv/
|
||||
|
||||
# ---- 编辑器 / 系统 ----
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
Thumbs.db
|
||||
desktop.ini
|
||||
.DS_Store
|
||||
|
||||
# ---- 其它 ----
|
||||
*.log
|
||||
*.tmp
|
||||
"""
|
||||
|
||||
SSH_BLOCK = """# ykxmz-gitee
|
||||
Host gitee.com
|
||||
HostName gitee.com
|
||||
User git
|
||||
IdentityFile ~/.ssh/id_ed25519_gitee
|
||||
IdentitiesOnly yes
|
||||
StrictHostKeyChecking accept-new
|
||||
"""
|
||||
|
||||
|
||||
def fix(path: Path, content: str) -> None:
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_bytes(content.encode("utf-8")) # 明确不带 BOM
|
||||
raw = path.read_bytes()
|
||||
bom = "有(不对)" if raw.startswith(b"\xef\xbb\xbf") else "无 ✓"
|
||||
print(f" {path}")
|
||||
print(f" 字节数 {len(raw)} 首字节 {raw[:3].hex()} BOM: {bom}")
|
||||
|
||||
|
||||
def main() -> int:
|
||||
print(" 重写这两个文件(不带 BOM):")
|
||||
fix(ROOT / ".gitignore", GITIGNORE)
|
||||
fix(SSH_CONFIG, SSH_BLOCK)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user