Add PYTHONPATH environment variable to snapcraft.yaml

This fixes #1438: `encodings` module not found

The variable replaces the `sitecustomize.py` file from `snap/local` because it is no-longer functional due to changes in snapcraft.
pull/1527/head
Dani Llewellyn 2022-08-29 20:46:33 +01:00
rodzic 775820c957
commit 5ab34603a6
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: C75969D9238A4A8E
2 zmienionych plików z 1 dodań i 22 usunięć

Wyświetl plik

@ -1,22 +0,0 @@
import site
import os
snap_dir = os.getenv("SNAP")
snapcraft_stage_dir = os.getenv("SNAPCRAFT_STAGE")
snapcraft_part_install = os.getenv("SNAPCRAFT_PART_INSTALL")
# Do not include snap_dir during builds as this will include
# snapcraft's in-snap site directory.
if snapcraft_stage_dir is not None and snapcraft_part_install is not None:
site_directories = [snapcraft_stage_dir, snapcraft_part_install]
else:
superbuild_dir = os.path.join(snap_dir, 'odm/SuperBuild/install')
site_directories = [snap_dir, superbuild_dir]
for d in site_directories:
if d:
site_dir = os.path.join(d, "lib/python3.8/site-packages")
site.addsitedir(site_dir)
if snap_dir:
site.ENABLE_USER_SITE = False

Wyświetl plik

@ -209,6 +209,7 @@ apps:
environment:
# Ensure libraries are found
LD_LIBRARY_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/blas:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/lapack:$LD_LIBRARY_PATH
PYTHONPATH: $SNAP/odm/SuperBuild/install:$SNAP/lib/python3.8/site-packages:$SNAP/usr/lib/python3/dist-packages/:$SNAP/usr/lib/python3.8
plugs:
- home
- network