From e6826b600929a0a29aee7d4ac994434b658d7a09 Mon Sep 17 00:00:00 2001 From: tonquer Date: Tue, 19 Nov 2024 22:43:21 +0800 Subject: [PATCH] update --- .github/workflows/CI.yml | 21 +++++++++++++++------ .github/workflows/release.yml | 16 ++++++++++++---- script/build_universal2.py | 33 +++++++++++++++++++++++++++++++++ src/requirements_macos.txt | 2 +- 4 files changed, 61 insertions(+), 11 deletions(-) create mode 100644 script/build_universal2.py diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 32e2a9d..7e97c20 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -26,7 +26,12 @@ jobs: python -m pip install --upgrade pip pip install pyinstaller pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp36.cp37.cp38.cp39.cp310.cp311.cp312.cp313-none-macosx_10_9_universal2.whl - pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/Pillow-9.1.1-cp310-cp310-macosx_10_10_universal2.whl + cd script + pip install delocate wheel_filename + python build_universal2.py pillow + pip install *.whl + cd .. + pip install -r src/requirements_macos.txt brew install create-dmg - name: Build @@ -78,7 +83,11 @@ jobs: run: | python -m pip install --upgrade pip pip install pyinstaller - pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/Pillow-9.1.1-cp310-cp310-macosx_10_10_universal2.whl + cd script + pip install delocate wheel_filename + python build_universal2.py pillow + pip install *.whl + cd .. pip install -r src/requirements_macos.txt brew install create-dmg - name: Build @@ -129,7 +138,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pyinstaller==4.8 + pip install pyinstaller pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp36.cp37.cp38.cp39.cp310.cp311-none-win_amd64.whl pip install -r src\requirements.txt - name: Build @@ -166,7 +175,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pyinstaller==4.8 + pip install pyinstaller pip install -r src\requirements.txt - name: Build run: | @@ -274,8 +283,8 @@ jobs: run: | sudo apt-get install -y fuse libfuse2 python -m pip install --upgrade pip - pip install pyinstaller==4.8 - pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp37-cp37m-linux_x86_64.whl + pip install pyinstaller + pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp37-abi3-linux_x86_64.whl pip install -r src/requirements.txt - name: Build run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ae5adf6..788d120 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -59,7 +59,11 @@ jobs: python -m pip install --upgrade pip pip install pyinstaller pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp36.cp37.cp38.cp39.cp310.cp311.cp312.cp313-none-macosx_10_9_universal2.whl - pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/Pillow-9.1.1-cp310-cp310-macosx_10_10_universal2.whl + cd script + pip install delocate wheel_filename + python build_universal2.py pillow + pip install *.whl + cd .. pip install -r src/requirements_macos.txt brew install create-dmg - name: Build @@ -119,7 +123,11 @@ jobs: python -m pip install --upgrade pip pip install pyinstaller # pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp36.cp37.cp38.cp39.cp310.cp311.cp312.cp313-none-macosx_10_9_universal2.whl - pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/Pillow-9.1.1-cp310-cp310-macosx_10_10_universal2.whl + cd script + pip install delocate wheel_filename + python build_universal2.py pillow + pip install *.whl + cd .. pip install -r src/requirements_macos.txt brew install create-dmg - name: Build @@ -177,7 +185,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pyinstaller==4.8 + pip install pyinstaller pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp36.cp37.cp38.cp39.cp310.cp311-none-win_amd64.whl pip install -r src\requirements.txt Invoke-WebRequest -Uri "https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-win64.zip" -OutFile "upx.zip" @@ -226,7 +234,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pyinstaller==4.8 + pip install pyinstaller pip install -r src\requirements.txt Invoke-WebRequest -Uri "https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-win64.zip" -OutFile "upx.zip" Expand-Archive -Path "upx.zip" -DestinationPath "D:\" diff --git a/script/build_universal2.py b/script/build_universal2.py new file mode 100644 index 0000000..10bdf90 --- /dev/null +++ b/script/build_universal2.py @@ -0,0 +1,33 @@ +import tempfile +import subprocess +import glob +import os +import sys +from wheel_filename import parse_wheel_filename +from delocate import fuse + + +cwd = "." +class Universal2Bundler: + + def build(self, dest_dir, package): + with tempfile.TemporaryDirectory() as tmp_dir: + + amd64_binary = "macosx_10_10_x86_64" + arm64_binary = "macosx_11_0_arm64" + subprocess.check_call(['python', '-m', 'pip', 'download', '--only-binary=:all:','--no-deps','--platform', amd64_binary, package, '-d', tmp_dir]) + subprocess.check_call(['python', '-m', 'pip', 'download', '--only-binary=:all:','--no-deps','--platform', arm64_binary, package, '-d', tmp_dir]) + universal_wheels = glob.glob("{0}/*".format(tmp_dir)) + + wheel = parse_wheel_filename(universal_wheels[0]) + universal2_wheel = os.path.join(dest_dir, "{0}-{1}-{2}-{3}-macosx_10_10_universal2.whl".format(package, wheel.version, wheel.python_tags[0], wheel.abi_tags[0])) + fuse.fuse_wheels(*universal_wheels, universal2_wheel) + print("Successfully created universal2 wheel ", universal2_wheel) +# python3 -m pip download --only-binary=:all: --platform macosx_10_10_x86_64 Pillow +# python3 -m pip download --only-binary=:all: --platform macosx_11_0_arm64 Pillow +name = sys.argv[1] +bundler = Universal2Bundler() +#bundler.build(cwd, "pillow") +#bundler.build(cwd, "cffi") +#bundler.build(cwd, "curl_cffi") +bundler.build(cwd, name) \ No newline at end of file diff --git a/src/requirements_macos.txt b/src/requirements_macos.txt index bbf8e20..e21fc75 100644 --- a/src/requirements_macos.txt +++ b/src/requirements_macos.txt @@ -2,7 +2,7 @@ PySide6==6.4.3 websocket-client==0.59.0 requests==2.26.0 urllib3==1.25.11 -pillow==9.1.1 +pillow Pysocks==1.7.1 natsort==8.2.0 webdavclient3==3.14.6