This commit is contained in:
ZtRXR 2024-05-05 23:14:41 +08:00
parent 670d7106e9
commit 930d1b706c
3 changed files with 31 additions and 19 deletions

View File

@ -1,19 +0,0 @@
import os
import subprocess
import shutil
import sys
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)

29
make.py Normal file
View File

@ -0,0 +1,29 @@
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)

View File

@ -4,6 +4,8 @@ webp_to_png = { source = "webp_to_png/__main__.pyw", type = "onefile", bundle =
# [tool.poetry-pyinstaller-plugin.collect]
# Collect all submodules, data files & binaries for 'package_A' and 'package_B'
# all = ["webp_to_png"]
[tool.poetry.scripts]
make = "make:make"
[tool.poetry]