summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/detection/common.py2
-rw-r--r--lib/spack/spack/detection/path.py23
-rwxr-xr-xlib/spack/spack/operating_systems/windows_os.py27
-rw-r--r--var/spack/repos/builtin/packages/zlib/package.py11
4 files changed, 33 insertions, 30 deletions
diff --git a/lib/spack/spack/detection/common.py b/lib/spack/spack/detection/common.py
index f5950f7467..f3ebd7aa11 100644
--- a/lib/spack/spack/detection/common.py
+++ b/lib/spack/spack/detection/common.py
@@ -141,7 +141,7 @@ def executable_prefix(executable_dir):
components = executable_dir.split(os.sep)
if 'bin' not in components:
- return None
+ return executable_dir
idx = components.index('bin')
return os.sep.join(components[:idx])
diff --git a/lib/spack/spack/detection/path.py b/lib/spack/spack/detection/path.py
index 8db209f009..f280af4520 100644
--- a/lib/spack/spack/detection/path.py
+++ b/lib/spack/spack/detection/path.py
@@ -41,17 +41,22 @@ def executables_in_path(path_hints=None):
path_hints (list): list of paths to be searched. If None the list will be
constructed based on the PATH environment variable.
"""
- # build_environment.py::1013: If we're on a Windows box, run vswhere, steal the installationPath using
- # windows_os.py logic, construct paths to CMake and Ninja, add to PATH
+ # build_environment.py::1013: If we're on a Windows box, run vswhere,
+ # steal the installationPath using windows_os.py logic,
+ # construct paths to CMake and Ninja, add to PATH
path_hints = path_hints or spack.util.environment.get_path('PATH')
if sys.platform == 'win32':
- msvcPaths = winOs.WindowsOs.vsInstallPaths
- msvcCMakePaths = [os.path.join(path, "Common7", "IDE", "CommonExtensions", "Microsoft", "CMake", "CMake", "bin")
- for path in msvcPaths]
- [path_hints.insert(0, path) for path in msvcCMakePaths]
- msvcNinjaPaths = [os.path.join(path, "Common7", "IDE", "CommonExtensions", "Microsoft", "CMake", "Ninja")
- for path in msvcPaths]
- [path_hints.insert(0, path) for path in msvcNinjaPaths]
+ msvc_paths = winOs.WindowsOs.vs_install_paths
+ msvc_cmake_paths = [
+ os.path.join(path, "Common7", "IDE", "CommonExtensions", "Microsoft",
+ "CMake", "CMake", "bin")
+ for path in msvc_paths]
+ path_hints = msvc_cmake_paths + path_hints
+ msvc_ninja_paths = [
+ os.path.join(path, "Common7", "IDE", "CommonExtensions", "Microsoft",
+ "CMake", "Ninja")
+ for path in msvc_paths]
+ path_hints = msvc_ninja_paths + path_hints
search_paths = llnl.util.filesystem.search_paths_for_executables(*path_hints)
diff --git a/lib/spack/spack/operating_systems/windows_os.py b/lib/spack/spack/operating_systems/windows_os.py
index 91b7ddb678..7d5937c4a9 100755
--- a/lib/spack/spack/operating_systems/windows_os.py
+++ b/lib/spack/spack/operating_systems/windows_os.py
@@ -3,13 +3,15 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
-import sys
+import glob
import os
import subprocess
-import glob
+import sys
+
from spack.architecture import OperatingSystem
from spack.version import Version
+
# FIXME: To get the actual Windows version, we need a python that runs
# natively on Windows, not Cygwin.
def windows_version():
@@ -27,8 +29,8 @@ class WindowsOs(OperatingSystem):
"""
# Find MSVC directories using vswhere
- compSearchPaths = []
- vsInstallPaths = []
+ comp_search_paths = []
+ vs_install_paths = []
root = os.environ.get('ProgramFiles(x86)') or os.environ.get('ProgramFiles')
if root:
try:
@@ -42,14 +44,14 @@ class WindowsOs(OperatingSystem):
"-requires", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"-property", "installationPath",
"-products", "*",
- ], **extra_args).strip()
+ ], **extra_args).strip() # type: ignore[call-overload]
if (3, 0) <= sys.version_info[:2] <= (3, 5):
paths = paths.decode()
- vsInstallPaths = paths.split('\n')
- msvcPaths = [os.path.join(path, "VC", "Tools", "MSVC")
- for path in vsInstallPaths]
- for p in msvcPaths:
- compSearchPaths.extend(
+ vs_install_paths = paths.split('\n')
+ msvc_paths = [os.path.join(path, "VC", "Tools", "MSVC")
+ for path in vs_install_paths]
+ for p in msvc_paths:
+ comp_search_paths.extend(
glob.glob(os.path.join(p, '*', 'bin', 'Hostx64', 'x64')))
if os.getenv("ONEAPI_ROOT"):
comp_search_paths.extend(glob.glob(os.path.join(
@@ -58,9 +60,8 @@ class WindowsOs(OperatingSystem):
'windows', 'bin')))
except (subprocess.CalledProcessError, OSError, UnicodeDecodeError):
pass
- if compSearchPaths:
- compiler_search_paths = compSearchPaths
- # print(vsInstallPaths)
+ if comp_search_paths:
+ compiler_search_paths = comp_search_paths
def __init__(self):
super(WindowsOs, self).__init__('Windows10', '10')
diff --git a/var/spack/repos/builtin/packages/zlib/package.py b/var/spack/repos/builtin/packages/zlib/package.py
index 41da1cadf3..9a445b8173 100644
--- a/var/spack/repos/builtin/packages/zlib/package.py
+++ b/var/spack/repos/builtin/packages/zlib/package.py
@@ -52,8 +52,8 @@ class Zlib(CMakePackage):
if '+pic' in self.spec:
env.append_flags('CFLAGS', self.compiler.cc_pic_flag)
if '+optimize' in self.spec:
- env.append_flags('CFLAGS', '-O2')
-
+ env.append_flags('CFLAGS', '-O2')
+
# Build, install, and check both static and shared versions of the
# libraries when +shared
@when('+shared platform=windows')
@@ -65,7 +65,7 @@ class Zlib(CMakePackage):
def build(self, spec, prefix):
for self._building_shared in (False, True):
super(Zlib, self).build(spec, prefix)
-
+
@when('+shared platform=windows')
def check(self):
for self._building_shared in (False, True):
@@ -80,11 +80,8 @@ class Zlib(CMakePackage):
if '~shared' in spec:
config_args.append('--static')
configure('--prefix={0}'.format(prefix), *config_args)
-
+
make()
if self.run_tests:
make('check')
make('install')
-
-
-