From 6ee9b22923f240086fe8d260438f05fcc5ab3fdf Mon Sep 17 00:00:00 2001 From: Salad Dais Date: Tue, 9 Jan 2024 08:45:25 +0000 Subject: [PATCH] Start updating Windows release bundling --- .github/workflows/bundle_windows.yml | 13 ++++++---- setup_cxfreeze.py | 39 +++++++++++++++------------- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/.github/workflows/bundle_windows.yml b/.github/workflows/bundle_windows.yml index ecfd9d1..026f4e2 100644 --- a/.github/workflows/bundle_windows.yml +++ b/.github/workflows/bundle_windows.yml @@ -1,5 +1,3 @@ -# Have to manually unzip this (it gets double zipped) and add it -# onto the release after it gets created. Don't want actions with repo write. name: Bundle Windows EXE @@ -9,8 +7,12 @@ on: types: - created workflow_dispatch: + inputs: + ref_name: + description: Name to use for the release env: - target_tag: ${{ github.ref_name }} + target_tag: ${{ github.ref_name || github.event.inputs.ref_name }} + sha: ${{ github.sha || github.event.inputs.ref_name }} jobs: @@ -21,7 +23,7 @@ jobs: contents: write strategy: matrix: - python-version: [3.9] + python-version: [3.11] steps: - uses: actions/checkout@v2 @@ -51,10 +53,11 @@ jobs: - name: Upload the artifact uses: actions/upload-artifact@v2 with: - name: hippolyzer-windows-${{ github.sha }} + name: hippolyzer-windows-${{ env.sha }} path: ./hippolyzer-windows-${{ env.target_tag }}.zip - uses: ncipollo/release-action@v1.10.0 + if: github.event_name != 'workflow_dispatch' with: artifacts: hippolyzer-windows-${{ env.target_tag }}.zip tag: ${{ env.target_tag }} diff --git a/setup_cxfreeze.py b/setup_cxfreeze.py index bfe0439..3f7f2f9 100644 --- a/setup_cxfreeze.py +++ b/setup_cxfreeze.py @@ -1,3 +1,5 @@ +import glob + import setuptools # noqa import os @@ -32,20 +34,20 @@ TO_DELETE = [ "lib/aiohttp/_http_writer.c", "lib/aiohttp/_websocket.c", # Improve this to work with different versions. - "lib/aiohttp/python39.dll", - "lib/lazy_object_proxy/python39.dll", - "lib/lxml/python39.dll", - "lib/markupsafe/python39.dll", - "lib/multidict/python39.dll", - "lib/numpy/core/python39.dll", - "lib/numpy/fft/python39.dll", - "lib/numpy/linalg/python39.dll", - "lib/numpy/random/python39.dll", - "lib/python39.dll", - "lib/recordclass/python39.dll", - "lib/regex/python39.dll", + "lib/aiohttp/python3*.dll", + "lib/lazy_object_proxy/python3*.dll", + "lib/lxml/python3*.dll", + "lib/markupsafe/python3*.dll", + "lib/multidict/python3*.dll", + "lib/numpy/core/python3*.dll", + "lib/numpy/fft/python3*.dll", + "lib/numpy/linalg/python3*.dll", + "lib/numpy/random/python3*.dll", + "lib/python3*.dll", + "lib/recordclass/python3*.dll", + "lib/regex/python3*.dll", "lib/test", - "lib/yarl/python39.dll", + "lib/yarl/python3*.dll", ] COPY_TO_ZIP = [ @@ -77,11 +79,12 @@ class FinalizeCXFreezeCommand(Command): if path.name.startswith("exe.") and path.is_dir(): for cleanse_suffix in TO_DELETE: cleanse_path = path / cleanse_suffix - shutil.rmtree(cleanse_path, ignore_errors=True) - try: - os.unlink(cleanse_path) - except: - pass + for globbed in glob.glob(str(cleanse_path)): + shutil.rmtree(globbed, ignore_errors=True) + try: + os.unlink(globbed) + except: + pass for to_copy in COPY_TO_ZIP: shutil.copy(BASE_DIR / to_copy, path / to_copy) shutil.copytree(BASE_DIR / "addon_examples", path / "addon_examples")