Skip to content

Commit

Permalink
Merge remote-tracking branch 'bertsky/fix-processor-ns-module'
Browse files Browse the repository at this point in the history
  • Loading branch information
kba committed Oct 21, 2022
2 parents 74f8996 + cd81ee7 commit 1751f3c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion ocrd/ocrd/processor/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,16 @@ def module(self):
"""
The top-level module this processor belongs to.
"""
return self.__module__.split('.')[0]
# find shortest prefix path that is not just a namespace package
fqname = ''
for name in self.__module__.split('.'):
if fqname:
fqname += '.'
fqname += name
if sys.modules[fqname].__file__:
return fqname
# fall-back
return self.__module__

@property
def moduledir(self):
Expand Down
2 changes: 1 addition & 1 deletion repo/spec

0 comments on commit 1751f3c

Please sign in to comment.