Skip to content

Commit 20d574e

Browse files
committed
update:修复打包7z脚本,不包含配置和定制源
1 parent eca0619 commit 20d574e

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,4 @@ dist
132132
!README.md
133133
.idea
134134
/config/env.json
135+
/js/玩偶哥哥[].js

Diff for: package.py

+21-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import os
22
import datetime
33

4-
# 要排除的目录列表,可以根据需要自行添加
5-
EXCLUDE_DIRS = ['.git', '.idea','soft','drop_code','jstest','local','logs','对话1.txt']
4+
# 要排除的目录列表
5+
EXCLUDE_DIRS = ['.git', '.idea', 'soft', 'drop_code', 'jstest', 'local', 'logs', '对话1.txt']
6+
7+
# 要排除的文件列表
8+
EXCLUDE_FILES = ['config/env.json', '.env', '/js/玩偶哥哥[盘].js']
69

710
def compress_directory():
811
# 获取当前目录名
@@ -20,12 +23,24 @@ def compress_directory():
2023

2124
# 构建 7z 压缩命令
2225
exclude_params = []
26+
27+
# 排除目录
2328
for exclude_dir in EXCLUDE_DIRS:
24-
exclude_params.extend(["-xr!", exclude_dir])
29+
exclude_params.append(f"-xr!{exclude_dir}")
30+
31+
# 排除文件
32+
for exclude_file in EXCLUDE_FILES:
33+
# 使用相对路径来确保文件的准确性
34+
if os.path.exists(exclude_file):
35+
exclude_params.append(f"-xr!{exclude_file}")
36+
else:
37+
print(f"警告: {exclude_file} 不存在!")
38+
39+
# 构建命令
40+
command = f"7z a \"{archive_path}\" ./ -r " + " ".join(exclude_params)
2541

26-
command = (
27-
f"7z a \"{archive_path}\" ./ -r " + " ".join(f"-xr!{dir}" for dir in EXCLUDE_DIRS)
28-
)
42+
# 打印构建的命令进行调试
43+
print(f"构建的 7z 命令: {command}")
2944

3045
try:
3146
# 执行压缩命令

0 commit comments

Comments
 (0)