@@ -68,6 +68,9 @@ TENSORFLOW_2_1 := 2.1
6868
6969endif
7070
71+ # Get Python major and minor versions for some conditional rules.
72+ PYTHON_VERSION := $(shell bash -c "$(PYTHON ) -c 'import sys; print(\"% u.% u\" % (sys.version_info.major, sys.version_info.minor) )'")
73+
7174define SEMGIT
7275$(if $(shell sem --version 2>/dev/null) ,sem --will-cite --fg --id ocrd_all_git,$(error cannot find package GNU parallel) )
7376endef
@@ -230,6 +233,10 @@ $(SHARE)/opencv-python: opencv-python/setup.py | $(ACTIVATE_VENV) $(SHARE) $(SHA
230233$(BIN ) /ocrd : $(SHARE ) /opencv-python
231234endif
232235
236+ ifeq ($(PYTHON_VERSION ) ,3.10)
237+ # Python 3.10.x does not work with current kraken.
238+ override OCRD_MODULES := $(filter-out ocrd_kraken, $(OCRD_MODULES ) )
239+ endif
233240ifneq ($(findstring ocrd_kraken, $(OCRD_MODULES ) ) ,)
234241OCRD_EXECUTABLES += $(OCRD_KRAKEN )
235242install-models : install-models-kraken
@@ -241,7 +248,11 @@ OCRD_KRAKEN := $(BIN)/ocrd-kraken-binarize
241248OCRD_KRAKEN += $(BIN ) /ocrd-kraken-segment
242249OCRD_KRAKEN += $(BIN ) /ocrd-kraken-recognize
243250$(call multirule,$(OCRD_KRAKEN ) ) : ocrd_kraken $(BIN ) /ocrd
251+ ifneq ($(PYTHON_VERSION ) ,3.6)
252+ # Python 3.6 only works with kraken 3.0.9.
253+ # Newer versions of Python require kraken 4.0 or newer.
244254 pip install 'git+https://github.com/stweil/kraken.git'
255+ endif
245256 $(pip_install)
246257endif
247258
0 commit comments