diff --git a/.github/workflows/package-linux.yml b/.github/workflows/package-linux.yml index 91dcebd1..e8c32db7 100644 --- a/.github/workflows/package-linux.yml +++ b/.github/workflows/package-linux.yml @@ -21,48 +21,70 @@ on: - '.gitignore' - '.dockerignore' +permissions: + contents: write + jobs: - build: - runs-on: ubuntu-22.04 + build-appimage: + name: Build AppImage (${{ matrix.arch }}) + runs-on: ${{ matrix.runs-on }} + + strategy: + matrix: + include: + - runs-on: ubuntu-22.04 + arch: x86_64 + - runs-on: ubuntu-22.04-arm + arch: aarch64 + + container: ghcr.io/pkgforge-dev/archlinux:latest steps: - uses: actions/checkout@v7 - - name: Set up Python - uses: actions/setup-python@v7 - with: - python-version: 3.11 - cache: 'pip' - - name: Install python dependencies + + - name: Prepare container + uses: pkgforge-dev/anylinux-setup-action@v5 + + - name: Install dependencies run: | - sudo apt-get update - sudo apt-get install -y libpng-dev libjpeg-dev p7zip-full p7zip-rar python3-pip squashfs-tools libfuse2 libxcb-cursor0 - python -m pip install --upgrade pip certifi pyinstaller --no-binary pyinstaller - python -m pip install -r requirements.txt - - name: build binary + pacman -Syu --noconfirm + pacman -S --noconfirm python-pip pyside6 qt6ct kvantum lxqt-qtplugin python-natsort python-numpy python-pillow python-psutil python-pymupdf python-requests python-slugify python-setuptools + get-debloated-pkgs --add-common --prefer-nano + + - name: Install kcc run: | - python setup.py build_binary - chmod +x dist/kcc_linux* -# issue with this action, disabled and commented out -# see https://github.com/AppImageCrafters/build-appimage/issues/5 -# see https://appimage-builder.readthedocs.io/en/latest/intro/install.html#install-appimagetool -# - name: Build AppImage -# uses: AppImageCrafters/build-appimage-action@master -# env: -# UPDATE_INFO: gh-releases-zsync|ciromattia|kcc|latest|*x86_64.AppImage.zsync -# with: -# recipe: AppImageBuilder.yml + python -m pip install --break-system-packages . + + - name: Determine version + id: version + run: | + echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" + - name: Build AppImage - run: | - wget -O appimage-builder-x86_64.AppImage https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage - chmod +x appimage-builder-x86_64.AppImage - sudo mv appimage-builder-x86_64.AppImage /usr/local/bin/appimage-builder - appimage-builder --recipe AppImageBuilder.yml --skip-test env: - UPDATE_INFO: gh-releases-zsync|ciromattia|kcc|latest|*x86_64.AppImage.zsync + ARCH: ${{ matrix.arch }} + ICON: ${{ github.workspace }}/icons/comic2ebook.png + DESKTOP: ${{ github.workspace }}/packaging/appimage/kcc.desktop + DEPLOY_PYTHON: 1 + OUTPATH: ${{ github.workspace }}/dist + OUTNAME: kcc_linux-${{ steps.version.outputs.version }}-${{ matrix.arch }}.AppImage + UPINFO: gh-releases-zsync|ciromattia|kcc|latest|*${{ matrix.arch }}.AppImage.zsync + run: | + mkdir -p dist + quick-sharun "$(which kcc)" /usr/lib/libQt6Gui.so* + quick-sharun --make-appimage + + - name: Test AppImage + run: | + quick-sharun --simple-test ./dist/*.AppImage + - name: upload artifact uses: actions/upload-artifact@v7 with: - name: AppImage - path: './*.AppImage*' + name: kcc-${{ steps.version.outputs.version }}-${{ matrix.arch }} + path: | + dist/*.AppImage + dist/*.AppImage.zsync + - name: Release uses: softprops/action-gh-release@v3 if: startsWith(github.ref, 'refs/tags/') @@ -70,5 +92,5 @@ jobs: prerelease: true generate_release_notes: false files: | - LICENSE.txt - *.AppImage* + dist/*.AppImage + dist/*.AppImage.zsync diff --git a/AppImageBuilder.yml b/AppImageBuilder.yml deleted file mode 100644 index 9a04bd37..00000000 --- a/AppImageBuilder.yml +++ /dev/null @@ -1,67 +0,0 @@ -# appimage-builder recipe see https://appimage-builder.readthedocs.io for details -version: 1 -script: - - rm -rf AppDir || true - - mkdir -p AppDir/usr/share/icons/hicolor/64x64/apps/ - - cp -a dist/kcc_linux* AppDir/ && mv AppDir/kcc_linux* AppDir/kcc_linux - - cp icons/comic2ebook.png AppDir/usr/share/icons/hicolor/64x64/apps/ -AppDir: - path: AppDir - app_info: - id: com.github.ciromattia.kcc - name: kindleComicConverter - icon: comic2ebook - version: latest - exec: ./kcc_linux - exec_args: $@ - apt: - arch: - - amd64 - allow_unauthenticated: true - sources: - - sourceline: deb http://archive.ubuntu.com/ubuntu jammy main restricted - - sourceline: deb http://archive.ubuntu.com/ubuntu jammy-updates main restricted - - sourceline: deb http://archive.ubuntu.com/ubuntu jammy universe - - sourceline: deb http://archive.ubuntu.com/ubuntu jammy-updates universe - - sourceline: deb http://archive.ubuntu.com/ubuntu jammy multiverse - - sourceline: deb http://archive.ubuntu.com/ubuntu jammy-updates multiverse - - sourceline: deb http://archive.ubuntu.com/ubuntu jammy-backports main restricted - universe multiverse - - sourceline: deb http://security.ubuntu.com/ubuntu jammy-security main restricted - - sourceline: deb http://security.ubuntu.com/ubuntu jammy-security universe - - sourceline: deb http://security.ubuntu.com/ubuntu jammy-security multiverse - include: - - libc6:amd64 - files: - include: [] - exclude: - - usr/share/man - - usr/share/doc/*/README.* - - usr/share/doc/*/changelog.* - - usr/share/doc/*/NEWS.* - - usr/share/doc/*/TODO.* - test: - fedora-30: - image: appimagecrafters/tests-env:fedora-30 - command: ./AppRun - use_host_x: true - debian-stable: - image: appimagecrafters/tests-env:debian-stable - command: ./AppRun - use_host_x: true - archlinux-latest: - image: appimagecrafters/tests-env:archlinux-latest - command: ./AppRun - use_host_x: true - centos-7: - image: appimagecrafters/tests-env:centos-7 - command: ./AppRun - use_host_x: true - ubuntu-xenial: - image: appimagecrafters/tests-env:ubuntu-xenial - command: ./AppRun - use_host_x: true -AppImage: - arch: x86_64 - update-information: !ENV ${UPDATE_INFO} - sign-key: None \ No newline at end of file diff --git a/application-vnd.appimage.svg b/application-vnd.appimage.svg deleted file mode 100644 index 83ac5658..00000000 --- a/application-vnd.appimage.svg +++ /dev/null @@ -1,320 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - diff --git a/packaging/appimage/kcc.desktop b/packaging/appimage/kcc.desktop new file mode 100644 index 00000000..ce1abe42 --- /dev/null +++ b/packaging/appimage/kcc.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Name=kcc +Comment=Optimize comics/manga for eink +Exec=kcc +Icon=comic2ebook +Type=Application +Terminal=false diff --git a/requirements.txt b/requirements.txt index e7c867f2..d706bba2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ -PySide6<6.10 +PySide6; platform_system == 'Linux' +PySide6<6.10; platform_system != 'Linux' Pillow>=11.3.0 psutil>=7.2.2 requests>=2.34.2 diff --git a/setup.py b/setup.py index 4ab775d1..1f40c266 100644 --- a/setup.py +++ b/setup.py @@ -82,10 +82,8 @@ class BuildC2ECommand(setuptools.Command): elif sys.platform == 'win32': if os.getenv('WINDOWS_7'): os.system('pyinstaller --hidden-import=_cffi_backend -y -F -i icons\\comic2ebook.ico -n kcc_c2e_win7_legacy_' + VERSION + ' -c --noupx kcc-c2e.py') - elif platform.machine() == 'ARM64': - os.system(f'pyinstaller --hidden-import=_cffi_backend -y -F -i icons\\comic2ebook.ico -n kcc_{platform.machine()}_c2e_' + VERSION + ' -c --noupx kcc-c2e.py') else: - os.system('pyinstaller --hidden-import=_cffi_backend -y -F -i icons\\comic2ebook.ico -n kcc_c2e_' + VERSION + ' -c --noupx kcc-c2e.py') + os.system(f'pyinstaller --hidden-import=_cffi_backend -y -F -i icons\\comic2ebook.ico -n tool_cli_c2e_{VERSION}_{platform.machine()} -c --noupx kcc-c2e.py') sys.exit(0) elif sys.platform == 'linux': os.system( @@ -116,10 +114,8 @@ class BuildC2PCommand(setuptools.Command): elif sys.platform == 'win32': if os.getenv('WINDOWS_7'): os.system('pyinstaller --hidden-import=_cffi_backend -y -F -i icons\\comic2ebook.ico -n kcc_c2p_win7_legacy_' + VERSION + ' -c --noupx kcc-c2p.py') - elif platform.machine() == 'ARM64': - os.system(f'pyinstaller --hidden-import=_cffi_backend -y -F -i icons\\comic2ebook.ico -n kcc_{platform.machine()}_c2p_' + VERSION + ' -c --noupx kcc-c2p.py') else: - os.system('pyinstaller --hidden-import=_cffi_backend -y -F -i icons\\comic2ebook.ico -n kcc_c2p_' + VERSION + ' -c --noupx kcc-c2p.py') + os.system(f'pyinstaller --hidden-import=_cffi_backend -y -F -i icons\\comic2ebook.ico -n tool_cli_c2p_{VERSION}_{platform.machine()} -c --noupx kcc-c2p.py') sys.exit(0) elif sys.platform == 'linux': os.system(