diff options
author | Seth R. Johnson <johnsonsr@ornl.gov> | 2022-04-11 03:31:24 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-11 09:31:24 +0200 |
commit | 1ea05cd456a773be4f46a5ef535893ab106b2d8b (patch) | |
tree | 2be264ad0f514688ca01f22bc20ee53b1d95d11c | |
parent | 65763d18fb28f724d12779b1349141efef4b46fa (diff) | |
download | spack-1ea05cd456a773be4f46a5ef535893ab106b2d8b.tar.gz spack-1ea05cd456a773be4f46a5ef535893ab106b2d8b.tar.bz2 spack-1ea05cd456a773be4f46a5ef535893ab106b2d8b.tar.xz spack-1ea05cd456a773be4f46a5ef535893ab106b2d8b.zip |
macos: fewer calls to sw_vers (#29997)
In a typical call to spack, the OperatingSystem gets instantiated
multiple times. For macOS, each one requires a call to `sw_vers`, which
is done through the Executable helper class. Memoizing
reduces the call count from "spac spec" from three to one.
-rw-r--r-- | lib/spack/spack/operating_systems/mac_os.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/spack/spack/operating_systems/mac_os.py b/lib/spack/spack/operating_systems/mac_os.py index a150134618..403188262d 100644 --- a/lib/spack/spack/operating_systems/mac_os.py +++ b/lib/spack/spack/operating_systems/mac_os.py @@ -7,12 +7,15 @@ import os import platform as py_platform import re +import llnl.util.lang + from spack.util.executable import Executable from spack.version import Version from ._operating_system import OperatingSystem +@llnl.util.lang.memoized def macos_version(): """Get the current macOS version as a version object. @@ -59,6 +62,7 @@ def macos_version(): return Version(py_platform.mac_ver()[0]) +@llnl.util.lang.memoized def macos_cltools_version(): """Find the last installed version of the CommandLineTools. @@ -82,6 +86,7 @@ def macos_cltools_version(): return None +@llnl.util.lang.memoized def macos_sdk_path(): """Return path to the active macOS SDK. """ |