From b99c3925a48e27d5af3391ee473f10a709611b60 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Thu, 24 Oct 2024 04:48:04 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8D=EF=B8=8F[Update]=20Build=20:=20`np?= =?UTF-8?q?m=20run=20release-all`=20=E3=81=A7cpu/cuda=E3=81=AE=E5=AE=9F?= =?UTF-8?q?=E8=A1=8C=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=AEzip?= =?UTF-8?q?=E3=82=92=E4=BD=9C=E6=88=90=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 5 ++++- venv.bat | 2 -- zip.py | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 3 deletions(-) delete mode 100644 venv.bat create mode 100644 zip.py diff --git a/package.json b/package.json index ead0b180..d60d775d 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,10 @@ "dev-ui": "npm-run-all --parallel vite tauri-dev", "build": "npm run build-python && npm run vite-build && npm run tauri build", "build-cuda": "npm run build-python-cuda && npm run vite-build && npm run tauri build", - "build-ui": "npm run vite-build && npm run tauri build" + "build-ui": "npm run vite-build && npm run tauri build", + "release": "python zip.py --zip_name VRCT.zip", + "release-cuda": "python zip.py --zip_name VRCT_cuda.zip", + "release-all": "npm run build && npm run release && npm run build-cuda && npm run release-cuda" }, "dependencies": { "@emotion/react": "^11.13.0", diff --git a/venv.bat b/venv.bat deleted file mode 100644 index 21f16485..00000000 --- a/venv.bat +++ /dev/null @@ -1,2 +0,0 @@ -python -m venv .venv -.venv/Scripts/Activate.ps1 \ No newline at end of file diff --git a/zip.py b/zip.py new file mode 100644 index 00000000..8c64b2f7 --- /dev/null +++ b/zip.py @@ -0,0 +1,37 @@ +import os +import zipfile +import argparse + +def zip_files_and_directory(zip_name, file_paths, dir_paths): + # ZIPファイルを作成 + with zipfile.ZipFile(zip_name, 'w', zipfile.ZIP_DEFLATED) as zipf: + # ファイルを追加 + for file_path in file_paths: + if os.path.isfile(file_path): + zipf.write(file_path, os.path.basename(file_path)) + print(f"Add file: {file_path}") + + # ディレクトリを追加 + for dir_path in dir_paths: + if os.path.isdir(dir_path): + for foldername, subfolders, filenames in os.walk(dir_path): + for filename in filenames: + file_full_path = os.path.join(foldername, filename) + # ディレクトリを保持しつつ、ルートに配置 + arcname = os.path.join( + os.path.basename(dir_path), + os.path.relpath(file_full_path, dir_path) + ) + zipf.write(file_full_path, arcname) + print(f"Add file: {file_full_path}") + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--zip_name", type=str, default="VRCT.zip") + parser.add_argument("--file_paths", type=str, nargs="*", default=["src-tauri/target/release/VRCT.exe", "src-tauri/target/release/backend.exe"]) + parser.add_argument("--dir_paths", type=str, nargs="*", default=["src-tauri/target/release/_internal"]) + args = parser.parse_args() + + zip_files_and_directory(args.zip_name, args.file_paths, args.dir_paths) + print("Complete!") \ No newline at end of file