SwordArMor-gentoo-overlay/www-apps/netbox/files/netbox-3.3.9-no-pip.patch

87 lines
3 KiB
Diff
Raw Permalink Normal View History

--- netbox-3.3.9/upgrade.sh 2024-08-22 01:11:02.564925280 +0200
+++ netbox-3.3.9/upgrade.sh 2024-08-22 01:12:07.275402762 +0200
@@ -10,74 +10,6 @@
VIRTUALENV="$(pwd -P)/venv"
PYTHON="${PYTHON:-python3}"
-# Validate the minimum required Python version
-COMMAND="${PYTHON} -c 'import sys; exit(1 if sys.version_info < (3, 8) else 0)'"
-PYTHON_VERSION=$(eval "${PYTHON} -V")
-eval $COMMAND || {
- echo "--------------------------------------------------------------------"
- echo "ERROR: Unsupported Python version: ${PYTHON_VERSION}. NetBox requires"
- echo "Python 3.8 or later. To specify an alternate Python executable, set"
- echo "the PYTHON environment variable. For example:"
- echo ""
- echo " sudo PYTHON=/usr/bin/python3.8 ./upgrade.sh"
- echo ""
- echo "To show your current Python version: ${PYTHON} -V"
- echo "--------------------------------------------------------------------"
- exit 1
-}
-echo "Using ${PYTHON_VERSION}"
-
-# Remove the existing virtual environment (if any)
-if [ -d "$VIRTUALENV" ]; then
- COMMAND="rm -rf ${VIRTUALENV}"
- echo "Removing old virtual environment..."
- eval $COMMAND
-else
- WARN_MISSING_VENV=1
-fi
-
-# Create a new virtual environment
-COMMAND="${PYTHON} -m venv ${VIRTUALENV}"
-echo "Creating a new virtual environment at ${VIRTUALENV}..."
-eval $COMMAND || {
- echo "--------------------------------------------------------------------"
- echo "ERROR: Failed to create the virtual environment. Check that you have"
- echo "the required system packages installed and the following path is"
- echo "writable: ${VIRTUALENV}"
- echo "--------------------------------------------------------------------"
- exit 1
-}
-
-# Activate the virtual environment
-source "${VIRTUALENV}/bin/activate"
-
-# Upgrade pip
-COMMAND="pip install --upgrade pip"
-echo "Updating pip ($COMMAND)..."
-eval $COMMAND || exit 1
-pip -V
-
-# Install necessary system packages
-COMMAND="pip install wheel"
-echo "Installing Python system packages ($COMMAND)..."
-eval $COMMAND || exit 1
-
-# Install required Python packages
-COMMAND="pip install -r requirements.txt"
-echo "Installing core dependencies ($COMMAND)..."
-eval $COMMAND || exit 1
-
-# Install optional packages (if any)
-if [ -s "local_requirements.txt" ]; then
- COMMAND="pip install -r local_requirements.txt"
- echo "Installing local dependencies ($COMMAND)..."
- eval $COMMAND || exit 1
-elif [ -f "local_requirements.txt" ]; then
- echo "Skipping local dependencies (local_requirements.txt is empty)"
-else
- echo "Skipping local dependencies (local_requirements.txt not found)"
-fi
-
# Apply any database migrations
COMMAND="python3 netbox/manage.py migrate"
echo "Applying database migrations ($COMMAND)..."
@@ -91,7 +23,7 @@
# Build the local documentation
COMMAND="mkdocs build"
echo "Building documentation ($COMMAND)..."
-eval $COMMAND || exit 1
+eval $COMMAND || echo "Making doc failed but who cares"
# Collect static files
COMMAND="python3 netbox/manage.py collectstatic --no-input"