[3.8] bpo-41043: Escape literal part of the path for glob(). (GH-20994). (GH-21277)
(cherry picked from commit 935586845815f5b4c7814794413f6a812d4bd45f)
diff --git a/setup.py b/setup.py
index b168ed4..6340669 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
from distutils import log
from distutils.command.build_ext import build_ext
@@ -339,7 +339,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"))
# The sysconfig variables built by makesetup that list the already
# built modules and the disabled modules as configured by the Setup
@@ -2256,7 +2256,7 @@
self.add(Extension('_sha1', ['sha1module.c'],
depends=['hashlib.h']))
- blake2_deps = glob(os.path.join(self.srcdir,
+ blake2_deps = glob(os.path.join(escape(self.srcdir),
'Modules/_blake2/impl/*'))
blake2_deps.append('hashlib.h')
@@ -2266,7 +2266,7 @@
'_blake2/blake2s_impl.c'],
depends=blake2_deps))
- sha3_deps = glob(os.path.join(self.srcdir,
+ sha3_deps = glob(os.path.join(escape(self.srcdir),
'Modules/_sha3/kcp/*'))
sha3_deps.append('hashlib.h')
self.add(Extension('_sha3',