From e43d2533535416c9132f95ceb741af03ce0817b2 Mon Sep 17 00:00:00 2001 From: Callahan Kovacs Date: Tue, 29 Oct 2024 15:34:15 +0100 Subject: [PATCH] chore: migrate snapcraft itself to core24 Signed-off-by: Callahan Kovacs --- .github/workflows/tox.yaml | 10 +++++----- .readthedocs.yaml | 4 ++-- HACKING.md | 3 +-- pyproject.toml | 10 +++++----- setup.py | 4 ++-- snap/snapcraft.yaml | 20 +++++++++----------- tools/freeze-requirements.sh | 1 - 7 files changed, 24 insertions(+), 28 deletions(-) diff --git a/.github/workflows/tox.yaml b/.github/workflows/tox.yaml index abfdf47baa..4b6d07db01 100644 --- a/.github/workflows/tox.yaml +++ b/.github/workflows/tox.yaml @@ -10,7 +10,7 @@ on: jobs: linters: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -44,7 +44,7 @@ jobs: - name: Run Linters run: tox run --colored yes --skip-pkg-install -m lint tests: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 with: @@ -62,9 +62,9 @@ jobs: echo "::endgroup::" mkdir -p results - name: Setup Tox environments - run: tox run-parallel --parallel auto --parallel-no-spinner --parallel-live --colored yes -e test-py310,test-legacy-py310 --notest + run: tox run-parallel --parallel auto --parallel-no-spinner --parallel-live --colored yes -e test-py312,test-legacy-py312 --notest - name: Test with tox - run: tox run --skip-pkg-install --result-json results/tox-ubuntu-22.04.json --colored yes -e test-py310,test-legacy-py310 + run: tox run --skip-pkg-install --result-json results/tox-ubuntu-24.04.json --colored yes -e test-py312,test-legacy-py312 - name: Upload code coverage uses: codecov/codecov-action@v4 with: @@ -74,5 +74,5 @@ jobs: if: success() || failure() uses: actions/upload-artifact@v4 with: - name: test-results-ubuntu-22.04 + name: test-results-ubuntu-24.04 path: results/ diff --git a/.readthedocs.yaml b/.readthedocs.yaml index fa08f743a2..3600bd75f0 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,9 +9,9 @@ submodules: - docs/sphinx-resources build: - os: ubuntu-22.04 + os: ubuntu-24.04 tools: - python: "3.10" + python: "3.12" apt_packages: - libapt-pkg-dev jobs: diff --git a/HACKING.md b/HACKING.md index ab505761f3..5dd012802d 100644 --- a/HACKING.md +++ b/HACKING.md @@ -39,8 +39,7 @@ Import your keys (`ssh-import-id`) and add a `Host` entry to your ssh config if We use a large number of tools for our project. Most of these are installed for you with tox, but you'll need to install: -- Python 3.10 (default on Ubuntu 22.04, available on Ubuntu 24.04 through the - [deadsnakes](https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa) PPA) with setuptools. +- Python 3.12 (default on Ubuntu 22.04) with setuptools. - [tox](https://tox.wiki) version 3.8 or later - [pyright](https://github.com/microsoft/pyright) (also available via snap: `snap install pyright`) - [ruff](https://github.com/astral/ruff) (also available via snap: `snap install ruff`) diff --git a/pyproject.toml b/pyproject.toml index 2c4fb3c200..1b1bad5b82 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,10 +8,10 @@ extend-exclude = ''' ''' # Targeting future versions as well so we don't have black reformatting code # en masse later. -target_version = ["py310", "py311"] +target_version = ["py312"] [tool.mypy] -python_version = "3.10" +python_version = "3.12" ignore_missing_imports = true follow_imports = "silent" exclude = [ @@ -29,16 +29,16 @@ plugins = [ [tool.pyright] include = ["snapcraft", "tests"] exclude = ["build", "tests/legacy", "tests/spread"] -pythonVersion = "3.10" +pythonVersion = "3.12" [tool.pytest.ini_options] minversion = "7.0" -required_plugins = ["pytest-cov>=4.0", "pytest-mock>=3.10", "pytest-subprocess>=1.4"] +required_plugins = ["pytest-cov>=4.0", "pytest-mock>=3.12", "pytest-subprocess>=1.4"] addopts = ["--cov=snapcraft"] # Most of this ruff configuration comes from craft-parts [tool.ruff] -target-version = "py310" +target-version = "py312" line-length = 88 extend-exclude = [ "docs", diff --git a/setup.py b/setup.py index 3fc201f7fd..1ee8b9c3cb 100755 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ def recursive_data_files(directory, install_directory): "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.12", "Topic :: Software Development :: Build Tools", "Topic :: System :: Software Distribution", ] @@ -174,7 +174,7 @@ def recursive_data_files(directory, install_directory): + recursive_data_files("keyrings", "share/snapcraft") + recursive_data_files("extensions", "share/snapcraft") ), - python_requires=">=3.10", + python_requires=">=3.12", install_requires=install_requires, extras_require=extras_requires, test_suite="tests.unit", diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index d81c623409..299565d731 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: snapcraft -base: core22 +base: core24 summary: easily create snaps description: | Snapcraft aims to make upstream developers' lives easier and as such is not @@ -15,7 +15,6 @@ assumes: # https://github.com/canonical/snapcraft/issues/4187 environment: PATH: "$SNAP/libexec/snapcraft:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - LD_LIBRARY_PATH: "$SNAP/none" # cryptography>=42.0 cannot load legacy algorithms on # Ubuntu 20.04 for armhf, ppc64el, riscv64, and s390x CRYPTOGRAPHY_OPENSSL_NO_LEGACY: "1" @@ -90,21 +89,20 @@ parts: - execstack - gpg - gpgv - - libffi7 + - libffi8 - libsodium23 - libxml2 - libxslt1.1 - libpython3-stdlib - - libpython3.10-stdlib - - libpython3.10-minimal + - libpython3.12-stdlib + - libpython3.12-minimal - python3-pip - python3-setuptools - python3-wheel - python3-venv - python3-minimal - - python3-distutils - python3-pkg-resources - - python3.10-minimal + - python3.12-minimal - squashfs-tools - xdelta3 build-attributes: @@ -120,7 +118,7 @@ parts: ln -s "$LIBSODIUM" "$TRIPLET_PATH/libsodium.so" # Restore patched files - PYTHON_PACKAGE_PATH="${SNAPCRAFT_PART_INSTALL}/usr/lib/python3.10/" + PYTHON_PACKAGE_PATH="${SNAPCRAFT_PART_INSTALL}/usr/lib/python3.12/" CTYPES_INIT="ctypes/__init__.py" CTYPES_INIT_ORIG="patched/${CTYPES_INIT}.orig" [ -f "${CTYPES_INIT_ORIG}" ] && mv "${CTYPES_INIT_ORIG}" "${PYTHON_PACKAGE_PATH}/${CTYPES_INIT}" @@ -136,7 +134,7 @@ parts: fi # Disable site packages - sed -i "${SNAPCRAFT_PART_INSTALL}/usr/lib/python3.10/site.py" \ + sed -i "${SNAPCRAFT_PART_INSTALL}/usr/lib/python3.12/site.py" \ -e 's/^ENABLE_USER_SITE = None$/ENABLE_USER_SITE = False/' libgit2: @@ -175,7 +173,7 @@ parts: - "PIP_NO_BINARY": ":all:" # Use base image's libsodium for PyNaCl. - "SODIUM_INSTALL": "system" - - "CFLAGS": "$(pkg-config python-3.10 yaml-0.1 --cflags)" + - "CFLAGS": "$(pkg-config python-3.12 yaml-0.1 --cflags)" override-build: | ${SNAP}/libexec/snapcraft/craftctl default @@ -187,7 +185,7 @@ parts: ${SNAP}/libexec/snapcraft/craftctl set grade="$grade" # The new implementation still requires this. - ln -sf ../usr/bin/python3.10 $SNAPCRAFT_PART_INSTALL/bin/python3 + ln -sf ../usr/bin/python3.12 $SNAPCRAFT_PART_INSTALL/bin/python3 after: [snapcraft-libs, libgit2] chisel: diff --git a/tools/freeze-requirements.sh b/tools/freeze-requirements.sh index 5f086892ee..8f0f5fb2c8 100755 --- a/tools/freeze-requirements.sh +++ b/tools/freeze-requirements.sh @@ -44,7 +44,6 @@ pip install -e .[docs] pip freeze --exclude-editable > requirements-docs.txt requirements_fixups "requirements-docs.txt" -# Set the configured python-apt and python-distutils-extra packages. pip install -e .[dev] pip freeze --exclude-editable > requirements-devel.txt requirements_fixups "requirements-devel.txt"