Expand external find for Windows (#27588)
* Incorporate new search location * Add external user option * proper doc string * Explicit commands in getting started * raise during chgrp on Win recover installer changes Notate admin privleges Windows phase install hooks Find external python and install ninja (#23496) Allow external find python to find windows python and spack install ninja Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com> Co-authored-by: Betsy McPhail <betsy.mcphail@kitware.com>
This commit is contained in:

committed by
Peter Scheibel

parent
06aef626cb
commit
df4129d395
@@ -45,7 +45,7 @@ def patch(self):
|
||||
def configure(self, spec, prefix):
|
||||
with working_dir(self.stage.source_path, create=True):
|
||||
if not is_windows:
|
||||
configure(['--prefix={0}'.format(self.prefix)])
|
||||
configure(*['--prefix={0}'.format(self.prefix)])
|
||||
|
||||
def build(self, spec, prefix):
|
||||
with working_dir(self.stage.source_path):
|
||||
@@ -53,11 +53,11 @@ def build(self, spec, prefix):
|
||||
touch('asm\\warnings.time')
|
||||
nmake('/f', 'Mkfiles\\msvc.mak')
|
||||
else:
|
||||
make(['V=1'])
|
||||
make(*['V=1'])
|
||||
|
||||
def install(self, spec, prefix):
|
||||
with working_dir(self.stage.source_path):
|
||||
if is_windows:
|
||||
pass
|
||||
else:
|
||||
make(['install'])
|
||||
make(*['install'])
|
||||
|
@@ -2,6 +2,7 @@
|
||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
import sys
|
||||
|
||||
|
||||
class Ninja(Package):
|
||||
@@ -53,9 +54,14 @@ def setup_run_environment(self, env):
|
||||
|
||||
def install(self, spec, prefix):
|
||||
mkdir(prefix.bin)
|
||||
install('ninja', prefix.bin)
|
||||
name = 'ninja'
|
||||
if sys.platform == 'win32':
|
||||
name = name + '.exe'
|
||||
install(name, prefix.bin)
|
||||
install_tree('misc', prefix.misc)
|
||||
|
||||
if sys.platform == "win32":
|
||||
return
|
||||
# Some distros like Fedora install a 'ninja-build' executable
|
||||
# instead of 'ninja'. Install both for uniformity.
|
||||
with working_dir(prefix.bin):
|
||||
|
@@ -194,7 +194,7 @@ def nmake_arguments(self):
|
||||
args.append('CCTYPE=%s' % self.compiler.msvc_version)
|
||||
else:
|
||||
raise RuntimeError("Perl unsupported for non MSVC compilers on Windows")
|
||||
args.append('INST_TOP="%s"' % self.prefix.replace('/', '\\'))
|
||||
args.append('INST_TOP=%s' % self.prefix.replace('/', '\\'))
|
||||
args.append("INST_ARCH=\\$(ARCHNAME)")
|
||||
if self.spec.satisfies('~shared'):
|
||||
args.append("ALL_STATIC=%s" % "define")
|
||||
|
@@ -846,9 +846,13 @@ def command(self):
|
||||
# in that order if using python@3.6.5, for example.
|
||||
version = self.spec.version
|
||||
for ver in [version.up_to(2), version.up_to(1), '']:
|
||||
path = os.path.join(self.prefix.bin, 'python{0}'.format(ver))
|
||||
if sys.platform != "win32":
|
||||
path = os.path.join(self.prefix.bin, 'python{0}'.format(ver))
|
||||
else:
|
||||
path = os.path.join(self.prefix, 'python{0}.exe'.format(ver))
|
||||
if os.path.exists(path):
|
||||
return Executable(path)
|
||||
|
||||
else:
|
||||
msg = 'Unable to locate {0} command in {1}'
|
||||
raise RuntimeError(msg.format(self.name, self.prefix.bin))
|
||||
@@ -892,21 +896,6 @@ def config_vars(self):
|
||||
Returns:
|
||||
dict: variable definitions
|
||||
"""
|
||||
# Some values set by sysconfig may not always exist on Windows, so
|
||||
# compute Windows alternatives
|
||||
def repair_win_sysconf(conf):
|
||||
if is_windows:
|
||||
conf["LIBDIR"] = os.path.join(conf["LIBDEST"], "..", "libs")
|
||||
conf["LIBPL"] = conf["LIBDIR"]
|
||||
conf["PYTHONFRAMEWORKPREFIX"] = ""
|
||||
conf["LDLIBRARY"] = "python" + conf["VERSION"] + ".dll"
|
||||
conf["LIBRARY"] = "python" + conf["VERSION"] + ".lib"
|
||||
conf["CC"] = ""
|
||||
conf["CXX"] = ""
|
||||
conf["LDSHARED"] = ""
|
||||
conf["LDCXXSHARED"] = ""
|
||||
|
||||
return conf
|
||||
|
||||
# TODO: distutils is deprecated in Python 3.10 and will be removed in
|
||||
# Python 3.12, find a different way to access this information.
|
||||
@@ -976,7 +965,7 @@ def repair_win_sysconf(conf):
|
||||
config.update(json.loads(self.command('-c', cmd, output=str)))
|
||||
except (ProcessError, RuntimeError):
|
||||
pass
|
||||
self._config_vars[dag_hash] = repair_win_sysconf(config)
|
||||
self._config_vars[dag_hash] = config
|
||||
return self._config_vars[dag_hash]
|
||||
|
||||
def get_sysconfigdata_name(self):
|
||||
|
@@ -46,7 +46,9 @@ class Ruby(Package):
|
||||
depends_on('openssl@:1.0', when='@:2.3')
|
||||
|
||||
extendable = True
|
||||
phases = ['autoreconf', 'configure', 'build', 'install']
|
||||
phases = ['configure', 'build', 'install']
|
||||
build_targets = []
|
||||
install_targets = ['install']
|
||||
# Known build issues when Avira antivirus software is running:
|
||||
# https://github.com/rvm/rvm/issues/4313#issuecomment-374020379
|
||||
# TODO: add check for this and warn user
|
||||
@@ -120,17 +122,17 @@ def setup_dependent_package(self, module, dependent_spec):
|
||||
module.rake = Executable(self.prefix.bin.rake)
|
||||
|
||||
def configure(self, spec, prefix):
|
||||
with working_dir(self.build_directory, create=True):
|
||||
if is_windows:
|
||||
Executable("win32\\configure.bat", "--prefix=%s" % self.prefix)
|
||||
else:
|
||||
options = getattr(self, 'configure_flag_args', [])
|
||||
options += ['--prefix={0}'.format(prefix)]
|
||||
options += self.configure_args()
|
||||
configure(*options)
|
||||
with working_dir(self.stage.source_path, create=True):
|
||||
# if is_windows:
|
||||
Executable("win32\\configure.bat")("--prefix=%s" % self.prefix)
|
||||
# else:
|
||||
# options = getattr(self, 'configure_flag_args', [])
|
||||
# options += ['--prefix={0}'.format(prefix)]
|
||||
# options += self.configure_args()
|
||||
# configure(*options)
|
||||
|
||||
def build(self, spec, prefix):
|
||||
with working_dir(self.build_directory):
|
||||
with working_dir(self.stage.source_path):
|
||||
if is_windows:
|
||||
nmake()
|
||||
else:
|
||||
@@ -139,7 +141,7 @@ def build(self, spec, prefix):
|
||||
make(*params)
|
||||
|
||||
def install(self, spec, prefix):
|
||||
with working_dir(self.build_directory):
|
||||
with working_dir(self.stage.source_path):
|
||||
if is_windows:
|
||||
nmake('install')
|
||||
else:
|
||||
|
Reference in New Issue
Block a user