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
1diff --git a/snap/local/sitecustomize.py b/snap/local/sitecustomize.py
2index fd53447..c1d8935 100644
3--- a/snap/local/sitecustomize.py
4+++ b/snap/local/sitecustomize.py
5@@ -1,8 +1,12 @@
6 import os
7 import site
8
9+snap_name = os.getenv("SNAP_NAME")
10 snap_dir = os.getenv("SNAP")
11-if snap_dir:
12+
13+# Add the custom site directories only when executing in the context
14+# of the `lpci` snap and its snap directory exists.
15+if snap_name == "lpci" and snap_dir:
16 site.ENABLE_USER_SITE = False
17 site.addsitedir(os.path.join(snap_dir, "lib"))
18 site.addsitedir(os.path.join(snap_dir, "usr/lib/python3/dist-packages"))

Subscribers

People subscribed via source and target branches