-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new macro PYTHON_VERSION #297
Conversation
We could use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makefile
Outdated
ifeq ($(PYTHON_VERSION),3.10) | ||
# Python 3.10.x does not work with current kraken. | ||
override OCRD_MODULES := $(filter-out ocrd_kraken, $(OCRD_MODULES)) | ||
endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This defies several layers of module selection mechanisms that are already in place.
If the user chose to install the ocrd_kraken module, then it is wrong to silently ignore it.
The proper way to remove a module for a certain Python version by default would be to include it in DISABLED_MODULES
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So
DISABLED_MODULES ?= cor-asv-fst opencv-python ocrd_ocropy
ifeq ($(PYTHON_VERSION),3.10)
# Python 3.10.x does not work with current kraken.
DISABLED_MODULES += ocrd_kraken
endif
would still allow overriding with OCRD_MODULES
but disables it by default for 3.10?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite. That would still override any explicit user (or Docker) setting for DISABLED_MODULES
. But we only want to override the actual default:
ifeq ($(PYTHON_VERSION),3.10)
# Python 3.10.x does not work with current kraken.
DISABLED_MODULES ?= cor-asv-fst opencv-python ocrd_ocropy ocrd_kraken
else
DISABLED_MODULES ?= cor-asv-fst opencv-python ocrd_ocropy
endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My patch disables ocrd_kraken
unconditionally for Python 3.10 (which is necessary because that combination does not work). The proposed alternatives don't do that. Therefore I don't think they are equally good or even better. I think the alternative proposed by @kba is fine and would work, too, but the alternative suggested by @bertsky would not disable unconditionally.
Both alternatives have the disadvantage of separating the implementation details for ocrd_kraken
in the Makefile. As far as I remember it was you, @bertsky, who wanted to keep such details together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could discuss how to handle submodules which are disabled automatically because they don't work. Instead of silently disabling them, there could be a report (for example at the end of the build process) about those disabled submodules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My patch disables
ocrd_kraken
unconditionally for Python 3.10
exactly.
(which is necessary because that combination does not work)
thus, let it fail (loudly)!
Therefore I don't think they are equally good or even better.
As argued above, they are better (you did not address the arguments).
We could discuss how to handle submodules which are disabled automatically because they don't work. Instead of silently disabling them, there could be a report (for example at the end of the build process) about those disabled submodules.
That would only complicate matters further, and goes against the user expectations of running make
. If a module does not work in your environment (whatever the cause or kind), then the simplest and uniform answer is that module's build failing (while others can continue if running with -k
). Also, the build is incremental, so as soon as the user fixed it (by disabling the module or installing by hand), one can continue.
Makefile
Outdated
DISABLED_MODULES ?= cor-asv-fst opencv-python ocrd_kraken clstm ocrd_ocropy | ||
ifeq ($(PYTHON_VERSION),3.10) | ||
# Python 3.10.x does not work with current kraken. | ||
DISABLED_MODULES ?= cor-asv-fst opencv-python ocrd_ocropy ocrd_kraken |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That pattern no longer works as soon as I want to disable other submodules for other Python versions!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That pattern no longer works as soon as I want to disable other submodules for other Python versions!
If and when that happens, make
still offers plenty of other syntax to achieve the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I need your help. How would that look like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, something along the lines of:
DISABLED_MODULES ?= $(DEFAULT_DISABLED_MODULES)
DEFAULT_DISABLED_MODULES = cor-asv-fst opencv-python ocrd_ocropy
ifeq ($(PYTHON_VERSION),3.10)
# Python 3.10.x does not work with current kraken.
DISABLED_MODULES += ocrd_kraken
endif
ifeq (...)
DISABLED_MODULES += ...
endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would change the user interface, right? Instead of providing DISABLED_MODULES
they would have to use DEFAULT_DISABLED_MODULES
. Of course all documentation would require an update, too.
Would that be acceptable and better than my original solution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it would not. The user does not need to know anything about DEFAULT_DISABLED_MODULES
. In fact, that is the whole point (to have a dynamic default, but allowing explicit user-defined opt-outs as already documented).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I now pushed a commit which updates the handling of DISABLED_MODULES
as you suggested (with a small fix).
It is used for special handling of several versions of Python, here to disable ocrd_kraken with Python 3.10. Signed-off-by: Stefan Weil <[email protected]>
Signed-off-by: Stefan Weil <[email protected]>
It is used for special handling of several versions of Python,
here to disable ocrd_kraken with Python 3.10.
Signed-off-by: Stefan Weil [email protected]