[3.9] bpo-41043: Escape literal part of the path for glob(). (GH-20994). (GH-21275)
(cherry picked from commit 935586845815f5b4c7814794413f6a812d4bd45f)
diff --git a/setup.py b/setup.py
index a220f36..770866b 100644
--- a/setup.py
+++ b/setup.py
@@ -8,7 +8,7 @@
import re
import sys
import sysconfig
-from glob import glob
+from glob import glob, escape
try:
@@ -401,7 +401,7 @@
# 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 @@
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 @@
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(