diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2020-07-02 07:05:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-02 07:05:16 (GMT) |
commit | ecfecc2d6ce88ae71c783f0465a508c6a1b2f2b6 (patch) | |
tree | 15fe925d7c2eed5f56154f68971a5883870d5841 /Lib/distutils | |
parent | df59293bf0d815fe37743025d639a63a78e0c771 (diff) | |
download | cpython-ecfecc2d6ce88ae71c783f0465a508c6a1b2f2b6.zip cpython-ecfecc2d6ce88ae71c783f0465a508c6a1b2f2b6.tar.gz cpython-ecfecc2d6ce88ae71c783f0465a508c6a1b2f2b6.tar.bz2 |
[3.9] bpo-41043: Escape literal part of the path for glob(). (GH-20994). (GH-21275)
(cherry picked from commit 935586845815f5b4c7814794413f6a812d4bd45f)
Diffstat (limited to 'Lib/distutils')
-rw-r--r-- | Lib/distutils/command/build_py.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/distutils/command/build_py.py b/Lib/distutils/command/build_py.py index cf0ca57..edc2171 100644 --- a/Lib/distutils/command/build_py.py +++ b/Lib/distutils/command/build_py.py @@ -5,7 +5,7 @@ Implements the Distutils 'build_py' command.""" import os import importlib.util import sys -from glob import glob +import glob from distutils.core import Command from distutils.errors import * @@ -125,7 +125,7 @@ class build_py (Command): files = [] for pattern in globs: # Each pattern has to be converted to a platform-specific path - filelist = glob(os.path.join(src_dir, convert_path(pattern))) + filelist = glob.glob(os.path.join(glob.escape(src_dir), convert_path(pattern))) # Files that match more than one pattern are only added once files.extend([fn for fn in filelist if fn not in files and os.path.isfile(fn)]) @@ -216,7 +216,7 @@ class build_py (Command): def find_package_modules(self, package, package_dir): self.check_package(package, package_dir) - module_files = glob(os.path.join(package_dir, "*.py")) + module_files = glob.glob(os.path.join(glob.escape(package_dir), "*.py")) modules = [] setup_script = os.path.abspath(self.distribution.script_name) |