webp_to_png_gui/make.py
2024-05-19 23:49:29 +08:00

29 lines
1.0 KiB
Python

import os
import subprocess
import shutil
import sys
import subprocess
def clean_and_reinstall():
# 删除现有的虚拟环境
subprocess.run(["poetry", "env", "remove", "python"], check=True)
# 重新创建虚拟环境并安装依赖
subprocess.run(["poetry", "install"], check=True)
def make():
# clean_and_reinstall()
dir_name = "program_data"
script_dir = os.path.dirname(os.path.abspath(__file__))
source_dir = os.path.join(script_dir,"webp_to_png",dir_name)
des_dir = os.path.join(script_dir,"dist","pyinstaller")
if sys.platform.startswith('win32'):
des_dir = os.path.join(des_dir,"win_amd64",dir_name)
print("You are on the windows platform,it will put data into",des_dir)
else:
print("you are on the other platform please put webp_to_png/data \"data\" directory into the exe directory")
exit(1)
subprocess.run(["poetry","build"], check=True)
print(f"copying {source_dir} to {des_dir}")
shutil.copytree(source_dir,des_dir)