webp_to_png_gui/build.py

19 lines
681 B
Python
Raw Normal View History

2024-05-05 14:27:17 +00:00
import os
import subprocess
import shutil
import sys
2024-05-05 14:51:28 +00:00
dir_name = "program_data"
2024-05-05 14:27:17 +00:00
script_dir = os.path.dirname(os.path.abspath(__file__))
2024-05-05 14:51:28 +00:00
source_dir = os.path.join(script_dir,"webp_to_png",dir_name)
2024-05-05 14:37:50 +00:00
des_dir = os.path.join(script_dir,"dist","pyinstaller")
2024-05-05 14:27:17 +00:00
if sys.platform.startswith('win32'):
2024-05-05 14:51:28 +00:00
des_dir = os.path.join(des_dir,"win_amd64",dir_name)
2024-05-05 14:27:17 +00:00
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")
2024-05-05 14:37:50 +00:00
exit(1)
2024-05-05 14:27:17 +00:00
2024-05-05 14:42:44 +00:00
subprocess.run(["poetry","build"], check=True)
2024-05-05 14:37:50 +00:00
print(f"copying {source_dir} to {des_dir}")
2024-05-05 14:27:17 +00:00
shutil.copytree(source_dir,des_dir)