diff options
Diffstat (limited to 'setuptools/_distutils/util.py')
-rw-r--r-- | setuptools/_distutils/util.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/setuptools/_distutils/util.py b/setuptools/_distutils/util.py index d95992ec..4763202b 100644 --- a/setuptools/_distutils/util.py +++ b/setuptools/_distutils/util.py @@ -11,6 +11,8 @@ import string import subprocess import sys import sysconfig +import functools + from distutils.errors import DistutilsPlatformError, DistutilsByteCompileError from distutils.dep_util import newer from distutils.spawn import spawn @@ -170,9 +172,7 @@ def change_root(new_root, pathname): raise DistutilsPlatformError(f"nothing known about platform '{os.name}'") -_environ_checked = 0 - - +@functools.lru_cache() def check_environ(): """Ensure that 'os.environ' has all the environment variables we guarantee that users can use in config files, command-line options, @@ -181,10 +181,6 @@ def check_environ(): PLAT - description of the current platform, including hardware and OS (see 'get_platform()') """ - global _environ_checked - if _environ_checked: - return - if os.name == 'posix' and 'HOME' not in os.environ: try: import pwd @@ -198,8 +194,6 @@ def check_environ(): if 'PLAT' not in os.environ: os.environ['PLAT'] = get_platform() - _environ_checked = 1 - def subst_vars(s, local_vars): """ |