Skip to content

Commit cfb7619

Browse files
committed
fixes makefile
1 parent 52960a4 commit cfb7619

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

{{cookiecutter.project_slug}}/Makefile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ help: Makefile
1313
init:
1414
python -m venv .venv
1515
direnv allow .
16-
type python
1716

1817
## install: add a new package (make install <package>), or install all project dependencies from piplock.txt (make install)
1918
.PHONY: install
2019
install:
2120
python -m pip install --upgrade pip
22-
ifeq ($(filter-out $@,$(MAKECMDGOALS)),)
23-
@echo "Installing dependencies from piplock.txt"
24-
pip install -r piplock.txt
25-
else
26-
@echo "Adding package $(filter-out $@,$(MAKECMDGOALS)) to requirements.txt"
27-
@grep -q "^$(filter-out $@,$(MAKECMDGOALS))$$" requirements.txt || echo "$(filter-out $@,$(MAKECMDGOALS))" >> requirements.txt
28-
pip install $(filter-out $@,$(MAKECMDGOALS))
29-
pip install -r requirements.txt
30-
pip freeze > piplock.txt
31-
endif
21+
@if [ -z "$(filter-out install,$(MAKECMDGOALS))" ]; then \
22+
echo "Installing dependencies from piplock.txt"; \
23+
pip install -r piplock.txt; \
24+
else \
25+
pkg="$(filter-out install,$(MAKECMDGOALS))"; \
26+
echo "Adding package $$pkg to requirements.txt"; \
27+
grep -q "^$$pkg$$" requirements.txt || echo "$$pkg" >> requirements.txt; \
28+
pip install $$pkg; \
29+
pip install -r requirements.txt; \
30+
pip freeze > piplock.txt; \
31+
fi
3232

3333
# Empty rule to handle package name argument
3434
%:

0 commit comments

Comments
 (0)