51 lines
1.2 KiB
Makefile
51 lines
1.2 KiB
Makefile
# I use this Makefile to automatize setting up the working space for me
|
|
# As long as `virtualenv` and `pyenv` are installed, running `make` should set
|
|
# up the virtual envrionment with everything needed.
|
|
|
|
.PHONY: clean
|
|
|
|
PYTHON_VERSION = 3.8
|
|
PYTHON_SUBVERSION = 3.8.12
|
|
|
|
PYENV_VERSIONS = $(HOME)/.pyenv/versions
|
|
PYTHON_BIN = $(PYENV_VERSIONS)/$(PYTHON_SUBVERSION)/bin/python$(PYTHON_VERSION)
|
|
|
|
VENV = venv
|
|
PYTHON_VENV = $(VENV)/bin/python
|
|
PIP = $(PYTHON_VENV) -m pip
|
|
PIP_COMPILE = venv/bin/pip-compile
|
|
|
|
all: .installed_deps
|
|
|
|
.installed_deps: requirements.txt dev-requirements.txt $(PYTHON_VENV)
|
|
$(PIP) install \
|
|
-r requirements.txt \
|
|
-r dev-requirements.txt
|
|
touch $@
|
|
|
|
requirements.txt: pyproject.toml $(PIP_COMPILE)
|
|
$(PIP_COMPILE) \
|
|
--resolver=backtracking \
|
|
--output-file $@ \
|
|
$<
|
|
|
|
dev-requirements.txt: pyproject.toml $(PIP_COMPILE)
|
|
$(PIP_COMPILE) \
|
|
--extra=dev \
|
|
--resolver=backtracking \
|
|
--output-file $@ \
|
|
$<
|
|
|
|
$(PIP_COMPILE): $(PYTHON_VENV)
|
|
$(PIP) install pip-tools
|
|
|
|
$(PYTHON_VENV): $(PYTHON_BIN)
|
|
virtualenv --python=$^ $(VENV)
|
|
$(PIP) install --upgrade pip
|
|
|
|
$(PYTHON_BIN):
|
|
pyenv install $(PYTHON_VERSION)
|
|
|
|
clean:
|
|
rm -rf *.egg-info venv installed_deps
|