squash-package-install to use the correct python

99-squash-package-install in the package-installs element does not
know which python environments the requirements were installed into.
This can cause it to select the wrong python to run the
package-installs-squash script.

Co-Authored-By: Adam Harwell <flux.adam@gmail.com>
Change-Id: I5fab0e192c3a2dad8f60e821c184479e24e33bcd
This commit is contained in:
Michael Johnson 2017-03-08 14:18:17 -08:00 committed by Ian Wienand
parent 85985cdadc
commit fae8004e4d
2 changed files with 5 additions and 5 deletions

View File

@ -60,6 +60,10 @@ def main():
# pre-seed some paths for the shell script # pre-seed some paths for the shell script
environ['_LIB'] = diskimage_builder.paths.get_path('lib') environ['_LIB'] = diskimage_builder.paths.get_path('lib')
# export the path to the current python
if not os.environ.get('DIB_PYTHON_EXEC'):
os.environ['DIB_PYTHON_EXEC'] = sys.executable
# we have to handle being called as "disk-image-create" or # we have to handle being called as "disk-image-create" or
# "ramdisk-image-create". ramdisk-iamge-create is just a symlink # "ramdisk-image-create". ramdisk-iamge-create is just a symlink
# to disk-image-create # to disk-image-create

View File

@ -5,8 +5,4 @@ fi
set -eu set -eu
set -o pipefail set -o pipefail
# Search for python first in case we are in a venv with python3 which sudo -E $DIB_PYTHON_EXEC $(dirname $0)/../bin/package-installs-squash --elements="$IMAGE_ELEMENT" --path=$ELEMENTS_PATH $TMP_MOUNT_PATH/tmp/package-installs.json
# should take precedence
python_path=$(command -v python || command -v python2 || command -v python3)
sudo -E $python_path $(dirname $0)/../bin/package-installs-squash --elements="$IMAGE_ELEMENT" --path=$ELEMENTS_PATH $TMP_MOUNT_PATH/tmp/package-installs.json