Update python version to 3.12 and base to core24 in snaps (#9983)

Fixes #9872, originally merged in #9956.

To upgrade to python3.12 as 3.8 is reaching EOL, we need to upgrade the core snap that certbot is based on. The latest version is core24, so we're going with that for longevity. We will want to notify third party snaps to make changes as well. They can release their snaps to a version higher than certbot's, and their users will not be upgraded until the matching (or greater) version of certbot is released. They should do this as otherwise including these changes will break their plugins.

Key documents for this migration are https://snapcraft.io/docs/migrate-core22 and https://snapcraft.io/docs/migrate-core24. The discussion at https://forum.snapcraft.io/t/upgrading-classic-snap-to-core24-using-snapcraft-8-3-causes-python-3-12-errors-at-runtime/ is also relevant to understanding some changes, which may become unnecessary in future versions of snapcraft.


* Migrate primary certbot snap to core24 and python 3.12

* Migrate plugin snaps to core24 and python 3.12

* Migrate to core24 in build_remote

* Run snap tests using python 3.12

* Unstage pyvenv.cfg and set PYTHONPATH

---------

Co-authored-by: Erica Portnoy <ebportnoy@gmail.com>
Co-authored-by: Erica Portnoy <erica@eff.org>
This commit is contained in:
Will Greenberg
2024-08-08 16:24:11 -07:00
committed by GitHub
co-authored by Erica Portnoy Erica Portnoy
parent 281b724996
commit c3c587001f
7 changed files with 67 additions and 56 deletions
+5 -5
View File
@@ -16,7 +16,7 @@ summary: ${DESCRIPTION}
description: ${DESCRIPTION}
confinement: strict
grade: stable
base: core20
base: core24
adopt-info: ${PLUGIN}
parts:
@@ -24,8 +24,8 @@ parts:
plugin: python
source: .
override-pull: |
snapcraftctl pull
snapcraftctl set-version \`grep ^version \$SNAPCRAFT_PART_SRC/setup.py | cut -f2 -d= | tr -d "'[:space:]"\`
craftctl default
craftctl set version=\$(grep ^version \$SNAPCRAFT_PART_SRC/setup.py | cut -f2 -d= | tr -d "'[:space:]")
build-environment:
# We set this environment variable while building to try and increase the
# stability of fetching the rust crates needed to build the cryptography
@@ -53,7 +53,7 @@ parts:
source: .
stage: [setup.py, certbot-shared]
override-pull: |
snapcraftctl pull
craftctl default
mkdir -p \$SNAPCRAFT_PART_SRC/certbot-shared
slots:
@@ -61,7 +61,7 @@ slots:
interface: content
content: certbot-1
read:
- \$SNAP/lib/python3.8/site-packages
- \$SNAP/lib/python3.12/site-packages
plugs:
certbot-metadata: