prime: byte compile python for performance

Ensure we include pyc files as part of the snap so that it
actually loads in a reasonable amount of time.

Change-Id: I4af6edb829129e2ce97d03f7d53f2393c7234926
This commit is contained in:
James Page 2018-07-30 14:29:31 +01:00
parent f549ea8bf5
commit 0142c637f5
1 changed files with 7 additions and 0 deletions

View File

@ -108,3 +108,10 @@ parts:
- libxslt1-dev
- pkg-config
- gcc
override-prime: |
snapcraftctl prime
# Now that everything is built, let's disable user site-packages
# as stated in PEP-0370
sed -i usr/lib/python3.5/site.py -e 's/^ENABLE_USER_SITE = None$/ENABLE_USER_SITE = False/'
# This is the last step, let's now compile all our pyc files.
./usr/bin/python3 -m compileall .