This commit is contained in:
仙君御 2024-07-31 22:30:23 +08:00
parent fbc84427d6
commit ba65811129
5 changed files with 82 additions and 15 deletions

17
.gitignore vendored
View File

@ -1,2 +1,17 @@
__pycache__/
__pycache__/
build/
dist/
*.egg-info/
*.egg
*.pyc
*.pyo
*.pyd
*.so
*.pyd
*.dll
*.dylib
*.lib
*.exp
*.ilk
*.pdb

1
build.bat Normal file
View File

@ -0,0 +1 @@
pyinstaller -F main.py

View File

@ -66,6 +66,12 @@ def run_config_selector(confList):
print("请选择配置文件:")
for i, conf in enumerate(confList):
print(f"{i+1}. {conf}")
choice = int(input("请输入选项:"))
if choice in range(1, len(confList)+1):
return confList[choice-1]
temp = input("请输入选项:")
# 整数
if temp.isdigit():
choice = int(temp)
if choice in range(1, len(confList)+1):
return confList[choice-1]
else:
return None

29
main.py
View File

@ -6,22 +6,29 @@ import config as cfg
def run():
# 读取配置文件
conFigList = cfg.read_config_file()
if not conFigList: print('[没有找到配置文件]')
if not conFigList:
print('[没有找到配置文件]')
input('请按任意键退出...')
else:
# 选择运行配置
data = cfg.run_config_selector(conFigList)
# 处理目录结构
dirDict = cfg.config_dir_structure(data)
os.system('cls')
if not dirDict:
print('[配置文件为空]\n')
if not data:
os.system('cls')
print('[配置文件不存在]\n')
run()
else:
# 创建目录
base_path = '.'
cfg.create_folders(base_path, dirDict)
print('[目录创建成功]\n')
run()
# 处理目录结构
dirDict = cfg.config_dir_structure(data)
os.system('cls')
if not dirDict:
print('[配置文件为空]\n')
run()
else:
# 创建目录
base_path = '.'
cfg.create_folders(base_path, dirDict)
print('[目录创建成功]\n')
run()
if __name__ == '__main__':
run()

38
main.spec Normal file
View File

@ -0,0 +1,38 @@
# -*- mode: python ; coding: utf-8 -*-
a = Analysis(
['main.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)