Merge ~lgp171188/lpci:fix-snapcraft-bug-build-error-snapcraft-8.x into lpci:main

Proposed by Guruprasad
Status: Merged
Merged at revision: ad8ae268d45152c5a1e8f24a6d3db2975ae6e344
Proposed branch: ~lgp171188/lpci:fix-snapcraft-bug-build-error-snapcraft-8.x
Merge into: lpci:main
Diff against target: 18 lines (+5/-1)
1 file modified
snap/local/sitecustomize.py (+5/-1)
Reviewer Review Type Date Requested Status
Jürgen Gmach Approve
Review via email: mp+460659@code.launchpad.net

Commit message

Fix the build error with snapcraft 8.x

There was a bug in the sitecustomize.py file bundled with the lpci snap,
which caused the build process to depend on the version of python used
by snapcraft. This bug didn't surface with snapcraft 7.x, which is built
on core20, the same as lpci snap. But snapcraft 8.x is built on core22
and hence there was a conflict between the expected and available versions
of pip during the build process.

This fixes the issue by enabling the site customizations only in the
context of the lpci snap.

LP: #2053109

To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/snap/local/sitecustomize.py b/snap/local/sitecustomize.py
index fd53447..c1d8935 100644
--- a/snap/local/sitecustomize.py
+++ b/snap/local/sitecustomize.py
@@ -1,8 +1,12 @@
1import os1import os
2import site2import site
33
4snap_name = os.getenv("SNAP_NAME")
4snap_dir = os.getenv("SNAP")5snap_dir = os.getenv("SNAP")
5if snap_dir:6
7# Add the custom site directories only when executing in the context
8# of the `lpci` snap and its snap directory exists.
9if snap_name == "lpci" and snap_dir:
6 site.ENABLE_USER_SITE = False10 site.ENABLE_USER_SITE = False
7 site.addsitedir(os.path.join(snap_dir, "lib"))11 site.addsitedir(os.path.join(snap_dir, "lib"))
8 site.addsitedir(os.path.join(snap_dir, "usr/lib/python3/dist-packages"))12 site.addsitedir(os.path.join(snap_dir, "usr/lib/python3/dist-packages"))

Subscribers

People subscribed via source and target branches