55
66# Python version (python3 required).
77export PYTHON ?= python3
8- # Python packaging
9- export PIP ?= pip3
108# PIP_OPTIONS ?= # empty
119# Derived variable to allow filtering -e, or inserting other options
1210# (the option --editable must always be last and only applies to src install)
@@ -56,10 +54,10 @@ create_venv := $(shell $(PYTHON) -m venv $(SUB_VENV)/headless-tf21 && bash -c "s
5654endif
5755
5856# Try to install different versions of Tensorflow.
59- ifneq (, $(shell bash -c "source $(SUB_VENV ) /headless-tf1/bin/activate && $( PIP ) install tensorflow-gpu==1.15" >/dev/null 2>&1 && echo true) )
57+ ifneq (, $(shell bash -c "source $(SUB_VENV ) /headless-tf1/bin/activate && pip install tensorflow-gpu==1.15" >/dev/null 2>&1 && echo true) )
6058TENSORFLOW_1 := 1
6159endif
62- ifneq (, $(shell bash -c "source $(SUB_VENV ) /headless-tf21/bin/activate && $( PIP ) install tensorflow==2.1" >/dev/null 2>&1 && echo true) )
60+ ifneq (, $(shell bash -c "source $(SUB_VENV ) /headless-tf21/bin/activate && pip install tensorflow==2.1" >/dev/null 2>&1 && echo true) )
6361TENSORFLOW_2_1 := 2.1
6462endif
6563
@@ -184,15 +182,15 @@ deinit:
184182
185183# Get Python modules.
186184
187- $(VIRTUAL_ENV ) /bin/$( PIP ) : $(ACTIVATE_VENV )
188- . $(ACTIVATE_VENV ) && $(SEMPIP ) $( PIP ) install --upgrade pip setuptools
185+ $(VIRTUAL_ENV ) /bin/pip : $(ACTIVATE_VENV )
186+ . $(ACTIVATE_VENV ) && $(SEMPIP ) pip install --upgrade pip setuptools
189187
190188$(ACTIVATE_VENV ) $(VIRTUAL_ENV ) :
191189 $(SEMPIP ) $(PYTHON ) -m venv $(VIRTUAL_ENV )
192190
193191# avoid making this .PHONY so it does not have to be repeated
194192$(SHARE ) /numpy : | $(ACTIVATE_VENV ) $(SHARE )
195- . $(ACTIVATE_VENV ) && $(SEMPIP ) $( PIP ) install $(PIP_OPTIONS_E ) numpy
193+ . $(ACTIVATE_VENV ) && $(SEMPIP ) pip install $(PIP_OPTIONS_E ) numpy
196194 @touch $@
197195
198196# Install modules from source.
@@ -201,7 +199,7 @@ $(SHARE)/numpy: | $(ACTIVATE_VENV) $(SHARE)
201199ocrd : $(BIN ) /ocrd
202200deps-ubuntu-modules : core
203201$(BIN ) /ocrd : core
204- . $(ACTIVATE_VENV ) && $(MAKE ) -C $< install PIP_INSTALL=" $( SEMPIP) $( PIP ) install $( PIP_OPTIONS) " && touch -c $@
202+ . $(ACTIVATE_VENV ) && $(MAKE ) -C $< install PIP_INSTALL=" $( SEMPIP) pip install $( PIP_OPTIONS) " && touch -c $@
205203
206204# Convert the executable names (1) to a pattern rule,
207205# so that the recipe will be used with single-recipe-
@@ -214,7 +212,7 @@ OCRD_EXECUTABLES += $(PAGE2IMG)
214212PAGE2IMG := $(BIN ) /page2img
215213format-converters/page2img.py : format-converters
216214$(PAGE2IMG ) : format-converters/page2img.py
217- . $(ACTIVATE_VENV ) && $(SEMPIP ) $( PIP ) install validators
215+ . $(ACTIVATE_VENV ) && $(SEMPIP ) pip install validators
218216 echo " #!$( BIN) /python3" | cat - $< > $@
219217 chmod +x $@
220218endif
@@ -227,7 +225,7 @@ opencv-python: GIT_RECURSIVE = --recursive
227225opencv-python/setup.py : opencv-python
228226$(SHARE ) /opencv-python : opencv-python/setup.py | $(ACTIVATE_VENV ) $(SHARE ) $(SHARE ) /numpy
229227 . $(ACTIVATE_VENV ) && cd opencv-python && ENABLE_HEADLESS=1 $(PYTHON ) setup.py bdist_wheel
230- . $(ACTIVATE_VENV ) && $(SEMPIP ) $( PIP ) install $(<D ) /dist/opencv_python_headless-* .whl
228+ . $(ACTIVATE_VENV ) && $(SEMPIP ) pip install $(<D ) /dist/opencv_python_headless-* .whl
231229 @touch $@
232230$(BIN ) /ocrd : $(SHARE ) /opencv-python
233231endif
@@ -282,7 +280,7 @@ OCRD_EXECUTABLES += $(OCRD_DETECTRON2)
282280OCRD_DETECTRON2 := $(BIN ) /ocrd-detectron2-segment
283281$(OCRD_DETECTRON2 ) : ocrd_detectron2
284282 # . $(ACTIVATE_VENV) && $(MAKE) -C $< deps
285- . $(ACTIVATE_VENV ) && cd $< && $( PIP ) install ' git+https://github.com/facebookresearch/detectron2.git' && $( PIP ) install -r requirements.txt
283+ . $(ACTIVATE_VENV ) && cd $< && pip install ' git+https://github.com/facebookresearch/detectron2.git' && pip install -r requirements.txt
286284 $(pip_install )
287285endif
288286
@@ -621,11 +619,11 @@ endif
621619# the binary itself updates):
622620ifeq ($(findstring headless-tf1, $(VIRTUAL_ENV ) ) ,)
623621define pip_install
624- . $(ACTIVATE_VENV ) && cd $< && $(SEMPIP ) $( PIP ) install $(PIP_OPTIONS_E ) . && touch -c $@
622+ . $(ACTIVATE_VENV ) && cd $< && $(SEMPIP ) pip install $(PIP_OPTIONS_E ) . && touch -c $@
625623endef
626624else
627625define pip_install
628- . $(ACTIVATE_VENV ) && cd $< && $(SEMPIP ) $( PIP ) install -c $(CURDIR ) /constraints_tf1.txt $(PIP_OPTIONS_E ) . && touch -c $@
626+ . $(ACTIVATE_VENV ) && cd $< && $(SEMPIP ) pip install -c $(CURDIR ) /constraints_tf1.txt $(PIP_OPTIONS_E ) . && touch -c $@
629627endef
630628endif
631629
@@ -680,14 +678,14 @@ endif
680678# avoid making these .PHONY so they do not have to be repeated:
681679# tesserocr
682680$(SHARE ) /% : % | $(ACTIVATE_VENV ) $(SHARE )
683- . $(ACTIVATE_VENV ) && cd $< && $(SEMPIP ) $( PIP ) install $(PIP_OPTIONS ) .
681+ . $(ACTIVATE_VENV ) && cd $< && $(SEMPIP ) pip install $(PIP_OPTIONS ) .
684682 @touch $@
685683
686684$(SHARE ) :
687685 @mkdir -p " $@ "
688686
689687# At last, add venv dependency (must not become first):
690- $(OCRD_EXECUTABLES ) : | $(VIRTUAL_ENV ) /bin/$( PIP )
688+ $(OCRD_EXECUTABLES ) : | $(VIRTUAL_ENV ) /bin/pip
691689$(OCRD_EXECUTABLES ) :
692690# Also, add core dependency (but in a non-circular way):
693691$(filter-out $(BIN ) /ocrd,$(OCRD_EXECUTABLES ) ) : $(BIN ) /ocrd
@@ -700,7 +698,7 @@ show:
700698 @echo OCRD_EXECUTABLES = $(OCRD_EXECUTABLES:$(BIN ) /%=% )
701699
702700check : $(OCRD_EXECUTABLES:%=%-check ) $(OCRD_MODULES:%=%-check )
703- . $(ACTIVATE_VENV ) && $( PIP ) check
701+ . $(ACTIVATE_VENV ) && pip check
704702% -check : ;
705703
706704.PHONY : $(OCRD_EXECUTABLES:%=%-check )
0 commit comments