Build: Use `pipenv sync --system` instead of requirements.txt

When pipenv dumps the lock file to a requirements.txt, it does not
include the `sys_platform` directive. This causes pip to attempt to
install win32 packages, which fails. By using `pypenv sync --system`
instead, only packages applicable to Linux are installed.

Fixes #1993
This commit is contained in:
Mike Salvatore 2022-06-09 11:15:07 -04:00
parent 1b2ca74b9f
commit b8a5245c1b
1 changed files with 4 additions and 14 deletions

View File

@ -79,20 +79,10 @@ install_monkey_island_python_dependencies() {
log_message "Installing pipenv" log_message "Installing pipenv"
"$APPDIR"/AppRun -m pip install pipenv || handle_error "$APPDIR"/AppRun -m pip install pipenv || handle_error
requirements_island="$BUILD_DIR/monkey_island/requirements.txt" log_message "Installing dependencies"
generate_requirements_from_pipenv_lock "$requirements_island" pushd "$BUILD_DIR/monkey_island" || handle_error
"$APPDIR"/AppRun -m pipenv --python "$APPDIR/AppRun" sync --system || handle_error
log_message "Installing island python requirements" popd || handle_error
"$APPDIR"/AppRun -m pip install -r "${requirements_island}" --ignore-installed || handle_error
}
generate_requirements_from_pipenv_lock () {
local requirements_island=$1
log_message "Generating a requirements.txt file with 'pipenv requirements'"
pushd "$BUILD_DIR/monkey_island"
"$APPDIR"/AppRun -m pipenv --python "$APPDIR/AppRun" requirements --hash > "$requirements_island" || handle_error
popd
} }