-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
57 lines (45 loc) · 1.59 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
BIN_DIR ?= $(PWD)/tests/bin
PYTHON_VENV ?= $(PWD)/.venv
BUILD_ROOT ?= $(PWD)/build
run-python-venv=(. $(PYTHON_VENV)/bin/activate && $1)
pyenv:
python3 -m venv $(PYTHON_VENV)
chmod +x $(PYTHON_VENV)/bin/activate
.PHONY: install-deps
install-deps:
$(call run-python-venv, pip3 install -r requirements.txt)
.PHONY: update-deps
update-deps:
$(call run-python-venv, pip-compile requirements.in > requirements.txt)
.PHONY: download-binaries
download-binaries:
mkdir -p $(BIN_DIR)
cd $(BIN_DIR) && curl -L -O https://github.com/tabulapdf/tabula-java/releases/download/v1.0.4/tabula-1.0.4-jar-with-dependencies.jar
cd $(BIN_DIR) && curl -L -O http://archive.apache.org/dist/tika/tika-app-1.24.1.jar
.PHONY: setup
setup: pyenv install-deps download-binaries
$(call run-python-venv, pre-commit install)
.PHONY: check
check:
$(call run-python-venv, python -m isort --check --diff $(ISORT_ARGS) **/*.py)
$(call run-python-venv, black --check **/*.py)
$(call run-python-venv, flake8 **/*.py)
.PHONY: format
format:
$(call run-python-venv, python -m isort **/*.py)
$(call run-python-venv, black **/*.py)
.PHONY: test
test:
$(call run-python-venv, python -m unittest discover -f --start-directory=tests --pattern "*.py")
.PHONY: coverage
coverage:
$(call run-python-venv, coverage erase)
$(call run-python-venv, coverage run -m unittest discover -f --start-directory=tests --pattern "*.py")
$(call run-python-venv, coverage report -m)
.PHONY: build
build:
mkdir -p $(BUILD_ROOT)
python3 setup.py install --root=$(BUILD_ROOT) --prefix=/usr
.PHONY: publish
publish:
$(call run-python-venv, python setup.py upload)