webp_to_png_gui/build.py
2024-05-05 22:51:28 +08:00

19 lines
681 B
Python

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)