From 98c9b2a90731d4368ff12bab55cc8e14b50f7d3d Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Fri, 16 Apr 2021 10:28:00 -0400 Subject: [PATCH] appimage: Use pipenv to install python dependencies --- appimage/build_appimage.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/appimage/build_appimage.sh b/appimage/build_appimage.sh index b389c67db..d4c6b6251 100755 --- a/appimage/build_appimage.sh +++ b/appimage/build_appimage.sh @@ -134,14 +134,23 @@ copy_monkey_island_to_appdir() { install_monkey_island_python_dependencies() { log_message "Installing island requirements" - requirements_island="$ISLAND_PATH/requirements.txt" - # TODO: This is an ugly hack. PyInstaller and VirtualEnv are build-time - # dependencies and should not be installed as a runtime requirement. - cat "$requirements_island" | grep -Piv "virtualenv|pyinstaller" | sponge "$requirements_island" + log_message "Installing pipenv" + "$APPDIR"/AppRun -m pip install pipenv || handle_error + requirements_island="$ISLAND_PATH/requirements.txt" + generate_requirements_from_pipenv_lock $requirements_island + + log_message "Installing island python requirements" "$APPDIR"/AppRun -m pip install -r "${requirements_island}" --ignore-installed || handle_error } +generate_requirements_from_pipenv_lock () { + log_message "Generating a requirements.txt file with 'pipenv lock -r'" + cd $ISLAND_PATH + "$APPDIR"/AppRun -m pipenv --python "$APPDIR/AppRun" lock -r > "$1" || handle_error + cd - +} + download_monkey_agent_binaries() { log_message "Downloading monkey agent binaries to ${ISLAND_BINARIES_PATH}" mkdir -p "${ISLAND_BINARIES_PATH}" || handle_error