diff --git a/src/virtualenv/create/debug.py b/src/virtualenv/create/debug.py index 23c380c58..5ff76eafd 100644 --- a/src/virtualenv/create/debug.py +++ b/src/virtualenv/create/debug.py @@ -55,7 +55,14 @@ def run(): try: import sysconfig - result["makefile_filename"] = encode_path(sysconfig.get_makefile_filename()) + try: + get_makefile_filename = sysconfig.get_makefile_filename + except AttributeError: + # On some platforms, get_makefile_filename doesn't exist + # https://bugs.python.org/issue22199 + get_makefile_filename = sysconfig._get_makefile_filename + + result["makefile_filename"] = encode_path(get_makefile_filename()) except ImportError: pass diff --git a/src/virtualenv/discovery/py_info.py b/src/virtualenv/discovery/py_info.py index 4ceeebbde..996ef3357 100644 --- a/src/virtualenv/discovery/py_info.py +++ b/src/virtualenv/discovery/py_info.py @@ -24,6 +24,14 @@ def _get_path_extensions(): return list(OrderedDict.fromkeys([""] + os.environ.get("PATHEXT", "").lower().split(os.pathsep))) +try: + get_makefile_filename = sysconfig.get_makefile_filename +except AttributeError: + # On some platforms, get_makefile_filename doesn't exist + # https://bugs.python.org/issue22199 + get_makefile_filename = sysconfig._get_makefile_filename + + EXTENSIONS = _get_path_extensions() _CONF_VAR_RE = re.compile(r"\{\w+\}") @@ -78,8 +86,9 @@ def abs_path(v): self.sysconfig = { u(k): u(v) - for k, v in [ # a list of content to store from sysconfig - ("makefile_filename", sysconfig.get_makefile_filename()), + for k, v in [ + # a list of content to store from sysconfig + ("makefile_filename", get_makefile_filename()), ] if k is not None }