From ec040e26e59f90124e719e090009cc6faefc7a48 Mon Sep 17 00:00:00 2001 From: san-juan1667 Date: Sat, 22 Apr 2023 17:02:17 -0600 Subject: [PATCH] Clarify sub directories used by pkgutil extend_path --- Doc/library/pkgutil.rst | 6 +++--- Lib/pkgutil.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Doc/library/pkgutil.rst b/Doc/library/pkgutil.rst index 788a02dcb8922f..66d753bd1a3c6c 100644 --- a/Doc/library/pkgutil.rst +++ b/Doc/library/pkgutil.rst @@ -25,9 +25,9 @@ support. from pkgutil import extend_path __path__ = extend_path(__path__, __name__) - This will add to the package's ``__path__`` all subdirectories of directories - on :data:`sys.path` named after the package. This is useful if one wants to - distribute different parts of a single logical package as multiple + For each directory on :data:`sys.path` that has a subdirectory that matches the + package name, add the subdirectory to the package's :attr:`__path__`. This is useful + if one wants to distribute different parts of a single logical package as multiple directories. It also looks for :file:`\*.pkg` files beginning where ``*`` matches the diff --git a/Lib/pkgutil.py b/Lib/pkgutil.py index bdebfd2fc8ac32..56731de64af494 100644 --- a/Lib/pkgutil.py +++ b/Lib/pkgutil.py @@ -511,10 +511,10 @@ def extend_path(path, name): from pkgutil import extend_path __path__ = extend_path(__path__, __name__) - This will add to the package's __path__ all subdirectories of - directories on sys.path named after the package. This is useful - if one wants to distribute different parts of a single logical - package as multiple directories. + For each directory on sys.path that has a subdirectory that + matches the package name, add the subdirectory to the package's + __path__. This is useful if one wants to distribute different + parts of a single logical package as multiple directories. It also looks for *.pkg files beginning where * matches the name argument. This feature is similar to *.pth files (see site.py),