webp_to_png_gui/build.py
2024-05-05 22:42:44 +08:00

18 lines
650 B
Python

import os
import subprocess
import shutil
import sys
script_dir = os.path.dirname(os.path.abspath(__file__))
source_dir = os.path.join(script_dir,"webp_to_png","data")
des_dir = os.path.join(script_dir,"dist","pyinstaller")
if sys.platform.startswith('win32'):
des_dir = os.path.join(des_dir,"win_amd64","data")
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)