Skip to content

Commit

Permalink
Make change a bit more compact
Browse files Browse the repository at this point in the history
Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
  • Loading branch information
gaborbernat committed May 4, 2020
1 parent 553a6dd commit 3c4091d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
11 changes: 3 additions & 8 deletions src/virtualenv/create/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,9 @@ def run():
try:
import sysconfig

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())
# https://bugs.python.org/issue22199
makefile_filename = getattr(sysconfig, "get_makefile_filename", getattr(sysconfig, "_get_makefile_filename"))
result["makefile_filename"] = encode_path(makefile_filename())
except ImportError:
pass

Expand Down
13 changes: 3 additions & 10 deletions src/virtualenv/discovery/py_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ 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+\}")

Expand Down Expand Up @@ -83,12 +75,13 @@ def abs_path(v):
self.stdout_encoding = u(getattr(sys.stdout, "encoding", None))

self.sysconfig_paths = {u(i): u(sysconfig.get_path(i, expand=False)) for i in sysconfig.get_path_names()}

# https://bugs.python.org/issue22199
makefile_filename = getattr(sysconfig, "get_makefile_filename", getattr(sysconfig, "_get_makefile_filename"))
self.sysconfig = {
u(k): u(v)
for k, v in [
# a list of content to store from sysconfig
("makefile_filename", get_makefile_filename()),
("makefile_filename", makefile_filename()),
]
if k is not None
}
Expand Down

0 comments on commit 3c4091d

Please sign in to comment.