From a34adb987f7c7ce28d35d8115415ebf652be9c42 Mon Sep 17 00:00:00 2001 From: Andrey Nikiforov Date: Thu, 21 Dec 2023 23:30:33 -0800 Subject: [PATCH] fix modulenotfound #748 (#750) --- .github/workflows/quality-checks.yml | 148 ++++++++++++++++++++++++++- CHANGELOG.md | 2 + pyproject.toml | 5 +- scripts/build_bin_linux | 2 +- scripts/build_bin_macos | 2 +- scripts/build_bin_windows | 2 +- scripts/build_binary_dist_linux | 4 +- scripts/build_binary_dist_windows | 2 +- src/icloudpd/base.py | 3 + src/starters/icloudpd.py | 15 ++- 10 files changed, 163 insertions(+), 22 deletions(-) diff --git a/.github/workflows/quality-checks.yml b/.github/workflows/quality-checks.yml index 44d382d9c..6c3638727 100644 --- a/.github/workflows/quality-checks.yml +++ b/.github/workflows/quality-checks.yml @@ -33,7 +33,7 @@ jobs: scripts/lint type_check: - runs-on: ubuntu-20.04 + runs-on: ubuntu-20.04 strategy: matrix: python-version: [3.8, 3.9, '3.10', 3.11, 3.12] @@ -52,7 +52,7 @@ jobs: scripts/type_check test: - runs-on: ubuntu-20.04 + runs-on: ubuntu-20.04 strategy: matrix: python-version: [3.8, 3.9, '3.10', 3.11, 3.12] @@ -94,7 +94,7 @@ jobs: icloudpd_changelog: ${{steps.get_version.outputs.icloudpd_changelog}} build_src: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 needs: [get_version] defaults: run: @@ -125,6 +125,8 @@ jobs: dist/icloud*.whl build_linux: + # run on earliest possible linux for better compatibility + # ubuntu 20.04 has glibc 2.31 -> manylinux_2_31 runs-on: ubuntu-20.04 needs: [get_version] defaults: @@ -160,6 +162,7 @@ jobs: dist/icloud* build_macos: + # earliest possible mac for better compatibility runs-on: macos-11 needs: [get_version] defaults: @@ -195,6 +198,7 @@ jobs: dist/icloud* build_windows: + # earliest possible mac for better compatibility runs-on: windows-2019 needs: [get_version] defaults: @@ -261,7 +265,7 @@ jobs: build_npm: runs-on: ubuntu-22.04 - needs: [get_version,build_src,build_linux,build_macos,build_windows] + needs: [get_version,build_linux,build_macos,build_windows] steps: - name: Checkout code uses: actions/checkout@v3 @@ -292,3 +296,139 @@ jobs: npm publish dist/npm/icloudpd --access public --dry-run=true env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + validate_linux_bin_whl: + strategy: + matrix: + os: [ubuntu-20.04, ubuntu-22.04] + runs-on: ${{ matrix.os }} + needs: [get_version,build_linux] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python 3.12 + uses: actions/setup-python@v4 + with: + python-version: '3.12' + + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-artifacts + path: | + dist + + - name: Install Python Binary Wheel + run: | + pip install dist/icloudpd-${{needs.get_version.outputs.icloudpd_version}}-py2.py3-none-manylinux_2_31_x86_64.whl + + - name: Run icloud + run: | + icloud --help + + - name: Run icloudpd + run: | + icloudpd --version + + validate_macos_bin_whl: + strategy: + matrix: + os: [macos-11, macos-12] + runs-on: ${{ matrix.os }} + needs: [get_version,build_macos] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python 3.12 + uses: actions/setup-python@v4 + with: + python-version: '3.12' + + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-artifacts + path: | + dist + + - name: Install Python Binary Wheel + run: | + pip install dist/icloudpd-${{needs.get_version.outputs.icloudpd_version}}-py2.py3-none-macosx_11_0_x86_64.macosx_11_0_arm64.whl + + - name: Run icloud + run: | + icloud --help + + - name: Run icloudpd + run: | + icloudpd --version + + validate_windows_bin_whl: + strategy: + matrix: + os: [windows-2019, windows-2022] + runs-on: ${{ matrix.os }} + needs: [get_version,build_windows] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python 3.12 + uses: actions/setup-python@v4 + with: + python-version: '3.12' + + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-artifacts + path: | + dist + + - name: Install Python Binary Wheel + run: | + pip install dist/icloudpd-${{needs.get_version.outputs.icloudpd_version}}-py2.py3-none-win_amd64.whl + + - name: Run icloud + run: | + icloud --help + + - name: Run icloudpd + run: | + icloudpd --version + + validate_src_whl: + strategy: + matrix: + os: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12, windows-2019, windows-2022] + runs-on: ${{ matrix.os }} + needs: [get_version,build_src] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python 3.12 + uses: actions/setup-python@v4 + with: + python-version: '3.12' + + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-artifacts + path: | + dist + + - name: Install Python Source Wheel + run: | + pip install dist/icloudpd-${{needs.get_version.outputs.icloudpd_version}}-py3-none-any.whl + + - name: Run icloud + run: | + icloud --help + + - name: Run icloudpd + run: | + icloudpd --version diff --git a/CHANGELOG.md b/CHANGELOG.md index 268da5c90..9cf6ae29a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- fix: module not found [#748](https://github.com/icloud-photos-downloader/icloud_photos_downloader/issues/748) + ## 1.17.1 (2023-12-20) - fix: main macos binary failing [#668](https://github.com/icloud-photos-downloader/icloud_photos_downloader/issues/668) [#700](https://github.com/icloud-photos-downloader/icloud_photos_downloader/issues/700) diff --git a/pyproject.toml b/pyproject.toml index 6c8141b47..5308498f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,9 +71,8 @@ test = [ Homepage="https://github.com/icloud-photos-downloader/icloud_photos_downloader" [project.scripts] -icloudpd = "starters.icloudpd:main" -icloud = "starters.icloud:main" -icloudpd_ex = "starters.icloudpd_ex:main" +icloudpd = "icloudpd.base:main" +icloud = "pyicloud_ipd.cmdline:main" [tool.pytest.ini_options] log_format = "%(levelname)-8s %(message)s" diff --git a/scripts/build_bin_linux b/scripts/build_bin_linux index 02085a3c4..3f65f7eb1 100755 --- a/scripts/build_bin_linux +++ b/scripts/build_bin_linux @@ -3,7 +3,7 @@ set -euo pipefail # prepare npm packages in dist # expects dist to have comipled binary versions -# required param: version +# required params: version arch pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile src/starters/icloudpd.py src/starters/icloud.py --name icloudpd-$1-linux-$2 pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile src/starters/icloud.py --name icloud-$1-linux-$2 diff --git a/scripts/build_bin_macos b/scripts/build_bin_macos index 99a4c5a66..ff7f77040 100755 --- a/scripts/build_bin_macos +++ b/scripts/build_bin_macos @@ -3,7 +3,7 @@ set -euo pipefail # prepare npm packages in dist # expects dist to have comipled binary versions -# required param: version +# required params: version arch pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile src/starters/icloudpd.py src/starters/icloud.py --name icloudpd-$1-macos-$2 pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile src/starters/icloud.py --name icloud-$1-macos-$2 diff --git a/scripts/build_bin_windows b/scripts/build_bin_windows index 65e7b30c4..b0b26fd4d 100755 --- a/scripts/build_bin_windows +++ b/scripts/build_bin_windows @@ -3,7 +3,7 @@ set -euo pipefail # prepare bin packages in dist # expects python with installed dependencies -# required param: version +# required param: version arch pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile src/starters/icloudpd.py src/starters/icloud.py --name icloudpd-$1-windows-$2 pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile src/starters/icloud.py --name icloud-$1-windows-$2 diff --git a/scripts/build_binary_dist_linux b/scripts/build_binary_dist_linux index fb18807ff..99803676a 100755 --- a/scripts/build_binary_dist_linux +++ b/scripts/build_binary_dist_linux @@ -17,7 +17,7 @@ cp dist/icloudpd-$1-linux-amd64 dist/binary_dist/src/icloudpd/icloudpd cp dist/icloud-$1-linux-amd64 dist/binary_dist/src/icloud/icloud python3 -m pip wheel dist/binary_dist/ -w dist/binary_dist --no-deps --no-build-isolation -mv -f dist/binary_dist/icloudpd-$1-py2.py3-none-any.whl dist/icloudpd-$1-py2.py3-none-manylinux_2_17_x86_64.whl +mv -f dist/binary_dist/icloudpd-$1-py2.py3-none-any.whl dist/icloudpd-$1-py2.py3-none-manylinux_2_31_x86_64.whl #audit manylinux -python3 -m auditwheel show dist/icloudpd-$1-py2.py3-none-manylinux_2_17_x86_64.whl +python3 -m auditwheel show dist/icloudpd-$1-py2.py3-none-manylinux_2_31_x86_64.whl diff --git a/scripts/build_binary_dist_windows b/scripts/build_binary_dist_windows index 8037ccd0e..2638b7b07 100755 --- a/scripts/build_binary_dist_windows +++ b/scripts/build_binary_dist_windows @@ -3,7 +3,7 @@ set -euo pipefail # prepare binary wheels in dist # expects dist to have comipled binary versions -# required param: version +# required params: version # https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/#platform-compatibility-tags # clean start diff --git a/src/icloudpd/base.py b/src/icloudpd/base.py index e45c4df67..9c9261146 100644 --- a/src/icloudpd/base.py +++ b/src/icloudpd/base.py @@ -1,6 +1,9 @@ #!/usr/bin/env python """Main script that uses Click to parse command-line arguments""" from __future__ import print_function +from multiprocessing import freeze_support +freeze_support() # fixing tqdm on macos + import os import sys import time diff --git a/src/starters/icloudpd.py b/src/starters/icloudpd.py index 892785ca6..403738fc0 100644 --- a/src/starters/icloudpd.py +++ b/src/starters/icloudpd.py @@ -1,9 +1,6 @@ -#!/usr/bin/env python - -from multiprocessing import freeze_support -freeze_support() # fixing tqdm on macos - -from icloudpd.base import main - -if __name__ == "__main__": - main() +#!/usr/bin/env python + +from icloudpd.base import main + +if __name__ == "__main__": + main()