-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
87 lines (68 loc) · 2.21 KB
/
Makefile
File metadata and controls
87 lines (68 loc) · 2.21 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
DOCKER_BASE_IMAGE ?= docker.io/ocrd/core:latest
DOCKER_TAG ?= ocrd/fileformat
DOCKER ?= docker
PYTHON ?= python3
PIP ?= pip3
PYTEST_ARGS ?= -vv
# BEGIN-EVAL makefile-parser --make-help Makefile
help:
@echo ""
@echo " Targets"
@echo ""
@echo " deps-ubuntu Install system dependencies"
@echo " deps Install Python dependency"
@echo " install Install Python package and scripts"
@echo " uninstall Uninstall Python package and scripts"
@echo " build Build Python package source and binary distribution"
@echo " docker Build Docker image"
@echo " tests/assets Setup test assets"
@echo " assets-clean Remove tests/assets"
@echo " deps-test Install dev dependencies with pip"
@echo " test Run tests with pytest"
deps-ubuntu:
apt-get update && apt-get install -y openjdk-11-jdk-headless wget git gcc unzip
deps:
$(PIP) install -r requirements.txt
install-fileformat:
make -C repo/ocr-fileformat PREFIX=$(VIRTUAL_ENV) vendor install
install: install-fileformat
$(PIP) install .
# Uninstall scripts and $(SHAREDIR)
uninstall:
-$(PIP) uninstall ocrd_fileformat
-$(MAKE) -C repo/ocr-fileformat PREFIX=$(PREFIX) uninstall
build:
$(PIP) install build
$(PYTHON) -m build .
# Build Docker image
docker:
$(DOCKER) build \
--build-arg DOCKER_BASE_IMAGE=$(DOCKER_BASE_IMAGE) \
--build-arg VCS_REF=$$(git rev-parse --short HEAD) \
--build-arg BUILD_DATE=$$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
-t $(DOCKER_TAG) .
#
# Assets
#
.PHONY: always-update
repo/assets repo/ocr-fileformat: always-update
git submodule sync --recursive $@
if git submodule status --recursive $@ | grep -qv '^ '; then \
git submodule update --init --recursive $@ && \
touch -c $@; \
fi
.PHONY: assets assets-clean
assets: tests/assets
# Setup test assets
tests/assets: repo/assets
mkdir -p tests/assets
cp -r repo/assets/data/* tests/assets
assets-clean:
-$(RM) -rf tests/assets
# Install dev dependencies with pip
deps-test:
$(PIP) install -r requirements-test.txt
# Run tests with pytest
test:
$(PYTHON) -m pytest tests --durations=0 $(PYTEST_ARGS)
.PHONY: help deps deps-test install-fileformat install uninstall build docker