From 4aee27816e7101753aeb392e868096236a26d84d Mon Sep 17 00:00:00 2001 From: John Parent Date: Wed, 16 Mar 2022 16:41:34 -0400 Subject: Windows Support: Testing Suite integration Broaden support for execution of the test suite on Windows. General bug and review fixups --- .../builtin.mock/packages/cmake-client/package.py | 2 + .../repos/builtin.mock/packages/cmake/package.py | 7 ++- .../packages/find-externals1/package.py | 8 ++-- .../trivial-install-test-package/package.py | 5 +- .../repos/builtin/packages/openssl/package.py | 56 ++++++++-------------- var/spack/repos/builtin/packages/python/package.py | 12 ++--- var/spack/repos/builtin/packages/wrf/package.py | 6 +-- 7 files changed, 38 insertions(+), 58 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin.mock/packages/cmake-client/package.py b/var/spack/repos/builtin.mock/packages/cmake-client/package.py index 09b445fd49..0e8d1a3d9b 100644 --- a/var/spack/repos/builtin.mock/packages/cmake-client/package.py +++ b/var/spack/repos/builtin.mock/packages/cmake-client/package.py @@ -94,6 +94,8 @@ class CmakeClient(CMakePackage): # check that which('cmake') returns the right one. cmake = which('cmake') + print(cmake) + print(cmake.exe) check(cmake.exe[0].startswith(spec['cmake'].prefix.bin), "Wrong cmake was in environment: %s" % cmake) diff --git a/var/spack/repos/builtin.mock/packages/cmake/package.py b/var/spack/repos/builtin.mock/packages/cmake/package.py index e5dd7057d1..8c19ca8a6e 100644 --- a/var/spack/repos/builtin.mock/packages/cmake/package.py +++ b/var/spack/repos/builtin.mock/packages/cmake/package.py @@ -4,9 +4,12 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os +import sys from spack import * +is_windows = sys.platform == 'win32' + def check(condition, msg): """Raise an install error if condition is False.""" @@ -43,7 +46,7 @@ class Cmake(Package): check(os.environ['for_install'] == 'for_install', "Couldn't read env var set in compile envieonmnt") - - cmake_exe = join_path(prefix.bin, 'cmake') + cmake_exe_ext = ".exe" if is_windows else '' + cmake_exe = join_path(prefix.bin, 'cmake{}'.format(cmake_exe_ext)) touch(cmake_exe) set_executable(cmake_exe) diff --git a/var/spack/repos/builtin.mock/packages/find-externals1/package.py b/var/spack/repos/builtin.mock/packages/find-externals1/package.py index 9200668d7c..c85598e891 100644 --- a/var/spack/repos/builtin.mock/packages/find-externals1/package.py +++ b/var/spack/repos/builtin.mock/packages/find-externals1/package.py @@ -20,11 +20,11 @@ class FindExternals1(AutotoolsPackage): exe_to_path = dict( (os.path.basename(p), p) for p in exes_in_prefix ) - if 'find-externals1-exe' not in exe_to_path: - return None - + exes = [x for x in exe_to_path.keys() if 'find-externals1-exe' in x] + if not exes: + return exe = spack.util.executable.Executable( - exe_to_path['find-externals1-exe']) + exe_to_path[exes[0]]) output = exe('--version', output=str) if output: match = re.search(r'find-externals1.*version\s+(\S+)', output) diff --git a/var/spack/repos/builtin.mock/packages/trivial-install-test-package/package.py b/var/spack/repos/builtin.mock/packages/trivial-install-test-package/package.py index 748034baca..467a1631fa 100644 --- a/var/spack/repos/builtin.mock/packages/trivial-install-test-package/package.py +++ b/var/spack/repos/builtin.mock/packages/trivial-install-test-package/package.py @@ -2,7 +2,6 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) - from spack import * @@ -15,6 +14,4 @@ class TrivialInstallTestPackage(Package): version('1.0', '0123456789abcdef0123456789abcdef') def install(self, spec, prefix): - configure('--prefix=%s' % prefix) - make() - make('install') + touch(join_path(prefix, 'an_installation_file')) diff --git a/var/spack/repos/builtin/packages/openssl/package.py b/var/spack/repos/builtin/packages/openssl/package.py index 94c1dccf4c..55b949ea9a 100644 --- a/var/spack/repos/builtin/packages/openssl/package.py +++ b/var/spack/repos/builtin/packages/openssl/package.py @@ -5,7 +5,6 @@ import os import re -import sys import llnl.util.tty as tty @@ -98,8 +97,6 @@ class Openssl(Package): # Uses Fake Autotools, should subclass Package depends_on('perl@5.14.0:', type=('build', 'test')) depends_on('ca-certificates-mozilla', type=('build', 'run'), when='certs=mozilla') - conflicts('+dynamic', when=sys.platform != 'win32') - @classmethod def determine_version(cls, exe): output = Executable(exe)('version', output=str, error=str) @@ -141,39 +138,32 @@ class Openssl(Package): # Uses Fake Autotools, should subclass Package options.append('-D__STDC_NO_ATOMICS__') # Make a flag for shared library builds - shared_flag = '' - if spec.satisfies('~shared'): - shared_flag = 'no-shared' - - def configure_args(): - base_args = ['--prefix=%s' % prefix, - '--openssldir=%s' - % join_path(prefix, 'etc', 'openssl')] - if spec.satisfies('platform=windows'): - base_args.extend([ - 'CC=%s' % os.environ.get('CC'), - 'CXX=%s' % os.environ.get('CXX'), - '%s' % shared_flag, - 'VC-WIN64A', - ]) - base_args.insert(0, 'Configure') - else: - base_args.extend( - [ - '-I{0}'.format(self.spec['zlib'].prefix.include), - '-L{0}'.format(self.spec['zlib'].prefix.lib) - ] - ) - base_args.extend(options) - return base_args + base_args = ['--prefix=%s' % prefix, + '--openssldir=%s' + % join_path(prefix, 'etc', 'openssl')] + if spec.satisfies('platform=windows'): + base_args.extend([ + 'CC=%s' % os.environ.get('CC'), + 'CXX=%s' % os.environ.get('CXX'), + 'VC-WIN64A', + ]) + if spec.satisfies('~shared'): + base_args.append('no-shared') + else: + base_args.extend( + [ + '-I{0}'.format(self.spec['zlib'].prefix.include), + '-L{0}'.format(self.spec['zlib'].prefix.lib) + ] + ) + base_args.extend(options) # On Windows, we use perl for configuration and build through MSVC # nmake. if spec.satisfies('platform=windows'): - config = Executable('perl') + Executable('perl')('Configure', *base_args) else: - config = Executable('./config') + Executable('./config')(*base_args) - config(*configure_args()) # Remove non-standard compiler options if present. These options are # present e.g. on Darwin. They are non-standard, i.e. most compilers # (e.g. gcc) will not accept them. @@ -183,10 +173,6 @@ class Openssl(Package): # Uses Fake Autotools, should subclass Package # This variant only makes sense for Windows if spec.satisfies('platform=windows'): filter_file(r'MT', 'MD', 'makefile') - else: - tty.warn("Dynamic runtime builds are only available for " - "Windows operating systems. Please disable " - "+dynamic to suppress this warning.") if spec.satisfies('platform=windows'): host_make = nmake diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py index d0499b7c49..85e9d8ec44 100644 --- a/var/spack/repos/builtin/packages/python/package.py +++ b/var/spack/repos/builtin/packages/python/package.py @@ -4,17 +4,16 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import glob -import inspect import json import os +import platform import re import subprocess import sys -from distutils.dir_util import copy_tree from shutil import copy import llnl.util.tty as tty -from llnl.util.filesystem import get_filetype, path_contains_subdirectory +from llnl.util.filesystem import copy_tree, get_filetype, path_contains_subdirectory from llnl.util.lang import match_predicate from spack import * @@ -46,7 +45,6 @@ class Python(Package): version('3.10.0', sha256='c4e0cbad57c90690cb813fb4663ef670b4d0f587d8171e2c42bd4c9245bd2758') version('3.9.10', sha256='1aa9c0702edbae8f6a2c95f70a49da8420aaa76b7889d3419c186bfc8c0e571e', preferred=True) version('3.9.9', sha256='2cc7b67c1f3f66c571acc42479cdf691d8ed6b47bee12c9b68430413a17a44ea') - version('3.9.9', sha256='2cc7b67c1f3f66c571acc42479cdf691d8ed6b47bee12c9b68430413a17a44ea') version('3.9.8', sha256='7447fb8bb270942d620dd24faa7814b1383b61fa99029a240025fd81c1db8283') version('3.9.7', sha256='a838d3f9360d157040142b715db34f0218e535333696a5569dc6f854604eb9d1') version('3.9.6', sha256='d0a35182e19e416fc8eae25a3dcd4d02d4997333e4ad1f2eee6010aadc3fe866') @@ -226,7 +224,6 @@ class Python(Package): patch('python-3.7.4+-distutils-C++.patch', when='@3.7.4:') patch('python-3.7.4+-distutils-C++-testsuite.patch', when='@3.7.4:') patch('cpython-windows-externals.patch', when='@:3.9.6 platform=windows') - patch('tkinter.patch', when='@:2.8,3.3:3.7 platform=darwin') # Patch the setup script to deny that tcl/x11 exists rather than allowing # autodetection of (possibly broken) system components @@ -680,7 +677,7 @@ class Python(Package): # See https://autotools.io/automake/silent.html params = ['V=1'] params += self.build_targets - inspect.getmodule(self).make(*params) + make(*params) def install(self, spec, prefix): """Makes the install targets specified by @@ -690,7 +687,7 @@ class Python(Package): if is_windows: self.win_installer(prefix) else: - inspect.getmodule(self).make(*self.install_targets) + make(*self.install_targets) @run_after('install') def filter_compilers(self): @@ -909,7 +906,6 @@ class Python(Package): Returns: dict: variable definitions """ - cmd = """ import json from sysconfig import ( diff --git a/var/spack/repos/builtin/packages/wrf/package.py b/var/spack/repos/builtin/packages/wrf/package.py index 84c8f9dafa..2c8c2f552a 100644 --- a/var/spack/repos/builtin/packages/wrf/package.py +++ b/var/spack/repos/builtin/packages/wrf/package.py @@ -6,8 +6,6 @@ import glob import re import time -from fcntl import F_GETFL, F_SETFL, fcntl -from os import O_NONBLOCK from os.path import basename from subprocess import PIPE, Popen from sys import platform, stdout @@ -20,9 +18,7 @@ is_windows = platform == 'win32' if not is_windows: from fcntl import F_GETFL, F_SETFL, fcntl - from os import O_NONBLOCK, rename -else: - from os import rename + from os import O_NONBLOCK re_optline = re.compile(r'\s+[0-9]+\..*\((serial|smpar|dmpar|dm\+sm)\)\s+') re_paroptname = re.compile(r'\((serial|smpar|dmpar|dm\+sm)\)') -- cgit v1.2.3-70-g09d2