-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
47 lines (37 loc) · 1.44 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
SHELL := bash
PYTHON := python3
help:
@echo
@echo " Targets"
@echo
@echo " install Install in the current Python environment"
@echo " deps-test Install extra dependency for testing"
@echo " test-api Run the API tests (using pytest)"
@echo " test-cli Run the CLI tests (optionally using xmlstarlet)"
@echo " test Run both kinds of tests"
@echo " build Create source and binary pkgs under dist/"
@echo " publish Upload pkgs from dist/ to PyPI"
@echo
@echo " Variables"
@echo
@echo " PYTEST_ARGS Additional arguments for pytest [$(PYTEST_ARGS)]"
@echo " PYTHON Name of the Python binary [$(PYTHON)]"
install:
$(PYTHON) -m pip install .
deps-test:
$(PYTHON) -m pip install pytest lxml
test: test-api test-cli
test-api:
$(PYTHON) -m pytest $(PYTEST_ARGS) tests
test-cli: OUT != mktemp -u
test-cli: UNDATED := xmlstarlet ed -N pc=http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15 -d /pc:PcGts/pc:Metadata/* -d "/pc:PcGts/pc:Page/@imageFilename"
test-cli:
cd tests/workspace; textract2page -O $(OUT) textract_responses/18xx-Missio-EMU-0042.json images/18xx-Missio-EMU-0042.jpg
if command -v xmlstarlet &> /dev/null; then diff -u <($(UNDATED) tests/workspace/reference_page_xml/18xx-Missio-EMU-0042.xml) <($(UNDATED) $(OUT)); fi
-$(RM) $(OUT)
build:
$(PYTHON) -m pip build
publish:
twine check dist/*
twine upload dist/*
.PHONY: help install deps-test test test-api test-cli build publish