ocrd 3.10.1__tar.gz → 3.12.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. {ocrd-3.10.1/src/ocrd.egg-info → ocrd-3.12.1}/PKG-INFO +1 -1
  2. ocrd-3.12.1/VERSION +1 -0
  3. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/cli/workspace.py +46 -36
  4. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/mets_server.py +3 -2
  5. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/processor/base.py +2 -2
  6. {ocrd-3.10.1 → ocrd-3.12.1/src/ocrd.egg-info}/PKG-INFO +1 -1
  7. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/constants.py +0 -2
  8. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/processing_server.py +1 -1
  9. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/runtime_data/network_services.py +2 -4
  10. ocrd-3.10.1/VERSION +0 -1
  11. {ocrd-3.10.1 → ocrd-3.12.1}/LICENSE +0 -0
  12. {ocrd-3.10.1 → ocrd-3.12.1}/MANIFEST.in +0 -0
  13. {ocrd-3.10.1 → ocrd-3.12.1}/README.md +0 -0
  14. {ocrd-3.10.1 → ocrd-3.12.1}/README_ocrd.md +0 -0
  15. {ocrd-3.10.1 → ocrd-3.12.1}/README_ocrd_modelfactory.md +0 -0
  16. {ocrd-3.10.1 → ocrd-3.12.1}/README_ocrd_models.md +0 -0
  17. {ocrd-3.10.1 → ocrd-3.12.1}/README_ocrd_network.md +0 -0
  18. {ocrd-3.10.1 → ocrd-3.12.1}/README_ocrd_utils.md +0 -0
  19. {ocrd-3.10.1 → ocrd-3.12.1}/README_ocrd_validators.md +0 -0
  20. {ocrd-3.10.1 → ocrd-3.12.1}/pyproject.toml +0 -0
  21. {ocrd-3.10.1 → ocrd-3.12.1}/requirements.txt +0 -0
  22. {ocrd-3.10.1 → ocrd-3.12.1}/setup.cfg +0 -0
  23. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/__init__.py +0 -0
  24. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/cli/__init__.py +0 -0
  25. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/cli/bashlib.py +0 -0
  26. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/cli/network.py +0 -0
  27. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/cli/ocrd_tool.py +0 -0
  28. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/cli/process.py +0 -0
  29. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/cli/resmgr.py +0 -0
  30. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/cli/validate.py +0 -0
  31. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/cli/zip.py +0 -0
  32. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/constants.py +0 -0
  33. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/decorators/__init__.py +0 -0
  34. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/decorators/loglevel_option.py +0 -0
  35. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/decorators/mets_find_options.py +0 -0
  36. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/decorators/ocrd_cli_options.py +0 -0
  37. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/decorators/parameter_option.py +0 -0
  38. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/ocrd-all-tool.json +0 -0
  39. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/processor/__init__.py +0 -0
  40. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/processor/builtin/__init__.py +0 -0
  41. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/processor/builtin/dummy/__init__.py +0 -0
  42. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/processor/builtin/dummy/ocrd-tool.json +0 -0
  43. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/processor/builtin/dummy_processor.py +0 -0
  44. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/processor/builtin/filter_processor.py +0 -0
  45. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/processor/builtin/merge_processor.py +0 -0
  46. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/processor/builtin/param_command_header2unordered.json +0 -0
  47. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/processor/builtin/param_command_heading2unordered.json +0 -0
  48. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/processor/builtin/param_command_lines2orientation.json +0 -0
  49. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/processor/builtin/param_command_page-update-version.json +0 -0
  50. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/processor/builtin/param_command_transkribus-to-prima.json +0 -0
  51. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/processor/builtin/shell_processor.py +0 -0
  52. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/processor/helpers.py +0 -0
  53. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/processor/ocrd_page_result.py +0 -0
  54. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/resolver.py +0 -0
  55. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/resource_manager.py +0 -0
  56. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/task_sequence.py +0 -0
  57. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/workspace.py +0 -0
  58. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/workspace_backup.py +0 -0
  59. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd/workspace_bagger.py +0 -0
  60. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd.egg-info/SOURCES.txt +0 -0
  61. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd.egg-info/dependency_links.txt +0 -0
  62. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd.egg-info/entry_points.txt +0 -0
  63. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd.egg-info/requires.txt +0 -0
  64. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd.egg-info/top_level.txt +0 -0
  65. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_modelfactory/__init__.py +0 -0
  66. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_models/__init__.py +0 -0
  67. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_models/constants.py +0 -0
  68. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_models/mets-empty.xml +0 -0
  69. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_models/ocrd_agent.py +0 -0
  70. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_models/ocrd_exif.py +0 -0
  71. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_models/ocrd_file.py +0 -0
  72. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_models/ocrd_mets.py +0 -0
  73. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_models/ocrd_page.py +0 -0
  74. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_models/ocrd_page_generateds.py +0 -0
  75. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_models/ocrd_xml_base.py +0 -0
  76. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_models/report.py +0 -0
  77. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_models/utils.py +0 -0
  78. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_models/xpath_functions.py +0 -0
  79. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/__init__.py +0 -0
  80. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/cli/__init__.py +0 -0
  81. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/cli/client.py +0 -0
  82. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/cli/processing_server.py +0 -0
  83. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/cli/processing_worker.py +0 -0
  84. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/cli/resmgr_server.py +0 -0
  85. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/client.py +0 -0
  86. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/client_utils.py +0 -0
  87. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/database.py +0 -0
  88. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/logging_utils.py +0 -0
  89. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/models/__init__.py +0 -0
  90. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/models/job.py +0 -0
  91. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/models/messages.py +0 -0
  92. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/models/workflow.py +0 -0
  93. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/models/workspace.py +0 -0
  94. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/param_validators.py +0 -0
  95. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/process_helpers.py +0 -0
  96. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/processing_worker.py +0 -0
  97. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/rabbitmq_utils/__init__.py +0 -0
  98. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/rabbitmq_utils/connector.py +0 -0
  99. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/rabbitmq_utils/constants.py +0 -0
  100. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/rabbitmq_utils/consumer.py +0 -0
  101. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/rabbitmq_utils/helpers.py +0 -0
  102. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/rabbitmq_utils/ocrd_messages.py +0 -0
  103. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/rabbitmq_utils/publisher.py +0 -0
  104. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/resource_manager_server.py +0 -0
  105. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/runtime_data/__init__.py +0 -0
  106. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/runtime_data/config_parser.py +0 -0
  107. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/runtime_data/connection_clients.py +0 -0
  108. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/runtime_data/deployer.py +0 -0
  109. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/runtime_data/hosts.py +0 -0
  110. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/runtime_data/network_agents.py +0 -0
  111. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/server_cache.py +0 -0
  112. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/server_utils.py +0 -0
  113. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/tcp_to_uds_mets_proxy.py +0 -0
  114. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_network/utils.py +0 -0
  115. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_utils/__init__.py +0 -0
  116. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_utils/config.py +0 -0
  117. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_utils/constants.py +0 -0
  118. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_utils/deprecate.py +0 -0
  119. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_utils/image.py +0 -0
  120. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_utils/introspect.py +0 -0
  121. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_utils/logging.py +0 -0
  122. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_utils/ocrd_logging.conf +0 -0
  123. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_utils/os.py +0 -0
  124. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_utils/str.py +0 -0
  125. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/__init__.py +0 -0
  126. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/bagit-profile.yml +0 -0
  127. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/constants.py +0 -0
  128. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/json_validator.py +0 -0
  129. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/message_processing.schema.yml +0 -0
  130. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/message_result.schema.yml +0 -0
  131. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/mets.xsd +0 -0
  132. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/ocrd_network_message_validator.py +0 -0
  133. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/ocrd_tool.schema.yml +0 -0
  134. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/ocrd_tool_validator.py +0 -0
  135. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/ocrd_zip_validator.py +0 -0
  136. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/page.xsd +0 -0
  137. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/page_validator.py +0 -0
  138. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/parameter_validator.py +0 -0
  139. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/processing_server_config.schema.yml +0 -0
  140. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/processing_server_config_validator.py +0 -0
  141. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/resource_list_validator.py +0 -0
  142. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/workspace_validator.py +0 -0
  143. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/xlink.xsd +0 -0
  144. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/xsd_mets_validator.py +0 -0
  145. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/xsd_page_validator.py +0 -0
  146. {ocrd-3.10.1 → ocrd-3.12.1}/src/ocrd_validators/xsd_validator.py +0 -0
  147. {ocrd-3.10.1 → ocrd-3.12.1}/tests/test_decorators.py +0 -0
  148. {ocrd-3.10.1 → ocrd-3.12.1}/tests/test_logging.py +0 -0
  149. {ocrd-3.10.1 → ocrd-3.12.1}/tests/test_logging_conf.py +0 -0
  150. {ocrd-3.10.1 → ocrd-3.12.1}/tests/test_mets_server.py +0 -0
  151. {ocrd-3.10.1 → ocrd-3.12.1}/tests/test_model_factory.py +0 -0
  152. {ocrd-3.10.1 → ocrd-3.12.1}/tests/test_resolver.py +0 -0
  153. {ocrd-3.10.1 → ocrd-3.12.1}/tests/test_resolver_oai.py +0 -0
  154. {ocrd-3.10.1 → ocrd-3.12.1}/tests/test_resource_manager.py +0 -0
  155. {ocrd-3.10.1 → ocrd-3.12.1}/tests/test_task_sequence.py +0 -0
  156. {ocrd-3.10.1 → ocrd-3.12.1}/tests/test_utils.py +0 -0
  157. {ocrd-3.10.1 → ocrd-3.12.1}/tests/test_version.py +0 -0
  158. {ocrd-3.10.1 → ocrd-3.12.1}/tests/test_workspace.py +0 -0
  159. {ocrd-3.10.1 → ocrd-3.12.1}/tests/test_workspace_remove.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ocrd
