Ensure builtin module registration is deterministic

This commit is contained in:
James R. Barlow
2021-04-01 16:30:42 -07:00
parent e09ae9c68a
commit 2e155c31bf
2 changed files with 7 additions and 1 deletions

View File

@@ -67,7 +67,9 @@ class OcrmypdfPluginManager(pluggy.PluginManager):
# 1. Register builtins
if self.__builtins:
for module in pkgutil.iter_modules(ocrmypdf.builtin_plugins.__path__):
for module in sorted(
pkgutil.iter_modules(ocrmypdf.builtin_plugins.__path__)
):
name = f'ocrmypdf.builtin_plugins.{module.name}'
module = importlib.import_module(name)
self.register(module)

View File

@@ -3,3 +3,7 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# This file exists only mark builtin_plugins as a package.
# The plugin manager will not load it, so anything defined here may not be
# processed as a module.