From 1f2b597c80000d5ac08e3ca4aacc6e00b07a6c85 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 03:51:55 +0530 Subject: [PATCH 01/27] =?UTF-8?q?=F0=9F=94=A2=20Update=20`nox=20-s=20venv`?= =?UTF-8?q?=20to=20run=20commands=20sequentially?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- noxfile.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/noxfile.py b/noxfile.py index 2a34f87..e805285 100644 --- a/noxfile.py +++ b/noxfile.py @@ -80,8 +80,13 @@ def release(session: nox.Session) -> None: @nox.session(name="venv") def venv(session: nox.Session) -> None: - """Create a virtual environment and install wheels from the dist/ folder into it.""" - for file in DIR.joinpath("dist").glob("*.whl"): + """Create a virtual environment and install wheels from a specified folder into it.""" + if session.interactive: + folder = "dist" + else: + folder = "wheelhouse" + session.log(f"Installing wheels from {folder}") + for file in DIR.joinpath(folder).glob("*.whl"): session.install(file) - session.run("hugo", "version") - session.run("hugo", "env", "--logLevel", "debug") + session.run("hugo", "version") + session.run("hugo", "env", "--logLevel", "debug") From fcdaf9a04ae7441334cf4f0f3e92c237990dddc5 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 04:55:45 +0530 Subject: [PATCH 02/27] =?UTF-8?q?=F0=9F=8E=81=20Add=20`delocate-fuse`=20Py?= =?UTF-8?q?thon=20wrapper=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/ci/tools/fuse_wheels.py | 55 +++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 scripts/ci/tools/fuse_wheels.py diff --git a/scripts/ci/tools/fuse_wheels.py b/scripts/ci/tools/fuse_wheels.py new file mode 100644 index 0000000..9e99d6d --- /dev/null +++ b/scripts/ci/tools/fuse_wheels.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +# A wrapper script over delocate-fuse for creating universal2 wheels +# from x86_64 and arm64 wheels, with basic command-line argument parsing + +# Usage: fuse_wheels.py +# Note: these directories must be created beforehand before running this script. + +import sys +import os +import shutil +import subprocess + +in_dir1 = sys.argv[1] +in_dir2 = sys.argv[2] +out_dir = sys.argv[3] + +def search_wheel_in_dir(package, dir): + for i in os.listdir(dir): + if i.startswith(package): + return i + +def copy_if_universal(wheel_name, in_dir, out_dir): + if wheel_name.endswith('universal2.whl') or wheel_name.endswith('any.whl'): + src_path = os.path.join(in_dir, wheel_name) + dst_path = os.path.join( + out_dir, + wheel_name + .replace('x86_64', 'universal2') + .replace('arm64', 'universal2') + ) + + shutil.copy(src_path, dst_path) + return True + else: + return False + +for wheel_name_1 in os.listdir(in_dir1): + package = wheel_name_1.split('-')[0] + wheel_name_2 = search_wheel_in_dir(package, in_dir2) + if copy_if_universal(wheel_name_1, in_dir1, out_dir): + continue + if copy_if_universal(wheel_name_2, in_dir2, out_dir): + continue + + wheel_path_1 = os.path.join(in_dir1, wheel_name_1) + wheel_path_2 = os.path.join(in_dir2, wheel_name_2) + subprocess.run(['delocate-fuse', wheel_path_1, wheel_path_2, '-w', out_dir]) + +for wheel_name in os.listdir(out_dir): + wheel_name_new = wheel_name.replace('x86_64', 'universal2').replace('arm64', 'universal2') + + src_path = os.path.join(out_dir, wheel_name) + dst_path = os.path.join(out_dir, wheel_name_new) + + os.rename(src_path, dst_path) \ No newline at end of file From d0a2ea4c759da604cf335704cea50aafbca8cb74 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 04:57:05 +0530 Subject: [PATCH 03/27] =?UTF-8?q?=F0=9F=9A=9A=20Write=20various=20jobs=20f?= =?UTF-8?q?or=20continuous=20deployment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See #13 and #2 --- .github/workflows/cd.yml | 260 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 243 insertions(+), 17 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 653cdee..04d791d 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -2,10 +2,10 @@ name: CD on: workflow_dispatch: - # pull_request: - # push: - # branches: - # - main + pull_request: + push: + branches: + - main release: types: - published @@ -16,33 +16,259 @@ concurrency: env: FORCE_COLOR: 3 + CIBW_BUILD_VERBOSITY: 2 + CIBW_BUILD_FRONTEND: 'pip' jobs: - dist: - name: Distribution build + sdist: + name: Build source distribution runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: 3.12 + + - name: Install dependencies + run: | + python -m pip install build + + - name: Build source distribution + run: | + python -m build --sdist --outdir dist/ + + - uses: actions/upload-artifact@v4 + with: + name: source_distribution + path: dist + windows_wheels: + strategy: + fail-fast: false + name: Windows wheels + runs-on: windows-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: hynek/build-and-inspect-python-package@v2 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.8 - publish: - needs: [dist] - name: Publish to PyPI - environment: pypi - permissions: - id-token: write + - name: Set up Go toolchain + uses: actions/setup-go@v5 + with: + go-version: '1.21.x' + cache: false + check-latest: true + + - name: Install MinGW compiler(s) + run: choco install mingw + + - uses: pypa/cibuildwheel@v2.16.2 + with: + package-dir: . + output-dir: wheelhouse + env: + CIBW_TEST_REQUIRES: nox + CIBW_TEST_COMMAND: python -m nox -s venv + + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: windows_wheels + path: ./wheelhouse/*.whl + if-no-files-found: error + + linux_wheels: + strategy: + fail-fast: false + name: Linux wheels runs-on: ubuntu-latest - if: github.event_name == 'release' && github.event.action == 'published' + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.8 + + - name: Set up Go toolchain + uses: actions/setup-go@v5 + with: + go-version: '1.21.x' + cache: false + check-latest: true + + - name: Install GCC + run: sudo apt-get install gcc + - uses: pypa/cibuildwheel@v2.16.2 + with: + package-dir: . + output-dir: wheelhouse + env: + CIBW_REPAIR_WHEEL_COMMAND_LINUX: '' + CIBW_TEST_REQUIRES: nox + CIBW_TEST_COMMAND: python -m nox -s venv + + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: linux_wheels + path: ./wheelhouse/*.whl + if-no-files-found: error + + macos_x86_64_wheels: + strategy: + fail-fast: false + name: macOS wheels (x86_64) + runs-on: macos-latest steps: - - uses: actions/download-artifact@v4 + - uses: actions/checkout@v4 with: - name: Packages - path: dist + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.8 + + - name: Set up Go toolchain + uses: actions/setup-go@v5 + with: + go-version: '1.21.x' + cache: false + check-latest: true + + - uses: pypa/cibuildwheel@v2.16.2 + with: + package-dir: . + output-dir: wheelhouse + env: + CIBW_ARCHS_MACOS: x86_64 + CIBW_REPAIR_WHEEL_COMMAND_MACOS: '' + CIBW_TEST_REQUIRES: nox + CIBW_TEST_COMMAND: python -m nox -s venv + + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: macos_x86_64_wheels + path: ./wheelhouse/*.whl + if-no-files-found: error + + macos_arm64_wheels: + strategy: + fail-fast: false + name: macOS wheels (arm64) + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.8 + + - name: Set up Go toolchain + uses: actions/setup-go@v5 + with: + go-version: '1.21.x' + cache: false + check-latest: true + + - uses: pypa/cibuildwheel@v2.16.2 + with: + package-dir: . + output-dir: wheelhouse + env: + CIBW_ARCHS_MACOS: arm64 + # These are needed to build arm64 binaries on x86_64 macOS + CIBW_ENVIRONMENT_MACOS: > + GOARCH="arm64" + CIBW_REPAIR_WHEEL_COMMAND_MACOS: '' + CIBW_TEST_REQUIRES: nox + CIBW_TEST_COMMAND: python -m nox -s venv + + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: macos_arm64_wheels + path: ./wheelhouse/*.whl + if-no-files-found: error + + combined_macos_wheels: + name: Combine macOS wheels + runs-on: macos-latest + needs: [macos_x86_64_wheels, macos_arm64_wheels] + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Download macOS wheels + uses: actions/download-artifact@v4 + with: + name: macos_x86_64_wheels + path: macos_x86_64_wheels + + - name: Download macOS wheels + uses: actions/download-artifact@v4 + with: + name: macos_arm64_wheels + path: macos_arm64_wheels + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.12 + + - name: Combine macOS wheels + run: | + mkdir wheelhouse_arm64 + mkdir wheelhouse_x86_64 + mkdir wheelhouse_universal2 + cp macos_x86_64_wheels/*.whl wheelhouse_x86_64/ + cp macos_arm64_wheels/*.whl wheelhouse_arm64/ + python -m pip install delocate + python scripts/ci/tools/fuse_wheels.py ./wheelhouse_x86_64 ./wheelhouse_arm64 ./wheelhouse_universal2 + + - name: Upload combined macOS wheels + uses: actions/upload-artifact@v4 + with: + name: combined_macos_wheels + path: ./wheelhouse_universal2/*.whl + if-no-files-found: error + + publish: + needs: [sdist, windows_wheels, linux_wheels, combined_macos_wheels] + name: Publish to PyPI or TestPyPI + # environment: release + # permissions: + # id-token: write + runs-on: ubuntu-latest + # if: github.event_name == 'release' && github.event.action == 'published' + + steps: + - name: Download all artifacts + uses: actions/download-artifact@v4 + + - name: Move all artifacts to upload directory + run: | + mkdir upload + mv sdist windows_wheels/* linux_wheels/* combined_macos_wheels/* upload/ - uses: pypa/gh-action-pypi-publish@release/v1 if: github.event_name == 'release' && github.event.action == 'published' From 3f7b22fdd8f738000d274681b7e663b9dc77b419 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 04:57:47 +0530 Subject: [PATCH 04/27] =?UTF-8?q?=F0=9F=8F=98=EF=B8=8F=20Rename=20`build`?= =?UTF-8?q?=20frontend=20path=20to=20`wheelhouse/`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4837d2e..1854dbd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,7 @@ jobs: - name: Build binary distribution (wheel) run: | - python -m build --wheel . --outdir dist/ + python -m build --wheel . --outdir wheelhouse/ - name: Save Hugo builder cache uses: actions/cache/save@v3 From f803a5fb177788988c83846a73295f5bca51df6f Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 05:10:46 +0530 Subject: [PATCH 05/27] =?UTF-8?q?=F0=9F=9A=A7=20Update=20`CIBW=5FTEST=5FCO?= =?UTF-8?q?MMAND`=20to=20include=20entry=20point?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 04d791d..67b3187 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -77,8 +77,9 @@ jobs: package-dir: . output-dir: wheelhouse env: - CIBW_TEST_REQUIRES: nox - CIBW_TEST_COMMAND: python -m nox -s venv + CIBW_TEST_COMMAND: > + hugo version + hugo env --logLevel debug - name: Upload wheels uses: actions/upload-artifact@v4 @@ -118,8 +119,9 @@ jobs: output-dir: wheelhouse env: CIBW_REPAIR_WHEEL_COMMAND_LINUX: '' - CIBW_TEST_REQUIRES: nox - CIBW_TEST_COMMAND: python -m nox -s venv + CIBW_TEST_COMMAND: > + hugo version + hugo env --logLevel debug - name: Upload wheels uses: actions/upload-artifact@v4 @@ -157,8 +159,9 @@ jobs: env: CIBW_ARCHS_MACOS: x86_64 CIBW_REPAIR_WHEEL_COMMAND_MACOS: '' - CIBW_TEST_REQUIRES: nox - CIBW_TEST_COMMAND: python -m nox -s venv + CIBW_TEST_COMMAND: > + hugo version + hugo env --logLevel debug - name: Upload wheels uses: actions/upload-artifact@v4 @@ -199,8 +202,9 @@ jobs: CIBW_ENVIRONMENT_MACOS: > GOARCH="arm64" CIBW_REPAIR_WHEEL_COMMAND_MACOS: '' - CIBW_TEST_REQUIRES: nox - CIBW_TEST_COMMAND: python -m nox -s venv + CIBW_TEST_COMMAND: > + hugo version + hugo env --logLevel debug - name: Upload wheels uses: actions/upload-artifact@v4 From e25736e24a0a7e2ae4bf83a40159e466ca225d73 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 14:44:59 +0530 Subject: [PATCH 06/27] =?UTF-8?q?=F0=9F=96=A8=EF=B8=8F=20Display=20Hugo=20?= =?UTF-8?q?version=20and=20caller=20path=20at=20runtime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python_hugo/cli.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python_hugo/cli.py b/python_hugo/cli.py index b61ac9e..b65fcfe 100644 --- a/python_hugo/cli.py +++ b/python_hugo/cli.py @@ -26,7 +26,6 @@ "aarch64": "arm64", }[platform.machine()] - @lru_cache(maxsize=1) def hugo_executable(): """ @@ -38,9 +37,12 @@ def hugo_executable(): f"hugo-{HUGO_VERSION}-{HUGO_PLATFORM}-{HUGO_ARCH}" + FILE_EXT, ) +MESSAGE = f"Running Hugo {HUGO_VERSION} via python-hugo at {hugo_executable()}" def __call(): """ Hugo binary entry point. Passes all command-line arguments to Hugo. """ + # send to stdout a message that we are using the python-hugo wrapper + print(MESSAGE) os.execvp(hugo_executable(), ["hugo", *sys.argv[1:]]) From 1731f508722ec141bff360898c972a5573e99c4a Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 14:45:21 +0530 Subject: [PATCH 07/27] =?UTF-8?q?=E2=8F=A9=20Skip=20PyPy=20and=20MUSL=20wh?= =?UTF-8?q?eel=20builds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 67b3187..498bde8 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -18,6 +18,7 @@ env: FORCE_COLOR: 3 CIBW_BUILD_VERBOSITY: 2 CIBW_BUILD_FRONTEND: 'pip' + CIBW_SKIP: "pp* *musllinux*" jobs: sdist: @@ -222,17 +223,8 @@ jobs: with: fetch-depth: 0 - - name: Download macOS wheels + - name: Download macOS wheels for both architectures uses: actions/download-artifact@v4 - with: - name: macos_x86_64_wheels - path: macos_x86_64_wheels - - - name: Download macOS wheels - uses: actions/download-artifact@v4 - with: - name: macos_arm64_wheels - path: macos_arm64_wheels - name: Set up Python uses: actions/setup-python@v5 From 1152a7284bed5ab9d4d0e5e7b51a622da3b21a27 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 14:52:35 +0530 Subject: [PATCH 08/27] =?UTF-8?q?=F0=9F=8E=BE=20Fetch=20latest=20Go=20for?= =?UTF-8?q?=20manylinux2014=20containers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 498bde8..59808ff 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -104,13 +104,6 @@ jobs: with: python-version: 3.8 - - name: Set up Go toolchain - uses: actions/setup-go@v5 - with: - go-version: '1.21.x' - cache: false - check-latest: true - - name: Install GCC run: sudo apt-get install gcc @@ -119,6 +112,10 @@ jobs: package-dir: . output-dir: wheelhouse env: + CIBW_BEFORE_ALL_LINUX: > + sudo add-apt-repository ppa:longsleep/golang-backports + sudo apt-get update + sudo apt-get install golang-go CIBW_REPAIR_WHEEL_COMMAND_LINUX: '' CIBW_TEST_COMMAND: > hugo version From 67f4197f5241a25b72fdca1fdb100eda7799eb65 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 15:03:32 +0530 Subject: [PATCH 09/27] =?UTF-8?q?=F0=9F=95=B4=EF=B8=8F=20Don't=20run=20`su?= =?UTF-8?q?do`=20inside=20the=20container?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 59808ff..bd0b122 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -113,9 +113,9 @@ jobs: output-dir: wheelhouse env: CIBW_BEFORE_ALL_LINUX: > - sudo add-apt-repository ppa:longsleep/golang-backports - sudo apt-get update - sudo apt-get install golang-go + add-apt-repository ppa:longsleep/golang-backports + apt-get update + apt-get install golang-go CIBW_REPAIR_WHEEL_COMMAND_LINUX: '' CIBW_TEST_COMMAND: > hugo version From 8060169bd9ca6e324c8b15aedf0a980d796e556b Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 15:15:06 +0530 Subject: [PATCH 10/27] =?UTF-8?q?=F0=9F=98=8B=20Use=20`yum`=20and=20Google?= =?UTF-8?q?=20FTP=20servers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index bd0b122..42d4aa4 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -113,9 +113,11 @@ jobs: output-dir: wheelhouse env: CIBW_BEFORE_ALL_LINUX: > - add-apt-repository ppa:longsleep/golang-backports - apt-get update - apt-get install golang-go + yum install wget && + wget https://golang.org/dl/go1.21.5.linux-amd64.tar.gz && + rm -rf usr/local/go && tar -C usr/local -xzf go1.21.5.linux-amd64.tar.gz && + export PATH="/usr/local/go/bin:$PATH" && + go version CIBW_REPAIR_WHEEL_COMMAND_LINUX: '' CIBW_TEST_COMMAND: > hugo version From 1bb7a586a2aaf4e30eccb6dca7d37047c85718c8 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 16:34:32 +0530 Subject: [PATCH 11/27] =?UTF-8?q?=F0=9F=8F=9B=EF=B8=8F=20Specify=20just=20?= =?UTF-8?q?`amd64`=20architecture=20for=20Linux=20for=20now?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 42d4aa4..e183088 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -112,6 +112,7 @@ jobs: package-dir: . output-dir: wheelhouse env: + CIBW_ARCHS_LINUX: x86_64 CIBW_BEFORE_ALL_LINUX: > yum install wget && wget https://golang.org/dl/go1.21.5.linux-amd64.tar.gz && From 64e74a2a99fe1835872abcbcfce227df745e6653 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 17:03:53 +0530 Subject: [PATCH 12/27] =?UTF-8?q?=F0=9F=8F=B0=20Don't=20build=2032-bit=20W?= =?UTF-8?q?indows=20wheels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index e183088..9bdf98c 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -78,6 +78,7 @@ jobs: package-dir: . output-dir: wheelhouse env: + CIBW_ARCHS_WINDOWS: AMD64 CIBW_TEST_COMMAND: > hugo version hugo env --logLevel debug From bb67137d6478fa018a320de025208698c2e38d3f Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 17:15:46 +0530 Subject: [PATCH 13/27] =?UTF-8?q?=F0=9F=8E=99=EF=B8=8F=20Non-interactive?= =?UTF-8?q?=20`yum`=20command=20invocation=20and=20user=20directory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 9bdf98c..56f09e8 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -115,10 +115,11 @@ jobs: env: CIBW_ARCHS_LINUX: x86_64 CIBW_BEFORE_ALL_LINUX: > - yum install wget && + yum install -y wget && wget https://golang.org/dl/go1.21.5.linux-amd64.tar.gz && - rm -rf usr/local/go && tar -C usr/local -xzf go1.21.5.linux-amd64.tar.gz && - export PATH="/usr/local/go/bin:$PATH" && + rm -rf $HOME/.local/go/ && + tar -C $HOME/.local/ -xzf go1.21.5.linux-amd64.tar.gz && + export PATH="$HOME/.local/go/bin:$PATH" && go version CIBW_REPAIR_WHEEL_COMMAND_LINUX: '' CIBW_TEST_COMMAND: > From 6c8e00a5cb435f5e0d9558a0a12fbac8337e0499 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 17:52:20 +0530 Subject: [PATCH 14/27] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Install=20Golang=20t?= =?UTF-8?q?o=20separate=20`go=5Finstalled/`=20folder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 56f09e8..cb8c201 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -117,9 +117,9 @@ jobs: CIBW_BEFORE_ALL_LINUX: > yum install -y wget && wget https://golang.org/dl/go1.21.5.linux-amd64.tar.gz && - rm -rf $HOME/.local/go/ && - tar -C $HOME/.local/ -xzf go1.21.5.linux-amd64.tar.gz && - export PATH="$HOME/.local/go/bin:$PATH" && + mkdir go_installed && + tar -C go_installed/ -xzf go1.21.5.linux-amd64.tar.gz && + export PATH="go_installed/go/bin:$PATH" && go version CIBW_REPAIR_WHEEL_COMMAND_LINUX: '' CIBW_TEST_COMMAND: > From c68392c65492e34a8cec6f257a848d73811138b5 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 17:58:01 +0530 Subject: [PATCH 15/27] =?UTF-8?q?=F0=9F=9B=A4=EF=B8=8F=20Pass=20PATH=20env?= =?UTF-8?q?ironment=20variables=20to=20build=20container?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index cb8c201..86d9749 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -117,10 +117,11 @@ jobs: CIBW_BEFORE_ALL_LINUX: > yum install -y wget && wget https://golang.org/dl/go1.21.5.linux-amd64.tar.gz && - mkdir go_installed && - tar -C go_installed/ -xzf go1.21.5.linux-amd64.tar.gz && - export PATH="go_installed/go/bin:$PATH" && + mkdir $HOME/go_installed && + tar -C $HOME/go_installed/ -xzf go1.21.5.linux-amd64.tar.gz && + export PATH="$HOME/go_installed/go/bin:$PATH" && go version + CIBW_ENVIRONMENT_LINUX: PATH=$PATH:$HOME/go_installed/go/bin CIBW_REPAIR_WHEEL_COMMAND_LINUX: '' CIBW_TEST_COMMAND: > hugo version From 24108e6fa45f58a55113a2ca789f7c5c4b0d859a Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 18:27:27 +0530 Subject: [PATCH 16/27] =?UTF-8?q?=F0=9F=94=80=20Move=20helper=20scripts,?= =?UTF-8?q?=20platform-wise?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/ci/tools/{ => macos}/fuse_wheels.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/ci/tools/{ => macos}/fuse_wheels.py (100%) diff --git a/scripts/ci/tools/fuse_wheels.py b/scripts/ci/tools/macos/fuse_wheels.py similarity index 100% rename from scripts/ci/tools/fuse_wheels.py rename to scripts/ci/tools/macos/fuse_wheels.py From b3d72d07ac948a453042cd7bd6b3f89a0da9fa15 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 18:29:16 +0530 Subject: [PATCH 17/27] =?UTF-8?q?=F0=9F=93=9D=20Bash=20script=20to=20insta?= =?UTF-8?q?ll=20Golang=20per=20architecture?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/ci/tools/linux/install_go.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 scripts/ci/tools/linux/install_go.sh diff --git a/scripts/ci/tools/linux/install_go.sh b/scripts/ci/tools/linux/install_go.sh new file mode 100644 index 0000000..8d7b313 --- /dev/null +++ b/scripts/ci/tools/linux/install_go.sh @@ -0,0 +1,22 @@ +# !#/bin/bash + +# Small script to install Golang into a PyPA manylinux2014 Docker container + +yum install -y wget + +arch=$(uname -m) + +if [ "$arch" == "x86_64" ]; then + tarball="go1.21.5.linux-amd64.tar.gz" +elif [[ "$arch" == "aarch64" || "$arch" == "arm64" ]]; then + tarball="go1.21.5.linux-arm64.tar.gz" +else + echo "Unsupported architecture: $arch" + exit 1 + +wget https://golang.org/dl/$tarball +mkdir $HOME/go_installed/ +tar -C $HOME/go_installed/ -xzf $tarball +export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bashrc +export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bash_profile +go version From 05543b06bdd679a72f1eace64000784e4f40fa1d Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 18:36:22 +0530 Subject: [PATCH 18/27] =?UTF-8?q?=F0=9F=8E=A9=20Set=20up=20QEMU=20for=20Li?= =?UTF-8?q?nux=20aarch64/arm64=20wheels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 53 ++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 86d9749..f532ef2 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -90,7 +90,7 @@ jobs: path: ./wheelhouse/*.whl if-no-files-found: error - linux_wheels: + linux_amd64_wheels: strategy: fail-fast: false name: Linux wheels @@ -105,9 +105,6 @@ jobs: with: python-version: 3.8 - - name: Install GCC - run: sudo apt-get install gcc - - uses: pypa/cibuildwheel@v2.16.2 with: package-dir: . @@ -130,7 +127,47 @@ jobs: - name: Upload wheels uses: actions/upload-artifact@v4 with: - name: linux_wheels + name: linux_amd64_wheels + path: ./wheelhouse/*.whl + if-no-files-found: error + + linux_aarch64_wheels: + strategy: + fail-fast: false + name: Linux wheels (arm64) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.8 + + - name: Set up QEMU for emulation + uses: docker/setup-qemu-action@v3 + with: + platforms: all + + - uses: pypa/cibuildwheel@v2.16.2 + with: + package-dir: . + output-dir: wheelhouse + env: + CIBW_ARCHS_LINUX: aarch64 + CIBW_BEFORE_ALL_LINUX: bash scripts/ci/tools/linux/install_go.sh + CIBW_ENVIRONMENT_LINUX: PATH=$PATH:$HOME/go_installed/go/bin + CIBW_REPAIR_WHEEL_COMMAND_LINUX: '' + CIBW_TEST_COMMAND: > + hugo version + hugo env --logLevel debug + + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: linux_aarch64_wheels path: ./wheelhouse/*.whl if-no-files-found: error @@ -242,7 +279,7 @@ jobs: cp macos_x86_64_wheels/*.whl wheelhouse_x86_64/ cp macos_arm64_wheels/*.whl wheelhouse_arm64/ python -m pip install delocate - python scripts/ci/tools/fuse_wheels.py ./wheelhouse_x86_64 ./wheelhouse_arm64 ./wheelhouse_universal2 + python scripts/ci/tools/macos/fuse_wheels.py ./wheelhouse_x86_64 ./wheelhouse_arm64 ./wheelhouse_universal2 - name: Upload combined macOS wheels uses: actions/upload-artifact@v4 @@ -252,7 +289,7 @@ jobs: if-no-files-found: error publish: - needs: [sdist, windows_wheels, linux_wheels, combined_macos_wheels] + needs: [sdist, windows_wheels, linux_amd64_wheels, linux_aarch64_wheels, combined_macos_wheels] name: Publish to PyPI or TestPyPI # environment: release # permissions: @@ -267,7 +304,7 @@ jobs: - name: Move all artifacts to upload directory run: | mkdir upload - mv sdist windows_wheels/* linux_wheels/* combined_macos_wheels/* upload/ + mv sdist windows_wheels/* linux_amd64_wheels/* linux_aarch64_wheels/* combined_macos_wheels/* upload/ - uses: pypa/gh-action-pypi-publish@release/v1 if: github.event_name == 'release' && github.event.action == 'published' From 6c85d5e3e88372dbd751c3db1d1b1b36aa22cff1 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 18:38:01 +0530 Subject: [PATCH 19/27] =?UTF-8?q?=F0=9F=9B=A3=EF=B8=8F=20Rename=20artifact?= =?UTF-8?q?=20paths=20to=20check=20for?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index f532ef2..690116c 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -304,7 +304,7 @@ jobs: - name: Move all artifacts to upload directory run: | mkdir upload - mv sdist windows_wheels/* linux_amd64_wheels/* linux_aarch64_wheels/* combined_macos_wheels/* upload/ + mv source_distribution/* windows_wheels/* linux_amd64_wheels/* linux_aarch64_wheels/* combined_macos_wheels/* upload/ - uses: pypa/gh-action-pypi-publish@release/v1 if: github.event_name == 'release' && github.event.action == 'published' From bcad937d4bd71084f0de9af796fcfdf93b1676d1 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 18:39:45 +0530 Subject: [PATCH 20/27] =?UTF-8?q?=F0=9F=9A=A7=20Rename=20jobs=20to=20refle?= =?UTF-8?q?ct=20built=20architecture?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 690116c..b5ec497 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -93,7 +93,7 @@ jobs: linux_amd64_wheels: strategy: fail-fast: false - name: Linux wheels + name: Linux wheels (amd64) runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -134,7 +134,7 @@ jobs: linux_aarch64_wheels: strategy: fail-fast: false - name: Linux wheels (arm64) + name: Linux wheels (aarch64) runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From 4b386d3fafe65da4088a579f0a3672d8529f071e Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 18:41:45 +0530 Subject: [PATCH 21/27] =?UTF-8?q?=F0=9F=90=9B=20Fix=20EOF-bug=20for=20Gola?= =?UTF-8?q?ng=20installation=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/ci/tools/linux/install_go.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ci/tools/linux/install_go.sh b/scripts/ci/tools/linux/install_go.sh index 8d7b313..6513900 100644 --- a/scripts/ci/tools/linux/install_go.sh +++ b/scripts/ci/tools/linux/install_go.sh @@ -13,6 +13,7 @@ elif [[ "$arch" == "aarch64" || "$arch" == "arm64" ]]; then else echo "Unsupported architecture: $arch" exit 1 +fi wget https://golang.org/dl/$tarball mkdir $HOME/go_installed/ From 6856f62f11034b486998a0d8d07f957ad0409b47 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 20:03:27 +0530 Subject: [PATCH 22/27] =?UTF-8?q?=F0=9F=93=82=20Add=20notes=20about=20futu?= =?UTF-8?q?re=20platform=20and=20architecture=20support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 3aa713c..45857d1 100644 --- a/README.md +++ b/README.md @@ -7,13 +7,13 @@ -Binaries for the Hugo static site generator, installable via `pip` +Binaries for the extended version of the Hugo static site generator, installable via `pip` This package provides wheels for [Hugo](https://gohugo.io/) to be used with `pip` on macOS, Linux, and Windows. ## Quickstart -Create a virtual environment and install the package: +Create a virtual environment and install the package (or install it globally on your system): ```bash python -m virtualenv venv # (or your preferred method of creating virtual environments) @@ -55,17 +55,30 @@ For more information on using Hugo and its command-line interface, please refer ## Supported platforms -| Platform | Architecture | Supported | -| -------- | ------------ | ---------------- | -| macOS | x86_64 | ✅ | -| macOS | arm64 | ✅ | -| Linux | amd64 | ✅ | -| Linux | arm64 | Coming soon | -| Windows | x86_64 | ✅ | +A subset of the platforms supported by Hugo itself are supported by `python-hugo`. The plan is to support as many platforms as possible with Python wheels and platform tags. Please refer to the following table for a list of supported platforms and architectures: + +| Platform | Architecture | Supported | +| -------- | --------------- | ------------------------------- | +| macOS | x86_64 (Intel) | ✅ | +| macOS | arm64 (Silicon) | ✅ | +| Linux | amd64 | ✅ | +| Linux | arm64 | ✅ | +| Windows | x86_64 | ✅ | +| Windows | i686 | ❌ Will not receive support[^1] | +| Windows | arm64 | 💡 Probable[^3] | +| DragonFlyBSD | amd64 | ❌ Will not receive support[^2] | +| FreeBSD | amd64 | ❌ Will not receive support[^2] | +| OpenBSD | amd64 | ❌ Will not receive support[^2] | +| NetBSD | amd64 | ❌ Will not receive support[^2] | +| Solaris | amd64 | ❌ Will not receive support[^2] | + +[^1]: Windows 32-bit support is possible to include, but hasn't been included due to the diminishing popularity of i686 instruction set-based systems and the lack of resources to test and build for it. If you need support for Windows 32-bit, please consider either using the official Hugo binaries or compiling from [HugoReleaser](https://github.com/gohugoio/hugoreleaser). +[^2]: Support for these platforms is not possible to include because of i. the lack of resources to test and build for them and ii. the lack of support for these platform specifications in Python packaging standards and tooling. If you need support for these platforms, please consider downloading the [official Hugo binaries](https://github.com/gohugoio/hugo/releases) +[^3]: Support for Windows ARM64 is possible to include, but `cibuildwheel` support for it is currently experimental. Hugo does not officially support Windows ARM64 at the moment, but it should be possible to build from source for it and can receive support in the future through this package. ## Building from source -Building Hugo from source requires the following dependencies: +Building the extended version of Hugo from source requires the following dependencies: - [Go](https://go.dev/doc/install) toolchain - [Git](https://git-scm.com/downloads) From aa4562cdeeec2350ffb7e96d3d9f12940e40148e Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 20:17:53 +0530 Subject: [PATCH 23/27] =?UTF-8?q?=F0=9F=9A=A7=20Don't=20run=20CD=20on=20PR?= =?UTF-8?q?s=20or=20`main`=20branch=20pushes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index b5ec497..f7101ce 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -2,10 +2,6 @@ name: CD on: workflow_dispatch: - pull_request: - push: - branches: - - main release: types: - published From 2ea528825125e8340ee2f7b06caeca9cd2276cda Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 20:22:42 +0530 Subject: [PATCH 24/27] =?UTF-8?q?=F0=9F=91=80=20Don't=20run=20on=20two=20G?= =?UTF-8?q?olang=20versions=20(security=20updates)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1854dbd..5013364 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,13 +16,12 @@ env: jobs: build: - name: Wheels (${{ matrix.runs-on }} / Python ${{ matrix.python-version }} / Go ${{ matrix.go-version }}) + name: Wheels (${{ matrix.runs-on }} / Python ${{ matrix.python-version }}) runs-on: ${{ matrix.runs-on }} strategy: fail-fast: false matrix: python-version: ["3.8", "3.12"] - go-version: ["1.20.x", "1.21.x"] runs-on: [ubuntu-latest, macos-latest, windows-latest] steps: @@ -38,7 +37,7 @@ jobs: - name: Set up Go toolchain uses: actions/setup-go@v5 with: - go-version: ${{ matrix.go-version }} + go-version: "1.21.x" cache: false check-latest: true @@ -54,7 +53,7 @@ jobs: uses: actions/cache/restore@v3 with: path: ./hugo_cache/ - key: ${{ runner.os }}-${{ matrix.go-version }}-hugo-build-cache-${{ hashFiles('**/setup.py', '**/pyproject.toml') }} + key: ${{ runner.os }}-hugo-build-cache-${{ hashFiles('**/setup.py', '**/pyproject.toml') }} - name: Install Python dependencies run: python -m pip install build virtualenv nox @@ -67,7 +66,7 @@ jobs: uses: actions/cache/save@v3 with: path: ./hugo_cache/ - key: ${{ runner.os }}-${{ matrix.go-version }}-hugo-build-cache-${{ hashFiles('**/setup.py', '**/pyproject.toml') }} + key: ${{ runner.os }}-hugo-build-cache-${{ hashFiles('**/setup.py', '**/pyproject.toml') }} - name: Test entry points for package run: nox -s venv From a35946dcc8d2ec5d090d043856b5a77e4db67750 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 21:15:49 +0530 Subject: [PATCH 25/27] =?UTF-8?q?=F0=9F=9A=A7=20Skip=20CD=20if=20it's=20no?= =?UTF-8?q?t=20a=20release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index f7101ce..62c36b4 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -287,11 +287,11 @@ jobs: publish: needs: [sdist, windows_wheels, linux_amd64_wheels, linux_aarch64_wheels, combined_macos_wheels] name: Publish to PyPI or TestPyPI - # environment: release - # permissions: - # id-token: write + environment: release + permissions: + id-token: write runs-on: ubuntu-latest - # if: github.event_name == 'release' && github.event.action == 'published' + if: github.event_name == 'release' && github.event.action == 'published' steps: - name: Download all artifacts From 634d7ebe9ea32ccf457ada02af9ca91031b7af37 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 21:35:44 +0530 Subject: [PATCH 26/27] =?UTF-8?q?=F0=9F=90=9B=20Resolve=20bug=20with=20inc?= =?UTF-8?q?orrect=20platform=20specification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The platform specification detection on macOS with Python 3.12 is wrong on GitHub Actions runners since universal Python implementations are being installed. #13 took care of this, but it should be worth adding this note as well here. --- setup.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 55e9a8e..7ac5b4a 100644 --- a/setup.py +++ b/setup.py @@ -204,9 +204,7 @@ def run(self): for path_spec in files_to_clean: # Make paths absolute and relative to this path - abs_paths = glob.glob( - os.path.normpath(os.path.join(here, path_spec)) - ) + abs_paths = glob.glob(os.path.normpath(os.path.join(here, path_spec))) for path in [str(p) for p in abs_paths]: if not path.startswith(here): # raise error if path in files_to_clean is absolute + outside @@ -243,9 +241,17 @@ def finalize_options(self): if sys.platform == "darwin": platform_tag = get_platform("_") # ensure correct platform tag for macOS arm64 and macOS x86_64 - if "arm64" in platform_tag and os.environ.get("GOARCH") == "amd64": + # macOS 3.12 Python runners are mislabelling the platform tag to be universal2 + # see: https://github.com/pypa/wheel/issues/573. we will explicitly rename the + # universal2 tag to macosx_X_Y_arm64 or macosx_X_Y_x86_64 respectively, since + # we fuse the wheels together later anyway. + if (("arm64" in platform_tag) or ("univeral2" in platform_tag)) and ( + os.environ.get("GOARCH") == "amd64" + ): self.plat_name = platform_tag.replace("arm64", "x86_64") - if "x86_64" in platform_tag and os.environ.get("GOARCH") == "arm64": + if (("x86_64" in platform_tag) or ("universal2" in platform_tag)) and ( + os.environ.get("GOARCH") == "arm64" + ): self.plat_name = platform_tag.replace("x86_64", "arm64") super().finalize_options() From e980b94409735be55ac072c1afd533654cdaf009 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 5 Jan 2024 21:37:37 +0530 Subject: [PATCH 27/27] =?UTF-8?q?=F0=9F=90=9B=20Resolve=20bug=20due=20to?= =?UTF-8?q?=20which=20`python=20-m=20build`=20did=20not=20work?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The command `python -m build`, if not specified with `--wheel` or `--sdist`, builds both a source distribution and a binary distribution, and the latter is built with the code from the former. It should therefore be necessary to include the correct paths for the source distrbution via MANIFEST.in --- MANIFEST.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 5164aea..5cb5869 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,3 @@ include licenses/LICENSE-hugo.txt -exclude python_hugo/binaries/* +include python_hugo/binaries/* +exclude python_hugo/binaries/hugo-*