Portions of namespace packages can be installed in separate locations.
Hence, the variable sage.env.SAGE_LIB is no longer meaningful.
Instead, we should make use of the __path__ attribute of packages, https://python.readthedocs.io/en/stable/reference/import.html#module-path, which in the case of namespace packages is an iterable.
SAGE_EXTCODE should be replaced by using importlib.resources (more precisely, the backport package importlib-resources). Version 5.9.0 can do as_file with directories (https://importlib-resources.readthedocs.io/en/latest/history.html#v5-9-0)
Depends on #31306
CC: @tornaria
Component: refactoring
Issue created by migration from https://trac.sagemath.org/ticket/33037
Portions of namespace packages can be installed in separate locations.
Hence, the variable
sage.env.SAGE_LIBis no longer meaningful.Instead, we should make use of the
__path__attribute of packages, https://python.readthedocs.io/en/stable/reference/import.html#module-path, which in the case of namespace packages is an iterable.Use of
SAGE_LIBinsrc/sage/misc/lazy_import_cache.pycan possibly be removed after Remove expired deprecations that use lazy_import(MODULE, "*") #33308sage -t --installed #33407
sage -t --all-installedRemove use of SAGE_LIB in sage.misc #33821 Remove use of
SAGE_LIBinsage.miscsage.env.sage_include_directories: Don't use distutils and SAGE_LIB #33137
sage.env.sage_include_directories: Don't usedistutilsandSAGE_LIBSAGE_EXTCODEshould be replaced by usingimportlib.resources(more precisely, the backport packageimportlib-resources). Version 5.9.0 can doas_filewith directories (https://importlib-resources.readthedocs.io/en/latest/history.html#v5-9-0)Depends on #31306
CC: @tornaria
Component: refactoring
Issue created by migration from https://trac.sagemath.org/ticket/33037