Comment 2 for bug 1876370

Revision history for this message
Alberto Donato (ack) wrote :

Yes to both your questions.

This is the relevant python part:

  crbs:
    plugin: python
    source: .
    source-type: local
    requirements:
      - requirements.txt
    build-packages:
      - git
      - libffi-dev
      - libpq-dev
      - python3-setuptools
    stage-packages:
      - libpq5
      - libxml2
    filesets:
      bins:
        - bin/alembic
        - bin/crbs-admin
        - bin/crbs-asyncapi
        - bin/uwsgi
        - bin/snap-helpers*
        - bin/python
        - bin/python3
    prime:
      - $bins
      - etc
      - lib
      - usr/lib
    override-build: |
      set -e
      snapcraftctl build
      snapcraftctl set-version $($SNAPCRAFT_PROJECT_DIR/snap/local/snap-version)
      snap-helpers write-hooks

With snapcraft 4.0.1+git1.ge9d758fa (4730) if I put the followig in the configure hook:

which python3
python3 -c 'import sys; print(sys.path)'

I get:

/snap/canonical-rbac/x1/bin/python3
['', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/usr/lib/python3/dist-packages']

If I append $SNAP/lib/python3.8/site-packages to sys.path at the beginning of the python script called by the hook, it works.