[3.9] bpo-41043: Escape literal part of the path for glob(). (GH-20994). (GH-21275)

(cherry picked from commit 9355868458)
This commit is contained in:
Serhiy Storchaka 2020-07-02 10:05:16 +03:00 committed by GitHub
parent df59293bf0
commit ecfecc2d6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 40 additions and 30 deletions

View file

@ -8,7 +8,7 @@ import os
import re
import sys
import sysconfig
from glob import glob
from glob import glob, escape
try:
@ -401,7 +401,7 @@ class PyBuildExt(build_ext):
# Python header files
headers = [sysconfig.get_config_h_filename()]
headers += glob(os.path.join(sysconfig.get_path('include'), "*.h"))
headers += glob(os.path.join(escape(sysconfig.get_path('include')), "*.h"))
for ext in self.extensions:
ext.sources = [ find_module_file(filename, moddirlist)
@ -2433,7 +2433,7 @@ class PyBuildExt(build_ext):
if "blake2" in configured:
blake2_deps = glob(
os.path.join(self.srcdir, 'Modules/_blake2/impl/*')
os.path.join(escape(self.srcdir), 'Modules/_blake2/impl/*')
)
blake2_deps.append('hashlib.h')
self.add(Extension(
@ -2448,7 +2448,7 @@ class PyBuildExt(build_ext):
if "sha3" in configured:
sha3_deps = glob(
os.path.join(self.srcdir, 'Modules/_sha3/kcp/*')
os.path.join(escape(self.srcdir), 'Modules/_sha3/kcp/*')
)
sha3_deps.append('hashlib.h')
self.add(Extension(