3
- Version: 3.10.1
3
+ Version: 3.12.1
4
4
  Summary: OCR-D framework
5
5
  Author-email: Konstantin Baierer <unixprog@gmail.com>
6
6
  License: Apache License 2.0
ocrd-3.12.1/VERSION ADDED
@@ -0,0 +1 @@
1
+ 3.12.1
@@ -6,7 +6,7 @@ OCR-D CLI: workspace management
6
6
  :nested: full
7
7
  """
8
8
  from os import rmdir, unlink
9
- from os.path import dirname, relpath, normpath, exists, join, isabs, isdir
9
+ from os.path import abspath, dirname, relpath, normpath, exists, join, isabs, isdir
10
10
  from pathlib import Path
11
11
  from json import loads, dumps
12
12
  import sys
@@ -47,7 +47,7 @@ class WorkspaceCtx():
47
47
  def workspace(self):
48
48
  return Workspace(
49
49
  self.resolver,
50
- directory=self.directory,
50
+ self.directory,
51
51
  mets_basename=self.mets_basename,
52
52
  automatic_backup=self.automatic_backup,
53
53
  mets_server_url=self.mets_server_url,
@@ -85,7 +85,7 @@ def workspace_cli(ctx, directory, mets, mets_basename, mets_server_url, backup):
85
85
  initLogging()
86
86
  ctx.obj = WorkspaceCtx(
87
87
  directory,
88
- mets_url=mets,
88
+ mets,
89
89
  mets_basename=mets_basename,
90
90
  mets_server_url=mets_server_url,
91
91
  automatic_backup=backup
@@ -254,22 +254,26 @@ def workspace_add_file(ctx, file_grp, file_id, mimetype, page_id, ignore, check_
254
254
  log.debug("Adding '%s'", fname)
255
255
  local_filename = None
256
256
  if not (fname.startswith('http://') or fname.startswith('https://')):
257
- if not fname.startswith(ctx.directory):
258
- if not isabs(fname) and exists(join(ctx.directory, fname)):
257
+ assert isabs(ctx.directory)
258
+ # try to resolve relative to workspace or CWD
259
+ if not isabs(fname):
260
+ if exists(join(ctx.directory, fname)):
259
261
  fname = join(ctx.directory, fname)
260
262
  else:
261
- log.debug("File '%s' is not in workspace, copying", fname)
262
- try:
263
- fname = ctx.resolver.download_to_directory(ctx.directory, fname, subdir=file_grp)
264
- except FileNotFoundError:
265
- if check_file_exists:
266
- log.error("File '%s' does not exist, halt execution!" % fname)
267
- sys.exit(1)
268
- if check_file_exists and not exists(fname):
269
- log.error("File '%s' does not exist, halt execution!" % fname)
270
- sys.exit(1)
263
+ fname = abspath(fname)
271
264
  if fname.startswith(ctx.directory):
265
+ if check_file_exists and not exists(fname):
266
+ log.error("File '%s' does not exist, halt execution!" % fname)
267
+ sys.exit(1)
272
268
  fname = relpath(fname, ctx.directory)
269
+ else:
270
+ log.debug("File '%s' is not in workspace, copying", fname)
271
+ try:
272
+ fname = ctx.resolver.download_to_directory(ctx.directory, fname, subdir=file_grp)
273
+ except FileNotFoundError:
274
+ if check_file_exists:
275
+ log.error("File '%s' does not exist, halt execution!" % fname)
276
+ sys.exit(1)
273
277
  local_filename = fname
274
278
 
275
279
  if not page_id:
@@ -299,8 +303,8 @@ def workspace_add_file(ctx, file_grp, file_id, mimetype, page_id, ignore, check_
299
303
  @click.option('-g', '--page-id', help="physical page ID of the file", required=False)
300
304
  @click.option('-i', '--file-id', help="ID of the file. If not provided, derive from fileGrp and filename", required=False)
301
305
  @click.option('-u', '--url', help="Remote URL of the file", required=False)
302
- @click.option('-l', '--local-filename', help="Local filesystem path in the workspace directory "
303
- "(copied from source file if different)", required=False)
306
+ @click.option('-l', '--local-filename', help="Relative filesystem path in the workspace directory "
307
+ "(copied from source path if different)", required=False)
304
308
  @click.option('-G', '--file-grp', help="File group USE of the file", required=True)
305
309
  @click.option('-n', '--dry-run', help="Don't actually do anything to the METS or filesystem, just preview",
306
310
  default=False, is_flag=True)
@@ -414,38 +418,45 @@ def workspace_cli_bulk_add(ctx, regex, mimetype, page_id, file_id, url, local_fi
414
418
  raise ValueError(f"OcrdFile attribute '{param_name}' unset ({file_dict})")
415
419
  for group_name in group_dict:
416
420
  file_dict[param_name] = file_dict[param_name].replace('{{ %s }}' % group_name, group_dict[group_name])
421
+ if '{{ ' in file_dict[param_name]:
422
+ log.warning("Probably failed to match a capture group in %s: '%s'", param_name, file_dict[param_name])
417
423
 
418
424
  # Where to copy from
419
425
  if src_path_option:
420
- src_path = src_path_option
421
426
  for group_name in group_dict:
422
- src_path = src_path.replace('{{ %s }}' % group_name, group_dict[group_name])
423
- srcpath = Path(src_path)
427
+ src_path_option = src_path_option.replace('{{ %s }}' % group_name, group_dict[group_name])
428
+ if '{{ ' in src_path_option:
429
+ log.warning("Probably failed to match a capture group in source path: '%s'", src_path_option)
430
+ src_path = Path(src_path_option)
424
431
  else:
425
- srcpath = file_path
432
+ src_path = file_path
426
433
 
427
434
  # derive --file-id from filename if not --file-id not explicitly set
428
435
  if not file_id:
429
- id_field = srcpath.stem if file_path != srcpath else file_path.stem
436
+ id_field = src_path.stem if file_path != src_path else file_path.stem
430
437
  file_dict['file_id'] = safe_filename('%s_%s' % (file_dict['file_grp'], id_field))
431
438
  if not mimetype:
432
439
  try:
433
- file_dict['mimetype'] = EXT_TO_MIME[srcpath.suffix]
440
+ file_dict['mimetype'] = EXT_TO_MIME[src_path.suffix]
434
441
  except KeyError:
435
442
  log.error("Cannot guess MIME type from extension '%s' for '%s'. "
436
- "Set --mimetype explicitly" % (srcpath.suffix, srcpath))
443
+ "Set --mimetype explicitly" % (src_path.suffix, src_path))
437
444
 
438
445
  # copy files if src != url
446
+ src_path = src_path.resolve().absolute()
439
447
  if local_filename_is_src:
440
- file_dict['local_filename'] = srcpath
441
- else:
442
- destpath = Path(workspace.directory, file_dict['local_filename'])
443
- if srcpath != destpath and not destpath.exists():
444
- log.info("cp '%s' '%s'", srcpath, destpath)
445
- if not dry_run:
446
- if not destpath.parent.is_dir():
447
- destpath.parent.mkdir()
448
- destpath.write_bytes(srcpath.read_bytes())
448
+ if str(src_path).startswith(workspace.directory):
449
+ file_dict['local_filename'] = src_path.relative_to(workspace.directory)
450
+ else:
451
+ file_dict['local_filename'] = src_path.name # will be copied-in below
452
+
453
+ dest_path = Path(workspace.directory, file_dict['local_filename'])
454
+ if src_path != dest_path and not dest_path.exists():
455
+ log.info("cp '%s' '%s'", src_path, dest_path)
456
+ if not dry_run:
457
+ if not dest_path.parent.is_dir():
458
+ dest_path.parent.mkdir()
459
+ dest_path.write_bytes(src_path.read_bytes())
449
460
 
450
461
  # Add to workspace (or not)
451
462
  fileGrp = file_dict.pop('file_grp')
@@ -465,8 +476,7 @@ def workspace_cli_bulk_add(ctx, regex, mimetype, page_id, file_id, url, local_fi
465
476
  @workspace_cli.command('find')
466
477
  @mets_find_options
467
478
  @click.option('-k', '--output-field', help="Output field. Repeat for multiple fields, will be joined with tab",
468
- default=['local_filename'],
469
- show_default=True,
479
+ default=['local_filename'], show_default=True,
470
480
  multiple=True,
471
481
  type=click.Choice([
472
482
  'url',
@@ -869,7 +879,7 @@ def merge(ctx, overwrite, force, copy_files, filegrp_mapping, fileid_mapping, pa
869
879
  the same semantics as in ``ocrd workspace find``, see ``ocrd workspace find --help``
870
880
  for an explanation.
871
881
  """
