@@ -71,8 +71,31 @@ grade: stable
7171confinement : classic
7272
7373parts :
74+ # The cryptography library (indirect dependency via craft-store) requires rust, but only ships wheels for amd64 and arm64.
75+ # As of cryptography 39, it requires rust v1.48.0 or newer, which is available from focal-updates.
76+ # This part builds the wheel for cryptography.
77+ cryptography-deps :
78+ plugin : dump
79+ source : .
80+ build-packages :
81+ - cargo
82+ - rustc
83+ - pkg-config
84+ - python3.8-dev
85+ - libpython3.8-dev
86+ - libssl-dev
87+ - libffi-dev
88+ - python3-wheel
89+ - python3-pip
90+ - python3-setuptools-scm
91+ override-build : |
92+ # Dirty workaround - builds the cryptography wheel for later installation.
93+ # This must be exactly the version referenced in requirements.txt, so this is fragile.
94+ pip wheel $(grep '^cryptography[<=>]' requirements.txt)
95+
7496 # Classic core20 snaps require staged python.
7597 python3 :
98+ after : [cryptography-deps]
7699 plugin : nil
77100 build-packages :
78101 - python3-dev
@@ -92,16 +115,8 @@ parts:
92115 snapcraftctl build
93116 install -D -m 0755 $SNAPCRAFT_PROJECT_DIR/snap/local/sitecustomize.py $SNAPCRAFT_PART_INSTALL/usr/lib/python3.8/sitecustomize.py
94117
95- # The cryptography library (indirect dependency via craft-store) requires rust, but only ships wheels for amd64 and arm64.
96- # As of cryptography 39, it requires rust v1.48.0 or newer, which is available from focal-updates.
97- rust-deps :
98- plugin : nil
99- build-packages :
100- - cargo
101- - rustc
102-
103118 charmcraft :
104- after : [python3, rust -deps]
119+ after : [python3, cryptography -deps]
105120 source : .
106121 plugin : python
107122 requirements :
@@ -125,6 +140,8 @@ parts:
125140 override-pull : |
126141 # do the usual pull stuff
127142 snapcraftctl pull
143+ # Ensure we don't have a dubious ownership error from git with a remote build.
144+ git config --global --add safe.directory $SNAPCRAFT_PART_SRC
128145 # set the version
129146 version="$(python3 setup.py --version)"
130147 snapcraftctl set-version "$version"
0 commit comments