From f4d9f8c8e1b7a3a7ad5f041da92ea7ae9c083041 Mon Sep 17 00:00:00 2001 From: Julien Cochuyt Date: Thu, 25 Jul 2024 10:57:53 +0200 Subject: [PATCH] SubModules: Switch WebModules package to `webModulesSM` for easier testing --- .../globalPlugins/webAccess/store/webModule.py | 6 +++--- .../webAccess/webModuleHandler/__init__.py | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/addon/globalPlugins/webAccess/store/webModule.py b/addon/globalPlugins/webAccess/store/webModule.py index e98840e0..b9eccbc0 100644 --- a/addon/globalPlugins/webAccess/store/webModule.py +++ b/addon/globalPlugins/webAccess/store/webModule.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # This file is part of Web Access for NVDA. -# Copyright (C) 2015-2021 Accessolutions (http://accessolutions.fr) +# Copyright (C) 2015-2024 Accessolutions (http://accessolutions.fr) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,7 +22,7 @@ """Web Module data store.""" -__version__ = "2021.03.12" +__version__ = "2024.07.25" __author__ = "Julien Cochuyt " @@ -56,7 +56,7 @@ class WebModuleJsonFileDataStore(Store): - def __init__(self, name, basePath, dirName="webModulesMC"): + def __init__(self, name, basePath, dirName="webModulesSM"): super().__init__(name=name) self.basePath = basePath self.path = os.path.join(basePath, dirName) diff --git a/addon/globalPlugins/webAccess/webModuleHandler/__init__.py b/addon/globalPlugins/webAccess/webModuleHandler/__init__.py index 674f5e0a..ee1419d9 100644 --- a/addon/globalPlugins/webAccess/webModuleHandler/__init__.py +++ b/addon/globalPlugins/webAccess/webModuleHandler/__init__.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # This file is part of Web Access for NVDA. -# Copyright (C) 2015-2021 Accessolutions (http://accessolutions.fr) +# Copyright (C) 2015-2024 Accessolutions (http://accessolutions.fr) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,7 +22,7 @@ """Web Access GUI.""" -__version__ = "2021.03.13" +__version__ = "2024.07.25" __author__ = "Julien Cochuyt " @@ -440,9 +440,9 @@ def getWebModuleFactory(name): mod = None try: import importlib - mod = importlib.import_module("webModulesMC.{}".format(name), package="webModulesMC") + mod = importlib.import_module("webModulesSM.{}".format(name), package="webModulesSM") except Exception: - log.exception("Could not import custom module webModulesMC.{}".format(name)) + log.exception("Could not import custom module webModulesSM.{}".format(name)) if not mod: return WebModule apiVersion = getattr(mod, "API_VERSION", None) @@ -464,7 +464,7 @@ def getWebModuleFactory(name): def hasCustomModule(name): return any( - importer.find_module("webModulesMC.{}".format(name)) + importer.find_module("webModulesSM.{}".format(name)) for importer in _importers if importer ) @@ -475,12 +475,12 @@ def initialize(): global _importers import imp - webModules = imp.new_module("webModulesMC") + webModules = imp.new_module("webModulesSM") webModules.__path__ = list() import sys - sys.modules["webModulesMC"] = webModules + sys.modules["webModulesSM"] = webModules addDirsToPythonPackagePath(webModules) - _importers = list(pkgutil.iter_importers("webModulesMC.__init__")) + _importers = list(pkgutil.iter_importers("webModulesSM.__init__")) from ..store.webModule import WebModuleStore store = WebModuleStore() @@ -489,7 +489,7 @@ def initialize(): def terminate(): import sys try: - del sys.modules["webModulesMC"] + del sys.modules["webModulesSM"] except KeyError: pass _importers = None