Compare commits
5 Commits
develop-20
...
features/i
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9479be5618 | ||
![]() |
4dd854d31b | ||
![]() |
25fd25a77d | ||
![]() |
842867dd89 | ||
![]() |
49866c9013 |
@@ -11,8 +11,7 @@
|
|||||||
|
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
from llnl.util.lang import match_predicate
|
from llnl.util.lang import match_predicate
|
||||||
from llnl.util.filesystem import (force_remove, get_filetype,
|
import llnl.util.filesystem as fs
|
||||||
path_contains_subdirectory)
|
|
||||||
|
|
||||||
import spack.store
|
import spack.store
|
||||||
import spack.util.spack_json as sjson
|
import spack.util.spack_json as sjson
|
||||||
@@ -252,8 +251,10 @@ def determine_version(cls, exe):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def determine_variants(cls, exes, version_str):
|
def determine_variants(cls, exes, version_str):
|
||||||
python = Executable(exes[0])
|
python = Executable(exes[0])
|
||||||
|
version = Version(version_str)
|
||||||
|
|
||||||
variants = ''
|
variants = ''
|
||||||
|
|
||||||
for module in ['readline', 'sqlite3', 'dbm', 'nis',
|
for module in ['readline', 'sqlite3', 'dbm', 'nis',
|
||||||
'zlib', 'bz2', 'lzma', 'ctypes', 'uuid']:
|
'zlib', 'bz2', 'lzma', 'ctypes', 'uuid']:
|
||||||
try:
|
try:
|
||||||
@@ -278,7 +279,7 @@ def determine_variants(cls, exes, version_str):
|
|||||||
variants += '~pyexpat'
|
variants += '~pyexpat'
|
||||||
|
|
||||||
# Some modules changed names in Python 3
|
# Some modules changed names in Python 3
|
||||||
if Version(version_str) >= Version('3'):
|
if version >= Version('3'):
|
||||||
try:
|
try:
|
||||||
python('-c', 'import tkinter', error=os.devnull)
|
python('-c', 'import tkinter', error=os.devnull)
|
||||||
variants += '+tkinter'
|
variants += '+tkinter'
|
||||||
@@ -303,6 +304,57 @@ def determine_variants(cls, exes, version_str):
|
|||||||
except ProcessError:
|
except ProcessError:
|
||||||
variants += '~tix'
|
variants += '~tix'
|
||||||
|
|
||||||
|
# Get config args for debug, and optimizations variant checks
|
||||||
|
sysconf_imp = 'import sysconfig'
|
||||||
|
if version < Version('2.7'):
|
||||||
|
sysconf_imp = 'import distutils.sysconfig as sysconfig'
|
||||||
|
conf_args = python(
|
||||||
|
'-c',
|
||||||
|
'%s; print(sysconfig.get_config_var("CONFIG_ARGS"))' % sysconf_imp,
|
||||||
|
output=str, error=str)
|
||||||
|
|
||||||
|
libdir = python(
|
||||||
|
'-c', '%s; print(sysconfig.get_config_var("LIBPL"))' % sysconf_imp,
|
||||||
|
output=str, error=str).strip()
|
||||||
|
# Search for shared libraries in the prefix and set shared variant
|
||||||
|
matches = fs.find_libraries('libpython*', prefix=libdir, shared=True)
|
||||||
|
variants += '+shared' if len(matches) > 0 else '~shared'
|
||||||
|
|
||||||
|
# check for debug
|
||||||
|
# default is off, so we check for the string to turn it on
|
||||||
|
variants += '+debug' if '--with-pydebug' in conf_args else '~debug'
|
||||||
|
|
||||||
|
# Use config args to determine whether optimizations were used
|
||||||
|
opt_var = '~optimizations'
|
||||||
|
# only check for versions that support optimization
|
||||||
|
if version >= Version('3.5.3') or (version >= Version('2.7.13') and
|
||||||
|
version < Version('2.8')):
|
||||||
|
if '--enable-optimizations' in conf_args:
|
||||||
|
opt_var = '+optimizations'
|
||||||
|
variants += opt_var
|
||||||
|
|
||||||
|
# +ucs4 only compatible with python@:3.2
|
||||||
|
if version >= Version('3.3'):
|
||||||
|
variants += '~ucs4'
|
||||||
|
else:
|
||||||
|
# maxunicode is 0xFFFF for UCS2 and 0x10FFFF for UCS4
|
||||||
|
maxunicode = python('-c', 'import sys; print(sys.maxunicode)',
|
||||||
|
output=str, error=str)
|
||||||
|
variants += '~ucs4' if maxunicode == 0xFFFF else '+ucs4'
|
||||||
|
|
||||||
|
# Will always be true for python2, but relevant for python3
|
||||||
|
if 'python' in [os.path.basename(exe) for exe in exes]:
|
||||||
|
variants += '+pythoncmd'
|
||||||
|
else:
|
||||||
|
variants += '~pythoncmd'
|
||||||
|
|
||||||
|
# The libxml2 variant only exists to get out of a circular dependency
|
||||||
|
# This will not be an issue when we add cycle detection to the new
|
||||||
|
# concretizer. Until then, just "detect" the more restrictive option
|
||||||
|
# since we need to detect a fully concrete external python for
|
||||||
|
# concretizer bootstrapping purposes.
|
||||||
|
variants += '~libxml2'
|
||||||
|
|
||||||
return variants
|
return variants
|
||||||
|
|
||||||
def url_for_version(self, version):
|
def url_for_version(self, version):
|
||||||
@@ -549,7 +601,7 @@ def _save_distutil_vars(self):
|
|||||||
# is initialized by the method load_distutils_data().
|
# is initialized by the method load_distutils_data().
|
||||||
self._distutil_vars = {}
|
self._distutil_vars = {}
|
||||||
if output_filename:
|
if output_filename:
|
||||||
force_remove(output_filename)
|
fs.force_remove(output_filename)
|
||||||
|
|
||||||
def _load_distutil_vars(self):
|
def _load_distutil_vars(self):
|
||||||
# We update and keep the cache unchanged only if the package is
|
# We update and keep the cache unchanged only if the package is
|
||||||
@@ -1091,11 +1143,11 @@ def deactivate(self, ext_pkg, view, **args):
|
|||||||
def add_files_to_view(self, view, merge_map):
|
def add_files_to_view(self, view, merge_map):
|
||||||
bin_dir = self.spec.prefix.bin
|
bin_dir = self.spec.prefix.bin
|
||||||
for src, dst in merge_map.items():
|
for src, dst in merge_map.items():
|
||||||
if not path_contains_subdirectory(src, bin_dir):
|
if not fs.path_contains_subdirectory(src, bin_dir):
|
||||||
view.link(src, dst, spec=self.spec)
|
view.link(src, dst, spec=self.spec)
|
||||||
elif not os.path.islink(src):
|
elif not os.path.islink(src):
|
||||||
copy(src, dst)
|
copy(src, dst)
|
||||||
if 'script' in get_filetype(src):
|
if 'script' in fs.get_filetype(src):
|
||||||
filter_file(
|
filter_file(
|
||||||
self.spec.prefix,
|
self.spec.prefix,
|
||||||
os.path.abspath(
|
os.path.abspath(
|
||||||
@@ -1123,7 +1175,7 @@ def add_files_to_view(self, view, merge_map):
|
|||||||
def remove_files_from_view(self, view, merge_map):
|
def remove_files_from_view(self, view, merge_map):
|
||||||
bin_dir = self.spec.prefix.bin
|
bin_dir = self.spec.prefix.bin
|
||||||
for src, dst in merge_map.items():
|
for src, dst in merge_map.items():
|
||||||
if not path_contains_subdirectory(src, bin_dir):
|
if not fs.path_contains_subdirectory(src, bin_dir):
|
||||||
view.remove_file(src, dst)
|
view.remove_file(src, dst)
|
||||||
else:
|
else:
|
||||||
os.remove(dst)
|
os.remove(dst)
|
||||||
|
Reference in New Issue
Block a user