Add Windows to platform and target changes
Add compiler hint to the root spec for Windows Reporters on Windows (#26038) Reporters use Jinja2 as the templating engine, and Jinja2 indexes templates by Unix separators, even on Windows, so search using Unix paths on all systems. Support patching on win via git (#25871) Handle GRP on windows
This commit is contained in:
parent
3a994032f8
commit
31daf0f2b6
@ -727,9 +727,11 @@ def _root_spec(spec_str):
|
|||||||
spec_str (str): spec to be bootstrapped. Must be without compiler and target.
|
spec_str (str): spec to be bootstrapped. Must be without compiler and target.
|
||||||
"""
|
"""
|
||||||
# Add a proper compiler hint to the root spec. We use GCC for
|
# Add a proper compiler hint to the root spec. We use GCC for
|
||||||
# everything but MacOS.
|
# everything but MacOS and Windows.
|
||||||
if str(spack.platforms.host()) == 'darwin':
|
if str(spack.platforms.host()) == 'darwin':
|
||||||
spec_str += ' %apple-clang'
|
spec_str += ' %apple-clang'
|
||||||
|
elif str(spack.platforms.host()) == 'windows':
|
||||||
|
spec_str += ' %msvc'
|
||||||
else:
|
else:
|
||||||
spec_str += ' %gcc'
|
spec_str += ' %gcc'
|
||||||
|
|
||||||
|
@ -61,7 +61,6 @@ def setdefault(module_type, specs, args):
|
|||||||
writer = spack.modules.module_types['lmod'](spec, args.module_set_name)
|
writer = spack.modules.module_types['lmod'](spec, args.module_set_name)
|
||||||
writer.update_module_defaults()
|
writer.update_module_defaults()
|
||||||
|
|
||||||
|
|
||||||
module_folder = os.path.dirname(writer.layout.filename)
|
module_folder = os.path.dirname(writer.layout.filename)
|
||||||
module_basename = os.path.basename(writer.layout.filename)
|
module_basename = os.path.basename(writer.layout.filename)
|
||||||
with llnl.util.filesystem.working_dir(module_folder):
|
with llnl.util.filesystem.working_dir(module_folder):
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
import filecmp
|
import filecmp
|
||||||
import grp
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
@ -15,6 +14,7 @@
|
|||||||
import llnl.util.filesystem as fs
|
import llnl.util.filesystem as fs
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
|
|
||||||
|
import spack.error
|
||||||
import spack.package_prefs
|
import spack.package_prefs
|
||||||
import spack.paths
|
import spack.paths
|
||||||
import spack.spec
|
import spack.spec
|
||||||
@ -28,6 +28,12 @@
|
|||||||
else:
|
else:
|
||||||
system_shebang_limit = 127
|
system_shebang_limit = 127
|
||||||
|
|
||||||
|
#: Groupdb does not exist on Windows, prevent imports
|
||||||
|
#: on supported systems
|
||||||
|
is_windows = str(spack.platforms.host()) == 'windows'
|
||||||
|
if not is_windows:
|
||||||
|
import grp
|
||||||
|
|
||||||
#: Spack itself also limits the shebang line to at most 4KB, which should be plenty.
|
#: Spack itself also limits the shebang line to at most 4KB, which should be plenty.
|
||||||
spack_shebang_limit = 4096
|
spack_shebang_limit = 4096
|
||||||
|
|
||||||
|
@ -7,14 +7,16 @@
|
|||||||
from .cray_frontend import CrayFrontend
|
from .cray_frontend import CrayFrontend
|
||||||
from .linux_distro import LinuxDistro
|
from .linux_distro import LinuxDistro
|
||||||
from .mac_os import MacOs
|
from .mac_os import MacOs
|
||||||
|
from .windows_os import WindowsOs
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'OperatingSystem',
|
'OperatingSystem',
|
||||||
'LinuxDistro',
|
'LinuxDistro',
|
||||||
'MacOs',
|
'MacOs',
|
||||||
'CrayFrontend',
|
'CrayFrontend',
|
||||||
'CrayBackend'
|
'CrayBackend',
|
||||||
|
'WindowsOs'
|
||||||
]
|
]
|
||||||
|
|
||||||
#: List of all the Operating Systems known to Spack
|
#: List of all the Operating Systems known to Spack
|
||||||
operating_systems = [LinuxDistro, MacOs, CrayFrontend, CrayBackend]
|
operating_systems = [LinuxDistro, MacOs, CrayFrontend, CrayBackend, WindowsOs]
|
||||||
|
@ -8,9 +8,10 @@
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from spack.architecture import OperatingSystem
|
|
||||||
from spack.version import Version
|
from spack.version import Version
|
||||||
|
|
||||||
|
from ._operating_system import OperatingSystem
|
||||||
|
|
||||||
|
|
||||||
# FIXME: To get the actual Windows version, we need a python that runs
|
# FIXME: To get the actual Windows version, we need a python that runs
|
||||||
# natively on Windows, not Cygwin.
|
# natively on Windows, not Cygwin.
|
||||||
@ -37,14 +38,14 @@ class WindowsOs(OperatingSystem):
|
|||||||
extra_args = {}
|
extra_args = {}
|
||||||
if sys.version_info[:3] >= (3, 6, 0):
|
if sys.version_info[:3] >= (3, 6, 0):
|
||||||
extra_args = {'encoding': 'mbcs', 'errors': 'strict'}
|
extra_args = {'encoding': 'mbcs', 'errors': 'strict'}
|
||||||
paths = subprocess.check_output([ # novermin
|
paths = subprocess.check_output([ # type: ignore[call-overload] # novermin
|
||||||
os.path.join(root, "Microsoft Visual Studio",
|
os.path.join(root, "Microsoft Visual Studio",
|
||||||
"Installer", "vswhere.exe"),
|
"Installer", "vswhere.exe"),
|
||||||
"-prerelease",
|
"-prerelease",
|
||||||
"-requires", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
|
"-requires", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
|
||||||
"-property", "installationPath",
|
"-property", "installationPath",
|
||||||
"-products", "*",
|
"-products", "*",
|
||||||
], **extra_args).strip() # type: ignore[call-overload]
|
], **extra_args).strip()
|
||||||
if (3, 0) <= sys.version_info[:2] <= (3, 5):
|
if (3, 0) <= sys.version_info[:2] <= (3, 5):
|
||||||
paths = paths.decode()
|
paths = paths.decode()
|
||||||
vs_install_paths = paths.split('\n')
|
vs_install_paths = paths.split('\n')
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
import spack.util.spack_json as sjson
|
import spack.util.spack_json as sjson
|
||||||
from spack.util.compression import allowed_archive
|
from spack.util.compression import allowed_archive
|
||||||
from spack.util.crypto import Checker, checksum
|
from spack.util.crypto import Checker, checksum
|
||||||
from spack.util.executable import which
|
from spack.util.executable import which, which_string
|
||||||
|
|
||||||
|
|
||||||
def apply_patch(stage, patch_path, level=1, working_dir='.'):
|
def apply_patch(stage, patch_path, level=1, working_dir='.'):
|
||||||
@ -32,7 +32,14 @@ def apply_patch(stage, patch_path, level=1, working_dir='.'):
|
|||||||
working_dir (str): relative path *within* the stage to change to
|
working_dir (str): relative path *within* the stage to change to
|
||||||
(default '.')
|
(default '.')
|
||||||
"""
|
"""
|
||||||
patch = which("patch", required=True)
|
git_utils_path = os.environ.get('PATH', '')
|
||||||
|
if os.name == 'nt':
|
||||||
|
git = which_string('git', required=True)
|
||||||
|
git_root = os.path.dirname(git).split('/')[:-1]
|
||||||
|
git_root.extend(['usr', 'bin'])
|
||||||
|
git_utils_path = os.sep.join(git_root)
|
||||||
|
|
||||||
|
patch = which("patch", required=True, path=git_utils_path)
|
||||||
with llnl.util.filesystem.working_dir(stage.source_path):
|
with llnl.util.filesystem.working_dir(stage.source_path):
|
||||||
patch('-s',
|
patch('-s',
|
||||||
'-p', str(level),
|
'-p', str(level),
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
from .darwin import Darwin
|
from .darwin import Darwin
|
||||||
from .linux import Linux
|
from .linux import Linux
|
||||||
from .test import Test
|
from .test import Test
|
||||||
|
from .windows import Windows
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'Platform',
|
'Platform',
|
||||||
@ -17,6 +18,7 @@
|
|||||||
'Darwin',
|
'Darwin',
|
||||||
'Linux',
|
'Linux',
|
||||||
'Test',
|
'Test',
|
||||||
|
'Windows',
|
||||||
'platforms',
|
'platforms',
|
||||||
'host',
|
'host',
|
||||||
'by_name',
|
'by_name',
|
||||||
|
@ -12,9 +12,10 @@
|
|||||||
from .darwin import Darwin
|
from .darwin import Darwin
|
||||||
from .linux import Linux
|
from .linux import Linux
|
||||||
from .test import Test
|
from .test import Test
|
||||||
|
from .windows import Windows
|
||||||
|
|
||||||
#: List of all the platform classes known to Spack
|
#: List of all the platform classes known to Spack
|
||||||
platforms = [Cray, Darwin, Linux, Test]
|
platforms = [Cray, Darwin, Linux, Windows, Test]
|
||||||
|
|
||||||
|
|
||||||
@llnl.util.lang.memoized
|
@llnl.util.lang.memoized
|
||||||
|
@ -7,9 +7,11 @@
|
|||||||
|
|
||||||
import archspec.cpu
|
import archspec.cpu
|
||||||
|
|
||||||
from spack.architecture import Platform, Target
|
import spack.target
|
||||||
from spack.operating_systems.windows_os import WindowsOs
|
from spack.operating_systems.windows_os import WindowsOs
|
||||||
|
|
||||||
|
from ._platform import Platform
|
||||||
|
|
||||||
|
|
||||||
class Windows(Platform):
|
class Windows(Platform):
|
||||||
priority = 101
|
priority = 101
|
||||||
@ -20,7 +22,7 @@ def __init__(self):
|
|||||||
super(Windows, self).__init__('windows')
|
super(Windows, self).__init__('windows')
|
||||||
|
|
||||||
for name in archspec.cpu.TARGETS:
|
for name in archspec.cpu.TARGETS:
|
||||||
self.add_target(name, Target(name))
|
self.add_target(name, spack.target.Target(name))
|
||||||
|
|
||||||
self.default = archspec.cpu.host().name
|
self.default = archspec.cpu.host().name
|
||||||
self.front_end = self.default
|
self.front_end = self.default
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
import hashlib
|
import hashlib
|
||||||
import os.path
|
import os.path
|
||||||
import platform
|
import platform
|
||||||
|
import posixpath
|
||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
import time
|
import time
|
||||||
@ -61,7 +62,7 @@ class CDash(Reporter):
|
|||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
Reporter.__init__(self, args)
|
Reporter.__init__(self, args)
|
||||||
self.success = True
|
self.success = True
|
||||||
self.template_dir = os.path.join('reports', 'cdash')
|
self.template_dir = posixpath.join('reports', 'cdash')
|
||||||
self.cdash_upload_url = args.cdash_upload_url
|
self.cdash_upload_url = args.cdash_upload_url
|
||||||
|
|
||||||
if self.cdash_upload_url:
|
if self.cdash_upload_url:
|
||||||
@ -219,11 +220,11 @@ def clean_log_event(event):
|
|||||||
if phase != 'update':
|
if phase != 'update':
|
||||||
# Update.xml stores site information differently
|
# Update.xml stores site information differently
|
||||||
# than the rest of the CTest XML files.
|
# than the rest of the CTest XML files.
|
||||||
site_template = os.path.join(self.template_dir, 'Site.xml')
|
site_template = posixpath.join(self.template_dir, 'Site.xml')
|
||||||
t = env.get_template(site_template)
|
t = env.get_template(site_template)
|
||||||
f.write(t.render(report_data))
|
f.write(t.render(report_data))
|
||||||
|
|
||||||
phase_template = os.path.join(self.template_dir, report_name)
|
phase_template = posixpath.join(self.template_dir, report_name)
|
||||||
t = env.get_template(phase_template)
|
t = env.get_template(phase_template)
|
||||||
f.write(t.render(report_data))
|
f.write(t.render(report_data))
|
||||||
self.upload(phase_report)
|
self.upload(phase_report)
|
||||||
@ -346,11 +347,11 @@ def clean_log_event(event):
|
|||||||
if phase != 'update':
|
if phase != 'update':
|
||||||
# Update.xml stores site information differently
|
# Update.xml stores site information differently
|
||||||
# than the rest of the CTest XML files.
|
# than the rest of the CTest XML files.
|
||||||
site_template = os.path.join(self.template_dir, 'Site.xml')
|
site_template = posixpath.join(self.template_dir, 'Site.xml')
|
||||||
t = env.get_template(site_template)
|
t = env.get_template(site_template)
|
||||||
f.write(t.render(report_data))
|
f.write(t.render(report_data))
|
||||||
|
|
||||||
phase_template = os.path.join(self.template_dir, report_name)
|
phase_template = posixpath.join(self.template_dir, report_name)
|
||||||
t = env.get_template(phase_template)
|
t = env.get_template(phase_template)
|
||||||
f.write(t.render(report_data))
|
f.write(t.render(report_data))
|
||||||
self.upload(phase_report)
|
self.upload(phase_report)
|
||||||
@ -376,7 +377,7 @@ def concretization_report(self, directory_name, msg):
|
|||||||
report_data['update']['log'] = msg
|
report_data['update']['log'] = msg
|
||||||
|
|
||||||
env = spack.tengine.make_environment()
|
env = spack.tengine.make_environment()
|
||||||
update_template = os.path.join(self.template_dir, 'Update.xml')
|
update_template = posixpath.join(self.template_dir, 'Update.xml')
|
||||||
t = env.get_template(update_template)
|
t = env.get_template(update_template)
|
||||||
output_filename = os.path.join(directory_name, 'Update.xml')
|
output_filename = os.path.join(directory_name, 'Update.xml')
|
||||||
with open(output_filename, 'w') as f:
|
with open(output_filename, 'w') as f:
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
import os
|
import posixpath
|
||||||
import os.path
|
|
||||||
|
|
||||||
import spack.build_environment
|
import spack.build_environment
|
||||||
import spack.fetch_strategy
|
import spack.fetch_strategy
|
||||||
@ -19,7 +18,7 @@ class JUnit(Reporter):
|
|||||||
|
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
Reporter.__init__(self, args)
|
Reporter.__init__(self, args)
|
||||||
self.template_file = os.path.join('reports', 'junit.xml')
|
self.template_file = posixpath.join('reports', 'junit.xml')
|
||||||
|
|
||||||
def build_report(self, filename, report_data):
|
def build_report(self, filename, report_data):
|
||||||
# Write the report
|
# Write the report
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
Test that Spack's shebang filtering works correctly.
|
Test that Spack's shebang filtering works correctly.
|
||||||
"""
|
"""
|
||||||
import filecmp
|
import filecmp
|
||||||
import grp
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import stat
|
import stat
|
||||||
@ -24,6 +23,9 @@
|
|||||||
import spack.util.spack_yaml as syaml
|
import spack.util.spack_yaml as syaml
|
||||||
from spack.util.executable import which
|
from spack.util.executable import which
|
||||||
|
|
||||||
|
if sys.platform != 'win32':
|
||||||
|
import grp
|
||||||
|
|
||||||
too_long = sbang.system_shebang_limit + 1
|
too_long = sbang.system_shebang_limit + 1
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user