bpo-42955: Remove sub-packages from sys.stdlib_module_names (GH-24353)
This commit is contained in:
parent
c9b8e9c421
commit
64fc105b2d
@ -1575,9 +1575,10 @@ always available.
|
|||||||
All module kinds are listed: pure Python, built-in, frozen and extension
|
All module kinds are listed: pure Python, built-in, frozen and extension
|
||||||
modules. Test modules are excluded.
|
modules. Test modules are excluded.
|
||||||
|
|
||||||
For packages, only sub-packages are listed, not sub-modules. For example,
|
For packages, only the main package is listed: sub-packages and sub-modules
|
||||||
``concurrent`` package and ``concurrent.futures`` sub-package are listed,
|
are not listed. For example, the ``email`` package is listed, but the
|
||||||
but not ``concurrent.futures.base`` sub-module.
|
``email.mime`` sub-package and the ``email.message`` sub-module are not
|
||||||
|
listed.
|
||||||
|
|
||||||
See also the :attr:`sys.builtin_module_names` list.
|
See also the :attr:`sys.builtin_module_names` list.
|
||||||
|
|
||||||
|
@ -117,7 +117,6 @@ static const char* _Py_stdlib_module_names[] = {
|
|||||||
"colorsys",
|
"colorsys",
|
||||||
"compileall",
|
"compileall",
|
||||||
"concurrent",
|
"concurrent",
|
||||||
"concurrent.futures",
|
|
||||||
"configparser",
|
"configparser",
|
||||||
"contextlib",
|
"contextlib",
|
||||||
"contextvars",
|
"contextvars",
|
||||||
@ -126,7 +125,6 @@ static const char* _Py_stdlib_module_names[] = {
|
|||||||
"crypt",
|
"crypt",
|
||||||
"csv",
|
"csv",
|
||||||
"ctypes",
|
"ctypes",
|
||||||
"ctypes.macholib",
|
|
||||||
"curses",
|
"curses",
|
||||||
"dataclasses",
|
"dataclasses",
|
||||||
"datetime",
|
"datetime",
|
||||||
@ -135,13 +133,10 @@ static const char* _Py_stdlib_module_names[] = {
|
|||||||
"difflib",
|
"difflib",
|
||||||
"dis",
|
"dis",
|
||||||
"distutils",
|
"distutils",
|
||||||
"distutils.command",
|
|
||||||
"doctest",
|
"doctest",
|
||||||
"email",
|
"email",
|
||||||
"email.mime",
|
|
||||||
"encodings",
|
"encodings",
|
||||||
"ensurepip",
|
"ensurepip",
|
||||||
"ensurepip._bundled",
|
|
||||||
"enum",
|
"enum",
|
||||||
"errno",
|
"errno",
|
||||||
"faulthandler",
|
"faulthandler",
|
||||||
@ -178,8 +173,6 @@ static const char* _Py_stdlib_module_names[] = {
|
|||||||
"json",
|
"json",
|
||||||
"keyword",
|
"keyword",
|
||||||
"lib2to3",
|
"lib2to3",
|
||||||
"lib2to3.fixes",
|
|
||||||
"lib2to3.pgen2",
|
|
||||||
"linecache",
|
"linecache",
|
||||||
"locale",
|
"locale",
|
||||||
"logging",
|
"logging",
|
||||||
@ -194,7 +187,6 @@ static const char* _Py_stdlib_module_names[] = {
|
|||||||
"msilib",
|
"msilib",
|
||||||
"msvcrt",
|
"msvcrt",
|
||||||
"multiprocessing",
|
"multiprocessing",
|
||||||
"multiprocessing.dummy",
|
|
||||||
"netrc",
|
"netrc",
|
||||||
"nis",
|
"nis",
|
||||||
"nntplib",
|
"nntplib",
|
||||||
@ -304,10 +296,6 @@ static const char* _Py_stdlib_module_names[] = {
|
|||||||
"wsgiref",
|
"wsgiref",
|
||||||
"xdrlib",
|
"xdrlib",
|
||||||
"xml",
|
"xml",
|
||||||
"xml.dom",
|
|
||||||
"xml.etree",
|
|
||||||
"xml.parsers",
|
|
||||||
"xml.sax",
|
|
||||||
"xmlrpc",
|
"xmlrpc",
|
||||||
"zipapp",
|
"zipapp",
|
||||||
"zipfile",
|
"zipfile",
|
||||||
|
@ -57,29 +57,17 @@ def list_python_modules(names):
|
|||||||
names.add(name)
|
names.add(name)
|
||||||
|
|
||||||
|
|
||||||
def _list_sub_packages(path, names, parent=None):
|
# Packages in Lib/
|
||||||
for name in os.listdir(path):
|
def list_packages(names):
|
||||||
|
for name in os.listdir(STDLIB_PATH):
|
||||||
if name in IGNORE:
|
if name in IGNORE:
|
||||||
continue
|
continue
|
||||||
package_path = os.path.join(path, name)
|
package_path = os.path.join(STDLIB_PATH, name)
|
||||||
if not os.path.isdir(package_path):
|
if not os.path.isdir(package_path):
|
||||||
continue
|
continue
|
||||||
if not any(package_file.endswith(".py")
|
if any(package_file.endswith(".py")
|
||||||
for package_file in os.listdir(package_path)):
|
for package_file in os.listdir(package_path)):
|
||||||
continue
|
names.add(name)
|
||||||
if parent:
|
|
||||||
qualname = f"{parent}.{name}"
|
|
||||||
else:
|
|
||||||
qualname = name
|
|
||||||
if qualname in IGNORE:
|
|
||||||
continue
|
|
||||||
names.add(qualname)
|
|
||||||
_list_sub_packages(package_path, names, qualname)
|
|
||||||
|
|
||||||
|
|
||||||
# Packages and sub-packages
|
|
||||||
def list_packages(names):
|
|
||||||
_list_sub_packages(STDLIB_PATH, names)
|
|
||||||
|
|
||||||
|
|
||||||
# Extension modules built by setup.py
|
# Extension modules built by setup.py
|
||||||
|
Loading…
x
Reference in New Issue
Block a user