Skip to content

Commit

Permalink
chore: migrate snapcraft itself to core24
Browse files Browse the repository at this point in the history
Signed-off-by: Callahan Kovacs <callahan.kovacs@canonical.com>
  • Loading branch information
mr-cal committed Oct 29, 2024
1 parent 187187d commit e43d253
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 28 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/tox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
linters:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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/
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
Expand Down Expand Up @@ -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",
Expand Down
20 changes: 9 additions & 11 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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:
Expand All @@ -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}"
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down
1 change: 0 additions & 1 deletion tools/freeze-requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit e43d253

Please sign in to comment.