#!/usr/bin/env bash

# Run the system python.
#
# This is primarily for use by the build toolchain so that it can continue
# using the system Python rather than Sage's Python, preventing conflicts
# that might otherwise occur, particularly in parallel builds.
#
# See https://trac.sagemath.org/ticket/18438

if [ -z "$SAGE_ORIG_PATH" ]; then
    # If not we're running from within sage-env just set the existing path
    SAGE_ORIG_PATH="$PATH"
fi

PYTHON="$(PATH="$SAGE_ORIG_PATH" command -v python)"

exec "$PYTHON" "$@"
