spack.operating_systems package

class spack.operating_systems.FreeBSDOs[source]

Bases: OperatingSystem

class spack.operating_systems.LinuxDistro[source]

Bases: OperatingSystem

This class will represent the autodetected operating system for a Linux System. Since there are many different flavors of Linux, this class will attempt to encompass them all through autodetection using the python module platform and the method platform.dist()

class spack.operating_systems.MacOs(version=None)[source]

Bases: OperatingSystem

This class represents the macOS operating system. This will be auto detected using the python platform.mac_ver. The macOS platform will be represented using the major version operating system name, i.e el capitan, yosemite…etc.

class spack.operating_systems.OperatingSystem(name, version)[source]

Bases: object

Base class for all the Operating Systems.

On a multiple architecture machine, the architecture spec field can be set to build a package against any target and operating system that is present on the platform. On Cray platforms or any other architecture that has different front and back end environments, the operating system will determine the method of compiler detection.

There are two different types of compiler detection:

  1. Through the $PATH env variable (front-end detection)

  2. Through the module system. (back-end detection)

Depending on which operating system is specified, the compiler will be detected using one of those methods.

For platforms such as linux and darwin, the operating system is autodetected.

to_dict()[source]
class spack.operating_systems.WindowsOs[source]

Bases: OperatingSystem

This class represents the Windows operating system. This will be auto detected using the python platform.win32_ver() once we have a python setup that runs natively. The Windows platform will be represented using the major version operating system number, e.g. 10.

property compiler_search_paths: List[str]

Directories that may contain a compiler Spack can drive on Windows.

vs_install_paths reports installation roots; the compilers themselves live several levels below one, so the roots are never search paths in their own right.

property msvc_paths: List[str]
property oneapi_root
property vs_install_paths: List[str]

Root directories of the Visual Studio installations on this system.

Two independent sources are consulted, because neither is sufficient on its own: vswhere.exe, which is unavailable when the Visual Studio Installer is absent or installed somewhere unexpected, and the Windows registry.

Roots that no longer exist on disk are discarded. Uninstalling Visual Studio routinely leaves its registry entries behind, and those stale entries would otherwise be reported as usable toolchains.

Submodules

spack.operating_systems.freebsd module

class spack.operating_systems.freebsd.FreeBSDOs[source]

Bases: OperatingSystem

spack.operating_systems.linux_distro module

class spack.operating_systems.linux_distro.LinuxDistro[source]

Bases: OperatingSystem

This class will represent the autodetected operating system for a Linux System. Since there are many different flavors of Linux, this class will attempt to encompass them all through autodetection using the python module platform and the method platform.dist()

spack.operating_systems.linux_distro.kernel_version() StandardVersion[source]

Return the host’s kernel version as a StandardVersion object.

spack.operating_systems.mac_os module

class spack.operating_systems.mac_os.MacOs(version=None)[source]

Bases: OperatingSystem

This class represents the macOS operating system. This will be auto detected using the python platform.mac_ver. The macOS platform will be represented using the major version operating system name, i.e el capitan, yosemite…etc.

spack.operating_systems.mac_os.macos_cltools_version()[source]

Find the last installed version of the CommandLineTools.

The CLT version might only affect the build if it’s selected as the macOS SDK path.

spack.operating_systems.mac_os.macos_sdk_path()[source]

Return path to the active macOS SDK.

spack.operating_systems.mac_os.macos_version() StandardVersion[source]

Get the current macOS version as a version object.

This has three mechanisms for determining the macOS version, which is used for spack identification (the os in the spec’s arch) and indirectly for setting the value of MACOSX_DEPLOYMENT_TARGET, which affects the minos value of the LC_BUILD_VERSION macho header. Mixing minos values can lead to lots of linker warnings, and using a consistent version (pinned to the major OS version) allows distribution across clients that might be slightly behind.

The version determination is made with three mechanisms in decreasing priority:

  1. The MACOSX_DEPLOYMENT_TARGET variable overrides the actual operating system version, just like the value can be used to build for older macOS targets on newer systems. Spack currently will truncate this value when building packages, but at least the major version will be the same.

  2. The system sw_vers command reports the actual operating system version.

  3. The Python platform.mac_ver function is a fallback if the operating system identification fails, because some Python versions and/or installations report the OS on which Python was built rather than the one on which it is running.

spack.operating_systems.windows_os module

spack.operating_systems.windows_os.NATIVE_MSVC_TOOLSET_DIRS: Dict[str, Tuple[str, str]]

Directory holding the native MSVC toolset for each host architecture family. MSVC lays out its compilers as bin/<host>/<target> under each toolset version; only the entry whose host and target both match the machine Spack runs on is native.

class spack.operating_systems.windows_os.WindowsOs[source]

Bases: OperatingSystem

This class represents the Windows operating system. This will be auto detected using the python platform.win32_ver() once we have a python setup that runs natively. The Windows platform will be represented using the major version operating system number, e.g. 10.

property compiler_search_paths: List[str]

Directories that may contain a compiler Spack can drive on Windows.

vs_install_paths reports installation roots; the compilers themselves live several levels below one, so the roots are never search paths in their own right.

property msvc_paths: List[str]
property oneapi_root
property vs_install_paths: List[str]

Root directories of the Visual Studio installations on this system.

Two independent sources are consulted, because neither is sufficient on its own: vswhere.exe, which is unavailable when the Visual Studio Installer is absent or installed somewhere unexpected, and the Windows registry.

Roots that no longer exist on disk are discarded. Uninstalling Visual Studio routinely leaves its registry entries behind, and those stale entries would otherwise be reported as usable toolchains.

spack.operating_systems.windows_os.windows_version()[source]

Windows version as a Version object