Skip to content

Commit

Permalink
SubModules: Switch WebModules package to webModulesSM for easier te…
Browse files Browse the repository at this point in the history
…sting
  • Loading branch information
JulienCochuyt committed Jul 25, 2024
1 parent edc58eb commit f4d9f8c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions addon/globalPlugins/webAccess/store/webModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,7 +22,7 @@
"""Web Module data store."""


__version__ = "2021.03.12"
__version__ = "2024.07.25"
__author__ = "Julien Cochuyt <[email protected]>"


Expand Down Expand Up @@ -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)
Expand Down
18 changes: 9 additions & 9 deletions addon/globalPlugins/webAccess/webModuleHandler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,7 +22,7 @@
"""Web Access GUI."""


__version__ = "2021.03.13"
__version__ = "2024.07.25"
__author__ = "Julien Cochuyt <[email protected]>"


Expand Down Expand Up @@ -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)
Expand All @@ -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
)
Expand All @@ -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()
Expand All @@ -489,7 +489,7 @@ def initialize():
def terminate():
import sys
try:
del sys.modules["webModulesMC"]
del sys.modules["webModulesSM"]
except KeyError:
pass
_importers = None

0 comments on commit f4d9f8c

Please sign in to comment.