File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import shutil
44import sys
55from string import Template
6- from src .version import *
6+ from src .version . version import *
77
88# 设置默认编码为 UTF-8
99if sys .stdout .encoding != 'utf-8' :
@@ -14,15 +14,31 @@ def clean_dist():
1414 output_name = f"SD_Models_Manager_v{ VERSION_STR } "
1515
1616 try :
17+ # 清理构建目录
1718 for item in ['dist' , 'build' ]:
1819 if os .path .exists (item ):
1920 shutil .rmtree (item )
2021 print (f"已删除 { item } 目录" )
2122
22- for item in ['version_info.txt' , 'runtime_hook.py' , f'{ output_name } .spec' ]:
23- if os .path .exists (item ):
24- os .remove (item )
25- print (f"已删除 { item } 文件" )
23+ # 清理构建生成的文件
24+ for item in [
25+ 'version_info.txt' ,
26+ 'runtime_hook.py' ,
27+ f'{ output_name } .spec' ,
28+ 'SD_Models_Manager_v*.spec' , # 使用通配符匹配所有版本的 spec 文件
29+ '__pycache__' ,
30+ '**/__pycache__' ,
31+ '.pytest_cache' ,
32+ '.coverage'
33+ ]:
34+ # 使用 glob 处理通配符
35+ import glob
36+ for file in glob .glob (item , recursive = True ):
37+ if os .path .isdir (file ):
38+ shutil .rmtree (file )
39+ else :
40+ os .remove (file )
41+ print (f"已删除 { file } " )
2642
2743 except Exception as e :
2844 print (f"清理文件时出错: { e } " , file = sys .stderr )
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments