@@ -74,6 +74,13 @@ def __getattr__(attrName: str) -> Any:
7474 if attrName == "RUN_REGKEY" and NVDAState ._allowDeprecatedAPI ():
7575 log .warning ("RUN_REGKEY is deprecated, use RegistryKey.RUN instead." )
7676 return RegistryKey .RUN .value
77+ if attrName == "addConfigDirsToPythonPackagePath" and NVDAState ._allowDeprecatedAPI ():
78+ log .warning (
79+ "addConfigDirsToPythonPackagePath is deprecated, "
80+ "use addonHandler.packaging.addDirsToPythonPackagePath instead."
81+ )
82+ from addonHandler .packaging import addDirsToPythonPackagePath
83+ return addDirsToPythonPackagePath
7784 raise AttributeError (f"module { repr (__name__ )} has no attribute { repr (attrName )} " )
7885
7986
@@ -474,35 +481,6 @@ def setStartOnLogonScreen(enable: bool) -> None:
474481 raise RuntimeError ("Slave failed to set startOnLogonScreen" )
475482
476483
477- def addConfigDirsToPythonPackagePath (module , subdir = None ):
478- """Add the configuration directories to the module search path (__path__) of a Python package.
479- C{subdir} is added to each configuration directory. It defaults to the name of the Python package.
480- @param module: The root module of the package.
481- @type module: module
482- @param subdir: The subdirectory to be used, C{None} for the name of C{module}.
483- @type subdir: str
484- """
485- if isAppX or globalVars .appArgs .disableAddons :
486- return
487- # FIXME: this should not be coupled to the config module....
488- import addonHandler
489- for addon in addonHandler .getRunningAddons ():
490- addon .addToPackagePath (module )
491- if globalVars .appArgs .secure or not conf ['development' ]['enableScratchpadDir' ]:
492- return
493- if not subdir :
494- subdir = module .__name__
495- fullPath = os .path .join (getScratchpadDir (),subdir )
496- # Ensure this directory exists otherwise pkgutil.iter_importers may emit None for missing paths.
497- if not os .path .isdir (fullPath ):
498- os .makedirs (fullPath )
499- # Insert this path at the beginning of the module's search paths.
500- # The module's search paths may not be a mutable list, so replace it with a new one
501- pathList = [fullPath ]
502- pathList .extend (module .__path__ )
503- module .__path__ = pathList
504-
505-
506484def _transformSpec (spec : ConfigObj ):
507485 """To make the spec less verbose, transform the spec:
508486 - Add default="default" to all featureFlag items. This is required so that the key can be read,
0 commit comments