872
- mets_path = Path(mets_path)
882
+ mets_path = Path(mets_path).absolute()
873
883
  if filegrp_mapping:
874
884
  filegrp_mapping = loads(filegrp_mapping)
875
885
  assert not ctx.mets_server_url, \
@@ -418,7 +418,8 @@ class OcrdMetsServer:
418
418
  def create_process(mets_server_url: str, ws_dir_path: str, log_file: str) -> int:
419
419
  sub_process = Popen(
420
420
  args=["ocrd", "workspace", "-U", f"{mets_server_url}", "-d", f"{ws_dir_path}", "server", "start"],
421
- stdout=open(file=log_file, mode="w"), stderr=open(file=log_file, mode="a"), cwd=ws_dir_path,
421
+ stdout=open(file=log_file, mode="w"), stderr=open(file=log_file, mode="a"),
422
+ #cwd=ws_dir_path, # rs: if relative, this will cause wrong path resolution in the subprocess
422
423
  shell=False, universal_newlines=True, start_new_session=True
423
424
  )
424
425
  # Wait for the mets server to start
@@ -446,7 +447,7 @@ class OcrdMetsServer:
446
447
  Path(self.url).unlink()
447
448
 
448
449
  def startup(self):
449
- self.log.info("Configuring the METS Server")
450
+ self.log.info("Configuring the METS Server for %s", self.workspace)
450
451
 
