Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Add explicit python build tools to snapcraft #7213

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/7213.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add explicit Python build tooling as dependencies for the snapcraft build.
4 changes: 4 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ parts:
python-version: python3
python-packages:
- '.[all]'
- pip
- setuptools
- setuptools-scm
- wheel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these items not go in build-packages instead of python-packages? They shouldn't be required to run Synapse.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, yes, however the build-packages setting requires that apt/debian packages are used. So, there are a few approaches possible here, and I'm happy to use the one you are all comfortable with -

  1. The python-packagessetting. Upside is it's clean and self-documenting, downside is the dependencies are also installed in the snap, not just at build time.
  2. The build-packages setting. Upside would be that the packages are only installed during build and would not be staged for inclusion in the snap. Downside, requires the use for Debian packages, so could not pull the latest or potentially the required versions from Pip.
  3. A custom override-build command which included a step to manually pip install the required build tools. Upsides: should not be staged (in theory, would require testing) and can use the pip versions of the packages. Would more closely mirror the README, also. Downsides: Messy and not self-documenting in the snapcraft file, does not follow regular snapcraft metadata and may be more difficult to maintain in the future.

Let me know how you'd like me to tackle it, and I'll make the required changes. Currently, the snap build is failing due to a missing setuptools_scm module, which did not occur previously, so figured it best to explicitly mirror the build documentation by making sure these packages are installed from pypi during build.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the detailed overview. I agree that I'm a little hesitant to rely on distro packages here when snap is designed precisely to not be that.

I think I'm ok with including them in python-packages, acknowledging that will bloat the package a bit, but it's a tradeoff with not having things break down the line with a complicated install script or dependencies shifting out of our control.

build-packages:
- libffi-dev
- libturbojpeg0-dev
Expand Down