IMHO it can be any folder which path is specified via the source
property, e.g.:
- /home/user/Documents/my-project
- somewhere/under/the/working/directory
IMHO it can be any folder which path is specified via the source
property, e.g.:
I managed to answer my own question on building a snap around a singular python file without setup.py, etc.
While not super elegant and by no means production-proof, it’s proven to work, and has allowed me to test stuff out in confinement in Ubuntu Core:
parts:
my-python-script:
plugin: nil
source: .
override-build: |
python3 -m venv env
source env/bin/activate
pip3 install package1
pip3 install package2
cp -a env/. $CRAFT_PART_INSTALL/
# chmod your script here if not already given execute
cp -r ./my-python-script.py $CRAFT_PART_INSTALL/my-python-script
build-packages:
- python3-venv
This places the entire virtual env into the root of the snap, so effectively everything it needs to run is there. I guess you could also replace the pip3 install
lines with a single one reading a requirements.txt
I tried an alternative way that makes the required python3 packages stage-packages, however even if they’re loaded into the $SNAP/
dir, doing an LD_LIBRARY_PATH
to $SNAP/usr/lib/python3/dist-packages
does not seem to work.
Hope this helps someone out there, and I hope it’s not too horrific
Execuse me , how do you write the apps part, the command meta ?