| 
									
										
										
										
											2019-08-21 19:52:08 +02:00
										 |  |  | # '$(PYTHON)'
 | 
					
						
							|  |  |  | PYTHON = python | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # '$(PIP_INSTALL)'
 | 
					
						
							|  |  |  | PIP_INSTALL = pip install | 
					
						
							| 
									
										
										
										
											2019-10-26 22:12:16 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-21 19:52:08 +02:00
										 |  |  | # '$(GIT_CLONE)'
 | 
					
						
							| 
									
										
										
										
											2019-12-03 16:23:41 +01:00
										 |  |  | GIT_CLONE = git clone | 
					
						
							| 
									
										
										
										
											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" | 
					
						
							|  |  |  | 	@echo "    calamari         Clone calamari repo" | 
					
						
							|  |  |  | 	@echo "    calamari_models  Clone calamari_models repo" | 
					
						
							|  |  |  | 	@echo "    calamari/build   pip install calamari" | 
					
						
							|  |  |  | 	@echo "    deps-test        Install testing python deps via pip" | 
					
						
							|  |  |  | 	@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-08-21 19:52:08 +02:00
										 |  |  | 	@echo "    PYTHON       '$(PYTHON)'" | 
					
						
							|  |  |  | 	@echo "    PIP_INSTALL  '$(PIP_INSTALL)'" | 
					
						
							|  |  |  | 	@echo "    GIT_CLONE    '$(GIT_CLONE)'" | 
					
						
							| 
									
										
										
										
											2019-10-26 22:12:16 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | # END-EVAL
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-21 19:52:08 +02:00
										 |  |  | # Install ocrd_calamari
 | 
					
						
							|  |  |  | install: | 
					
						
							|  |  |  | 	$(PIP_INSTALL) . | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Clone calamari repo
 | 
					
						
							| 
									
										
										
										
											2018-07-26 19:09:07 +02:00
										 |  |  | calamari: | 
					
						
							|  |  |  | 	$(GIT_CLONE) https://github.com/chwick/calamari | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-21 19:52:08 +02:00
										 |  |  | # Clone calamari_models repo
 | 
					
						
							| 
									
										
										
										
											2018-07-26 19:09:07 +02:00
										 |  |  | calamari_models: | 
					
						
							| 
									
										
										
										
											2019-12-03 16:23:41 +01:00
										 |  |  | 	$(GIT_CLONE) -n https://github.com/chwick/calamari_models | 
					
						
							|  |  |  | 	# Checkout latest version that works with calamari-ocr==0.3.5: | 
					
						
							| 
									
										
										
										
											2019-12-03 16:29:18 +01:00
										 |  |  | 	cd calamari_models && git checkout f76b1d3ec | 
					
						
							| 
									
										
										
										
											2019-12-03 16:23:41 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-26 19:09:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-21 19:52:08 +02:00
										 |  |  | # pip install calamari
 | 
					
						
							| 
									
										
										
										
											2018-07-26 19:09:07 +02:00
										 |  |  | calamari/build: calamari calamari_models | 
					
						
							| 
									
										
										
										
											2019-08-21 19:52:08 +02:00
										 |  |  | 	cd calamari && $(PIP_INSTALL) . | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | # Assets and Tests
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Install testing python deps via pip
 | 
					
						
							|  |  |  | deps-test: | 
					
						
							|  |  |  | 	$(PIP) install -r requirements_test.txt | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # 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
 | 
					
						
							|  |  |  | test: test/assets calamari_models | 
					
						
							|  |  |  | 	# declare -p HTTP_PROXY | 
					
						
							|  |  |  | 	$(PYTHON) -m pytest --continue-on-collection-errors test $(PYTEST_ARGS) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Run unit tests and determine test coverage
 | 
					
						
							| 
									
										
										
										
											2019-08-21 19:54:35 +02:00
										 |  |  | coverage: test/assets calamari_models | 
					
						
							| 
									
										
										
										
											2019-08-21 19:52:08 +02:00
										 |  |  | 	coverage erase | 
					
						
							|  |  |  | 	make test PYTHON="coverage run" | 
					
						
							|  |  |  | 	coverage report | 
					
						
							|  |  |  | 	coverage html | 
					
						
							| 
									
										
										
										
											2019-10-26 22:12:16 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-21 19:52:08 +02:00
										 |  |  | .PHONY: assets-clean test |