← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Guruprasad has proposed merging ~lgp171188/lpci:fix-snapcraft-bug-build-error-snapcraft-8.x into lpci:main.

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

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #2053109 in lpci: "lpci snap build errors out with snapcraft 8.x"
  https://bugs.launchpad.net/lpci/+bug/2053109

For more details, see:
https://code.launchpad.net/~lgp171188/lpci/+git/lpcraft/+merge/460659
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/lpci:fix-snapcraft-bug-build-error-snapcraft-8.x into lpci:main.
diff --git a/snap/local/sitecustomize.py b/snap/local/sitecustomize.py
index fd53447..d7b639b 100644
--- a/snap/local/sitecustomize.py
+++ b/snap/local/sitecustomize.py
@@ -1,8 +1,9 @@
 import os
 import site
 
+snap_name = os.getenv("SNAP_NAME")
 snap_dir = os.getenv("SNAP")
-if snap_dir:
+if snap_name == "lpci" and snap_dir:
     site.ENABLE_USER_SITE = False
     site.addsitedir(os.path.join(snap_dir, "lib"))
     site.addsitedir(os.path.join(snap_dir, "usr/lib/python3/dist-packages"))