| 
									
										
										
										
											2020-01-15 18:07:39 +01:00
										 |  |  | export  # export variables to subshells
 | 
					
						
							| 
									
										
										
										
											2019-12-03 13:37:50 +01:00
										 |  |  | PIP_INSTALL = pip3 install | 
					
						
							| 
									
										
										
										
											2019-12-03 16:23:41 +01:00
										 |  |  | GIT_CLONE = git clone | 
					
						
							| 
									
										
										
										
											2019-12-04 17:35:48 +01:00
										 |  |  | PYTHON = python3 | 
					
						
							| 
									
										
										
										
											2019-12-05 11:23:20 +01:00
										 |  |  | PYTEST_ARGS = -W 'ignore::DeprecationWarning' -W 'ignore::FutureWarning' | 
					
						
							| 
									
										
										
										
											2022-02-11 07:52:50 +01:00
										 |  |  | MODEL = qurator-gt4histocr-1.0 | 
					
						
							| 
									
										
										
										
											2019-10-26 22:12:16 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | # BEGIN-EVAL makefile-parser --make-help Makefile
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | help: | 
					
						
							|  |  |  | 	@echo "" | 
					
						
							|  |  |  | 	@echo "  Targets" | 
					
						
							|  |  |  | 	@echo "" | 
					
						
							| 
									
										
										
										
											2019-08-21 19:52:08 +02:00
										 |  |  | 	@echo "    install          Install ocrd_calamari" | 
					
						
							| 
									
										
										
										
											2022-02-11 07:52:50 +01:00
										 |  |  | 	@echo "    $(MODEL)         Get Calamari model (from SBB)" | 
					
						
							| 
									
										
										
										
											2020-02-06 13:53:55 +01:00
										 |  |  | 	@echo "    actevedef_718448162 Download example data" | 
					
						
							| 
									
										
										
										
											2019-12-04 16:59:27 +01:00
										 |  |  | 	@echo "    deps-test        Install testing python deps via pip" | 
					
						
							| 
									
										
										
										
											2019-12-04 16:50:08 +01:00
										 |  |  | 	@echo "    repo/assets      Clone OCR-D/assets to ./repo/assets" | 
					
						
							|  |  |  | 	@echo "    test/assets      Setup test assets" | 
					
						
							|  |  |  | 	@echo "    assets-clean     Remove symlinks in test/assets" | 
					
						
							|  |  |  | 	@echo "    test             Run unit tests" | 
					
						
							|  |  |  | 	@echo "    coverage         Run unit tests and determine test coverage" | 
					
						
							| 
									
										
										
										
											2019-10-26 22:12:16 +02:00
										 |  |  | 	@echo "" | 
					
						
							|  |  |  | 	@echo "  Variables" | 
					
						
							|  |  |  | 	@echo "" | 
					
						
							| 
									
										
										
										
											2019-12-04 17:35:48 +01:00
										 |  |  | 	@echo "    PYTHON       '$(PYTHON)'" | 
					
						
							| 
									
										
										
										
											2019-08-21 19:52:08 +02:00
										 |  |  | 	@echo "    PIP_INSTALL  '$(PIP_INSTALL)'" | 
					
						
							|  |  |  | 	@echo "    GIT_CLONE    '$(GIT_CLONE)'" | 
					
						
							| 
									
										
										
										
											2022-02-11 07:52:50 +01:00
										 |  |  | 	@echo "    MODEL        '$(MODEL)'" | 
					
						
							| 
									
										
										
										
											2019-10-26 22:12:16 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | # END-EVAL
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-21 19:52:08 +02:00
										 |  |  | # Install ocrd_calamari
 | 
					
						
							|  |  |  | install: | 
					
						
							|  |  |  | 	$(PIP_INSTALL) . | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-26 19:09:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-06 13:53:55 +01:00
										 |  |  | # Get GT4HistOCR Calamari model (from SBB)
 | 
					
						
							| 
									
										
										
										
											2022-02-11 07:52:50 +01:00
										 |  |  | $(MODEL): | 
					
						
							|  |  |  | 	ocrd resmgr download ocrd-calamari-recognize $@ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Download example data (not used currently)
 | 
					
						
							| 
									
										
										
										
											2020-02-05 17:39:37 +01:00
										 |  |  | actevedef_718448162: | 
					
						
							| 
									
										
										
										
											2022-02-11 07:52:50 +01:00
										 |  |  | 	wget https://qurator-data.de/examples/actevedef_718448162.zip \
 | 
					
						
							|  |  |  | 	&& unzip actevedef_718448162.zip \
 | 
					
						
							|  |  |  | 	&& rm actevedef_718448162.zip | 
					
						
							| 
									
										
										
										
											2019-12-05 13:02:20 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-26 19:09:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 16:50:08 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | # Assets and Tests
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Install testing python deps via pip
 | 
					
						
							|  |  |  | deps-test: | 
					
						
							| 
									
										
										
										
											2022-02-11 07:50:04 +01:00
										 |  |  | 	$(PIP_INSTALL) -r requirements-test.txt | 
					
						
							| 
									
										
										
										
											2019-12-04 16:50:08 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-24 16:54:56 +01:00
										 |  |  | deps-test-ubuntu: deps-test | 
					
						
							|  |  |  | 	apt-get install -y make git curl wget imagemagick | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 16:50:08 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Clone OCR-D/assets to ./repo/assets
 | 
					
						
							|  |  |  | repo/assets: | 
					
						
							|  |  |  | 	mkdir -p $(dir $@) | 
					
						
							|  |  |  | 	git clone https://github.com/OCR-D/assets "$@" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Setup test assets
 | 
					
						
							|  |  |  | test/assets: repo/assets | 
					
						
							|  |  |  | 	mkdir -p $@ | 
					
						
							|  |  |  | 	cp -r -t $@ repo/assets/data/* | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Remove symlinks in test/assets
 | 
					
						
							|  |  |  | assets-clean: | 
					
						
							|  |  |  | 	rm -rf test/assets | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Run unit tests
 | 
					
						
							| 
									
										
										
										
											2022-02-11 07:52:50 +01:00
										 |  |  | test: test/assets $(MODEL) | 
					
						
							| 
									
										
										
										
											2019-12-04 16:50:08 +01:00
										 |  |  | 	# declare -p HTTP_PROXY | 
					
						
							| 
									
										
										
										
											2019-12-04 17:35:48 +01:00
										 |  |  | 	$(PYTHON) -m pytest --continue-on-collection-errors test $(PYTEST_ARGS) | 
					
						
							| 
									
										
										
										
											2019-12-04 16:50:08 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Run unit tests and determine test coverage
 | 
					
						
							| 
									
										
										
										
											2022-02-11 07:52:50 +01:00
										 |  |  | coverage: test/assets $(MODEL) | 
					
						
							| 
									
										
										
										
											2019-12-04 16:50:08 +01:00
										 |  |  | 	coverage erase | 
					
						
							|  |  |  | 	make test PYTHON="coverage run" | 
					
						
							|  |  |  | 	coverage report | 
					
						
							|  |  |  | 	coverage html | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-11 07:52:50 +01:00
										 |  |  | .PHONY: install assets-clean deps-test test coverage $(MODEL) |