Skip to content

Commit 6635444

Browse files
committed
Add special handling for several versions of Python
Signed-off-by: Stefan Weil <[email protected]>
1 parent 018205d commit 6635444

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ TENSORFLOW_2_1 := 2.1
6868

6969
endif
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+
7174
define SEMGIT
7275
$(if $(shell sem --version 2>/dev/null),sem --will-cite --fg --id ocrd_all_git,$(error cannot find package GNU parallel))
7376
endef
@@ -230,6 +233,10 @@ $(SHARE)/opencv-python: opencv-python/setup.py | $(ACTIVATE_VENV) $(SHARE) $(SHA
230233
$(BIN)/ocrd: $(SHARE)/opencv-python
231234
endif
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
233240
ifneq ($(findstring ocrd_kraken, $(OCRD_MODULES)),)
234241
OCRD_EXECUTABLES += $(OCRD_KRAKEN)
235242
install-models: install-models-kraken
@@ -241,7 +248,11 @@ OCRD_KRAKEN := $(BIN)/ocrd-kraken-binarize
241248
OCRD_KRAKEN += $(BIN)/ocrd-kraken-segment
242249
OCRD_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)
246257
endif
247258

0 commit comments

Comments
 (0)