Skip to content

Commit fbcc0d3

Browse files
committed
Changed Makefile so no need to source a file before building
1 parent 020cba5 commit fbcc0d3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

code-review/Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
.PHONY: test clean
22

3+
VENV_ACTIVATE := venv/bin/activate
4+
35
# Default target
46
test: setup-venv install-test-deps run-tests
57

68
# Check if we're in a virtual environment and create one if not
79
setup-venv:
810
@echo "Checking virtual environment..."
9-
@if [ -z "$$VIRTUAL_ENV" ]; then \
11+
@if [ ! -e "$(VENV_ACTIVATE)" ]; then \
1012
echo "No virtual environment detected. Creating one..."; \
1113
python3 -m venv venv; \
12-
echo "Virtual environment created. Please activate it with: source venv/bin/activate"; \
13-
echo "Then run 'make test' again."; \
14-
exit 1; \
14+
echo "Virtual environment created"; \
1515
else \
16-
echo "Virtual environment detected: $$VIRTUAL_ENV"; \
16+
echo "Virtual environment detected: "$(VENV_ACTIVATE)""; \
1717
fi
1818

1919
# Install test requirements
2020
install-test-deps:
2121
@echo "Installing test requirements..."
22-
@pip install -r test_requirements.txt
22+
@. "$(VENV_ACTIVATE)" && pip install -r test_requirements.txt
2323

2424
# Run the tests
2525
run-tests:
2626
@echo "Running tests..."
27-
@python run_tests.py
27+
@. "$(VENV_ACTIVATE)" && python run_tests.py
2828

2929
# Clean up generated files
3030
clean:

0 commit comments

Comments
 (0)