Skip to content

Commit

Permalink
Merge pull request #485 from truenas/NAS-123630
Browse files Browse the repository at this point in the history
  • Loading branch information
sonicaj authored Aug 21, 2023
2 parents 99012b3 + 67287c3 commit 902db23
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ PYTHON?=/usr/bin/python3
COMMIT_HASH=$(shell git rev-parse --short HEAD)
PACKAGES?=""
REPO_CHANGED=$(shell if [ -d "./venv-$(COMMIT_HASH)" ]; then git status --porcelain | grep -c "scale_build/"; else echo "1"; fi)
# Check if --break-system-packages flag is supported by pip
BREAK_SYS_PKGS_FLAG=$(shell ${PYTHON} -m pip help install | grep -q -- '--break-system-packages' && echo "--break-system-packages" || echo "")

.DEFAULT_GOAL := all

check:
ifneq ($(REPO_CHANGED),0)
@echo "Setting up new virtual environment"
@rm -rf venv-*
@${PYTHON} -m pip install --break-system-packages -U virtualenv >/dev/null || { echo "Failed to install/upgrade virtualenv package"; exit 1; }
@${PYTHON} -m pip install $(BREAK_SYS_PKGS_FLAG) -U virtualenv >/dev/null || { echo "Failed to install/upgrade virtualenv package"; exit 1; }
@${PYTHON} -m venv venv-${COMMIT_HASH} || { echo "Failed to create virutal environment"; exit 1; }
@{ . ./venv-${COMMIT_HASH}/bin/activate && \
python3 -m pip install -r requirements.txt >/dev/null 2>&1 && \
Expand Down

0 comments on commit 902db23

Please sign in to comment.