451
452
  workspace = self.workspace
452
453
 
@@ -539,7 +539,7 @@ class Processor():
539
539
  self._base_logger.info("limiting page timeout from %d to %d sec", max_seconds, self.max_page_seconds)
540
540
  max_seconds = self.max_page_seconds
541
541
 
542
- if isinstance(workspace.mets, ClientSideOcrdMets):
542
+ if max_workers > 1:
543
543
  executor_cls = ProcessPoolExecutor
544
544
  log_queue = mp.get_context('fork').Queue()
545
545
  else:
@@ -553,7 +553,7 @@ class Processor():
553
553
  initializer=_page_worker_set_ctxt,
554
554
  initargs=(self, log_queue),
555
555
  )
556
- if isinstance(workspace.mets, ClientSideOcrdMets):
556
+ if max_workers > 1:
557
557
  assert executor.active # ensure pre-forking
558
558
  # forward messages from log queue (in subprocesses) to all root handlers
559
559
  log_listener = logging.handlers.QueueListener(log_queue, *logging.root.handlers,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ocrd
3
- Version: 3.10.1
3
+ Version: 3.12.1
4
4
  Summary: OCR-D framework
5
5
  Author-email: Konstantin Baierer <unixprog@gmail.com>
6
6
  License: Apache License 2.0
@@ -2,8 +2,6 @@ from enum import Enum
2
2
 
3
3
  DOCKER_IMAGE_MONGO_DB = "mongo"
4
4
  DOCKER_IMAGE_RABBIT_MQ = "rabbitmq:4.2-management"
5
- # These feature flags are required by default to use the newer version
6
- DOCKER_RABBIT_MQ_FEATURES = "quorum_queue,implicit_default_bindings,classic_mirrored_queue_version"
7
5
 
8
6
  NETWORK_PROTOCOLS = ["http://", "https://"]
9
7
  OCRD_ALL_TOOL_JSON = "ocrd-all-tool.json"
@@ -388,7 +388,7 @@ class ProcessingServer(FastAPI):
388
388
  self.cache_processing_requests.update_request_counter(workspace_key=workspace_key, by_value=0)
389
389
 
390
390
  # This check is done to return early in case a workspace_id is provided
391
- # but the abs mets path cannot be queried from the DB
391
+ # but the mets path cannot be queried from the DB
392
392
  request_mets_path = await validate_and_return_mets_path(self.log, data)
393
393
 
394
394
  page_ids = expand_page_ids(data.page_id)
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
  from logging import Logger
3
3
  from typing import Any, Dict, List, Optional, Union
4
4
 
5
- from ..constants import DOCKER_IMAGE_MONGO_DB, DOCKER_IMAGE_RABBIT_MQ, DOCKER_RABBIT_MQ_FEATURES
5
+ from ..constants import DOCKER_IMAGE_MONGO_DB, DOCKER_IMAGE_RABBIT_MQ
6
6
  from ..database import verify_mongodb_available
7
7
  from ..rabbitmq_utils import verify_rabbitmq_available
8
8
  from .connection_clients import create_docker_client
@@ -136,9 +136,7 @@ class DataRabbitMQ(DataNetworkService):
136
136
  env = [
137
137
  # The default credentials to be used by the processing workers
138
138
  f"RABBITMQ_DEFAULT_USER={rmq_user}",
139
- f"RABBITMQ_DEFAULT_PASS={rmq_password}",
140
- # These feature flags are required by default to use the newer version
141
- f"RABBITMQ_FEATURE_FLAGS={DOCKER_RABBIT_MQ_FEATURES}"
139
+ f"RABBITMQ_DEFAULT_PASS={rmq_password}"
142
140
  ]
143
141
  if not ports_mapping:
144
142
  # 5672, 5671 - used by AMQP 0-9-1 and AMQP 1.0 clients without and with TLS
ocrd-3.10.1/VERSION DELETED
@@ -1 +0,0 @@
1
- 3.10.1
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes