2021-07-02 07:21:36 +00:00
|
|
|
VENV = $(PWD)/venv
|
2017-09-21 14:34:26 +00:00
|
|
|
PIP = $(VENV)/bin/pip
|
|
|
|
PYTHON = $(VENV)/bin/python
|
|
|
|
FLASK = $(VENV)/bin/flask
|
2019-08-26 14:06:35 +00:00
|
|
|
ISORT = $(VENV)/bin/isort
|
|
|
|
BLACK = $(VENV)/bin/black
|
2017-09-21 14:34:26 +00:00
|
|
|
|
2022-11-17 10:27:34 +00:00
|
|
|
.PHONY: all
|
2017-09-21 14:34:26 +00:00
|
|
|
all: install serve
|
|
|
|
|
2022-11-17 10:27:34 +00:00
|
|
|
.PHONY: install
|
2017-09-21 14:34:26 +00:00
|
|
|
install:
|
2018-10-04 08:18:48 +00:00
|
|
|
test -d $(VENV) || python3 -m venv $(VENV)
|
2021-07-02 07:21:36 +00:00
|
|
|
$(PIP) install --upgrade --no-cache pip setuptools -r requirements.txt -r requirements-dev.txt
|
2017-09-21 14:34:26 +00:00
|
|
|
|
2022-11-17 10:27:34 +00:00
|
|
|
.PHONY: clean
|
2017-09-21 14:34:26 +00:00
|
|
|
clean:
|
|
|
|
rm -fr $(VENV)
|
|
|
|
|
2022-11-17 10:27:34 +00:00
|
|
|
.PHONY: check-outdated
|
2017-09-21 14:34:26 +00:00
|
|
|
check-outdated:
|
|
|
|
$(PIP) list --outdated --format=columns
|
|
|
|
|
2022-11-17 10:27:34 +00:00
|
|
|
.PHONY: test
|
2017-09-22 09:30:21 +00:00
|
|
|
test:
|
2022-11-19 09:15:00 +00:00
|
|
|
$(PYTHON) -m flake8 afpy
|
|
|
|
$(PYTHON) -m pytest tests.py afpy/ --black --cov=afpy --cov=tests --cov-report=term-missing
|
2017-09-22 09:30:21 +00:00
|
|
|
|
2022-11-17 10:27:34 +00:00
|
|
|
.PHONY: serve
|
2017-09-21 14:34:26 +00:00
|
|
|
serve:
|
2021-07-02 07:21:36 +00:00
|
|
|
$(PYTHON) run.py
|
2018-10-04 08:36:46 +00:00
|
|
|
|
2022-11-17 10:27:34 +00:00
|
|
|
.PHONY: publish
|
|
|
|
publish:
|
|
|
|
# To get the right to publish, add your public key in the nginx_public_deploy_key here:
|
|
|
|
# https://git.afpy.org/AFPy/infra/src/branch/main/afpy.org.yml
|
|
|
|
rsync -a ./ afpy-org@deb2.afpy.org:/home/afpy-org/src/
|
|
|
|
ssh afpy-org@deb2.afpy.org '\
|
|
|
|
/home/afpy-org/venv/bin/python -m pip install --upgrade setuptools wheel pip; \
|
|
|
|
/home/afpy-org/venv/bin/python -m pip install -r /home/afpy-org/src/requirements.txt; \
|
|
|
|
/home/afpy-org/venv/bin/python -m pip install sentry-sdk[flask]; \
|
|
|
|
sudo systemctl restart afpy-org.service; \
|
|
|
|
'
|