Python: optional dependencies and post-installation tests (#10335)

* Add post-installation tests to Python package

* libbsd does not build on macOS

* Make Python dependencies optional

* Add readline dep, remove ncurses patch, fix autoreconf
This commit is contained in:
Adam J. Stewart 2019-02-23 12:36:26 -06:00 committed by GitHub
parent 68af6148d1
commit b43e8fcaa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 334 additions and 86 deletions

View File

@ -0,0 +1,24 @@
diff -Naur a/Makefile.in b/Makefile.in
--- a/Makefile.in 2019-01-13 17:43:38.000000000 -0600
+++ b/Makefile.in 2019-01-13 17:44:25.000000000 -0600
@@ -101,7 +101,7 @@
ranlib $(LIBSTATIC)
$(LIBSHARED): Makefile vars.mk $(OBJS)
- $(LD) $(LDFLAGS) -shared -Wl,-soname,$(LIBSONAME) -o $(LIBSHARED) $(OBJS) -lm
+ $(LD) $(LDFLAGS) -shared -Wl,-install_name,$(LIBSONAME) -o $(LIBSHARED) $(OBJS) -lm
$(NEWVARS):
diff -Naur a/configure b/configure
--- a/configure 2019-01-13 17:43:38.000000000 -0600
+++ b/configure 2019-01-13 17:43:56.000000000 -0600
@@ -2385,7 +2385,7 @@
-LIBSHARED=libmpdec.so.$PACKAGE_VERSION
+LIBSHARED=libmpdec.$PACKAGE_VERSION.dylib
# Language and compiler:

View File

@ -0,0 +1,18 @@
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Cdecimal(AutotoolsPackage):
"""cdecimal is a fast drop-in replacement for the decimal module in
Python's standard library."""
homepage = "https://www.bytereef.org/mpdecimal/"
url = "https://www.bytereef.org/software/mpdecimal/releases/cdecimal-2.3.tar.gz"
version('2.3', sha256='d737cbe43ed1f6ad9874fb86c3db1e9bbe20c0c750868fde5be3f379ade83d8b')
patch('darwin_install_name.patch', when='platform=darwin')

View File

@ -22,3 +22,6 @@ class Libbsd(AutotoolsPackage):
version('0.8.6', sha256='467fbf9df1f49af11f7f686691057c8c0a7613ae5a870577bef9155de39f9687') version('0.8.6', sha256='467fbf9df1f49af11f7f686691057c8c0a7613ae5a870577bef9155de39f9687')
patch('cdefs.h.patch', when='@0.8.6 %gcc@:4') patch('cdefs.h.patch', when='@0.8.6 %gcc@:4')
# https://gitlab.freedesktop.org/libbsd/libbsd/issues/1
conflicts('platform=darwin')

View File

@ -0,0 +1,29 @@
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libnsl(AutotoolsPackage):
"""This library contains the public client interface for NIS(YP) and NIS+
in a IPv6 ready version."""
homepage = "https://github.com/thkukuk/libnsl"
url = "https://github.com/thkukuk/libnsl/archive/v1.2.0.tar.gz"
version('1.2.0', sha256='a5a28ef17c4ca23a005a729257c959620b09f8c7f99d0edbfe2eb6b06bafd3f8')
depends_on('autoconf', type='build')
depends_on('automake', type='build')
depends_on('libtool', type='build')
depends_on('m4', type='build')
depends_on('pkgconfig@0.9.0:', type='build')
depends_on('gettext')
depends_on('rpcsvc-proto')
depends_on('libtirpc')
def autoreconf(self, spec, prefix):
autoreconf = which('autoreconf')
autoreconf('-fi')

View File

@ -0,0 +1,22 @@
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libtirpc(AutotoolsPackage):
"""Libtirpc is a port of Suns Transport-Independent RPC library to Linux.
"""
homepage = "https://sourceforge.net/projects/libtirpc/"
url = "https://sourceforge.net/projects/libtirpc/files/libtirpc/1.1.4/libtirpc-1.1.4.tar.bz2/download"
version('1.1.4', sha256='2ca529f02292e10c158562295a1ffd95d2ce8af97820e3534fe1b0e3aec7561d')
# FIXME: build error on macOS
# auth_none.c:81:9: error: unknown type name 'mutex_t'
def configure_args(self):
return ['--disable-gssapi']

View File

@ -17,4 +17,5 @@ class Libxdmcp(AutotoolsPackage):
depends_on('xproto', type='build') depends_on('xproto', type='build')
depends_on('pkgconfig', type='build') depends_on('pkgconfig', type='build')
depends_on('util-macros', type='build') depends_on('util-macros', type='build')
depends_on('libbsd') depends_on('libbsd', when='platform=linux')
depends_on('libbsd', when='platform=cray')

View File

@ -0,0 +1,24 @@
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Mpdecimal(AutotoolsPackage):
"""mpdecimal is a package for correctly-rounded arbitrary precision
decimal floating point arithmetic."""
homepage = "https://www.bytereef.org/mpdecimal/"
url = "https://www.bytereef.org/software/mpdecimal/releases/mpdecimal-2.4.2.tar.gz"
list_url = "https://www.bytereef.org/mpdecimal/download.html"
version('2.4.2', sha256='83c628b90f009470981cf084c5418329c88b19835d8af3691b930afccb7d79c7')
depends_on('gmake', type='build')
@property
def libs(self):
# Suffix is .so, even on macOS
return LibraryList(find(self.prefix.lib, 'libmpdec.so'))

View File

@ -17,7 +17,7 @@ class PyPymol(PythonPackage):
version('2.1.0', 'ef2ab2ce11d65785ca3258b4e6982dfb') version('2.1.0', 'ef2ab2ce11d65785ca3258b4e6982dfb')
depends_on('python+tk', type=('build', 'run')) depends_on('python+tkinter', type=('build', 'run'))
depends_on('tcl') depends_on('tcl')
depends_on('tk') depends_on('tk')
depends_on('py-pmw') depends_on('py-pmw')

View File

@ -1,11 +0,0 @@
--- a/setup.py 2016-08-30 15:39:59.334926574 -0500
+++ b/setup.py 2016-08-30 15:46:57.227946339 -0500
@@ -745,8 +745,6 @@
# use the same library for the readline and curses modules.
if 'curses' in readline_termcap_library:
curses_library = readline_termcap_library
- elif self.compiler.find_library_file(lib_dirs, 'ncursesw'):
- curses_library = 'ncursesw'
elif self.compiler.find_library_file(lib_dirs, 'ncurses'):
curses_library = 'ncurses'
elif self.compiler.find_library_file(lib_dirs, 'curses'):

View File

@ -24,8 +24,8 @@
class Python(AutotoolsPackage): class Python(AutotoolsPackage):
"""The Python programming language.""" """The Python programming language."""
homepage = "http://www.python.org" homepage = "https://www.python.org/"
url = "http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz" url = "https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz"
list_url = "https://www.python.org/downloads/" list_url = "https://www.python.org/downloads/"
list_depth = 1 list_depth = 1
@ -63,9 +63,6 @@ class Python(AutotoolsPackage):
# See http://bugs.python.org/issue29846 # See http://bugs.python.org/issue29846
variant('shared', default=sys.platform != 'darwin', variant('shared', default=sys.platform != 'darwin',
description='Enable shared libraries') description='Enable shared libraries')
variant('tk', default=False, description='Provide support for Tkinter')
variant('ucs4', default=False,
description='Enable UCS4 (wide) unicode strings')
# From https://docs.python.org/2/c-api/unicode.html: Python's default # From https://docs.python.org/2/c-api/unicode.html: Python's default
# builds use a 16-bit type for Py_UNICODE and store Unicode values # builds use a 16-bit type for Py_UNICODE and store Unicode values
# internally as UCS2. It is also possible to build a UCS4 version of Python # internally as UCS2. It is also possible to build a UCS4 version of Python
@ -73,10 +70,10 @@ class Python(AutotoolsPackage):
# builds then use a 32-bit type for Py_UNICODE and store Unicode data # builds then use a 32-bit type for Py_UNICODE and store Unicode data
# internally as UCS4. Note that UCS2 and UCS4 Python builds are not binary # internally as UCS4. Note that UCS2 and UCS4 Python builds are not binary
# compatible. # compatible.
variant('ucs4', default=False,
description='Enable UCS4 (wide) unicode strings')
variant('pic', default=True, variant('pic', default=True,
description='Produce position-independent code (for shared libs)') description='Produce position-independent code (for shared libs)')
variant('dbm', default=True, description='Provide support for dbm')
variant( variant(
'optimizations', 'optimizations',
default=False, default=False,
@ -87,31 +84,49 @@ class Python(AutotoolsPackage):
description="Symlink 'python3' executable to 'python' " description="Symlink 'python3' executable to 'python' "
"(not PEP 394 compliant)") "(not PEP 394 compliant)")
depends_on("pkgconfig", type="build") # Optional Python modules
depends_on("openssl") variant('readline', default=True, description='Build readline module')
depends_on("bzip2") variant('ssl', default=True, description='Build ssl module')
depends_on("readline") variant('sqlite3', default=True, description='Build sqlite3 module')
depends_on("ncurses") variant('dbm', default=True, description='Build dbm module')
depends_on("sqlite") variant('nis', default=False, description='Build nis module')
depends_on("zlib") variant('zlib', default=True, description='Build zlib module')
depends_on("tk", when="+tk") variant('bz2', default=True, description='Build bz2 module')
depends_on("tcl", when="+tk") variant('lzma', default=True, description='Build lzma module')
depends_on("gdbm", when='+dbm') variant('pyexpat', default=True, description='Build pyexpat module')
variant('ctypes', default=True, description='Build ctypes module')
variant('tkinter', default=False, description='Build tkinter module')
variant('uuid', default=False, description='Build uuid module')
# https://docs.python.org/3/whatsnew/3.7.html#build-changes depends_on('pkgconfig@0.9.0:', type='build')
depends_on("libffi", when="@3.7:")
depends_on("openssl@1.0.2:", when="@3.7:")
# Patch does not work for Python 3.1 # Optional dependencies
patch('ncurses.patch', when='@:2.8,3.2:') # See detect_modules() in setup.py for details
depends_on('readline', when='+readline')
depends_on('ncurses', when='+readline')
depends_on('openssl', when='+ssl')
depends_on('openssl@1.0.2:', when='@3.7:+ssl') # https://docs.python.org/3/whatsnew/3.7.html#build-changes
depends_on('sqlite@3.0.8:', when='+sqlite3')
depends_on('gdbm', when='+dbm') # alternatively ndbm or berkeley-db
depends_on('libnsl', when='+nis')
depends_on('zlib@1.1.3:', when='+zlib')
depends_on('bzip2', when='+bz2')
depends_on('xz', when='@3.3:+lzma')
depends_on('expat', when='+pyexpat')
depends_on('libffi', when='+ctypes')
depends_on('tk', when='+tkinter')
depends_on('tcl', when='+tkinter')
depends_on('libuuid', when='+uuid')
patch('tkinter.patch', when='@:2.8,3.3: platform=darwin')
# Ensure that distutils chooses correct compiler option for RPATH on cray: # Ensure that distutils chooses correct compiler option for RPATH on cray:
patch('cray-rpath-2.3.patch', when="@2.3:3.0.1 platform=cray") patch('cray-rpath-2.3.patch', when='@2.3:3.0.1 platform=cray')
patch('cray-rpath-3.1.patch', when="@3.1:3.99 platform=cray") patch('cray-rpath-3.1.patch', when='@3.1:3.99 platform=cray')
# Fixes an alignment problem with more aggressive optimization in gcc8 # Fixes an alignment problem with more aggressive optimization in gcc8
# https://github.com/python/cpython/commit/0b91f8a668201fc58fa732b8acc496caedfdbae0 # https://github.com/python/cpython/commit/0b91f8a668201fc58fa732b8acc496caedfdbae0
patch('gcc-8-2.7.14.patch', when="@2.7.14 %gcc@8:") patch('gcc-8-2.7.14.patch', when='@2.7.14 %gcc@8:')
# For more information refer to this bug report: # For more information refer to this bug report:
# https://bugs.python.org/issue29712 # https://bugs.python.org/issue29712
@ -156,37 +171,33 @@ def setup_environment(self, spack_env, run_env):
def configure_args(self): def configure_args(self):
spec = self.spec spec = self.spec
config_args = []
# setup.py needs to be able to read the CPPFLAGS and LDFLAGS # setup.py needs to be able to read the CPPFLAGS and LDFLAGS
# as it scans for the library and headers to build # as it scans for the library and headers to build
link_deps = spec.dependencies('link') link_deps = spec.dependencies('link')
# Header files are often included assuming they reside in a if link_deps:
# subdirectory of prefix.include, e.g. #include <openssl/ssl.h>, # Header files are often included assuming they reside in a
# which is why we don't use HeaderList here. The header files of # subdirectory of prefix.include, e.g. #include <openssl/ssl.h>,
# libffi reside in prefix.lib but the configure script of Python # which is why we don't use HeaderList here. The header files of
# finds them using pkg-config. # libffi reside in prefix.lib but the configure script of Python
cppflags = '-I' + ' -I'.join(dep.prefix.include # finds them using pkg-config.
for dep in link_deps cppflags = ' '.join('-I' + spec[dep.name].prefix.include
if dep.name != 'libffi') for dep in link_deps)
# Currently, the only way to get SpecBuildInterface wrappers of the # Currently, the only way to get SpecBuildInterface wrappers of the
# dependencies (which we need to get their 'libs') is to get them # dependencies (which we need to get their 'libs') is to get them
# using spec.__getitem__. # using spec.__getitem__.
ldflags = ' '.join(spec[dep.name].libs.search_flags ldflags = ' '.join(spec[dep.name].libs.search_flags
for dep in link_deps) for dep in link_deps)
config_args = ['CPPFLAGS=' + cppflags, 'LDFLAGS=' + ldflags] config_args.extend(['CPPFLAGS=' + cppflags, 'LDFLAGS=' + ldflags])
# https://docs.python.org/3/whatsnew/3.7.html#build-changes # https://docs.python.org/3/whatsnew/3.7.html#build-changes
if spec.satisfies('@:3.6'): if spec.satisfies('@:3.6'):
config_args.append('--with-threads') config_args.append('--with-threads')
if '^libffi' in spec:
config_args.append('--with-system-ffi')
else:
config_args.append('--without-system-ffi')
if spec.satisfies('@2.7.13:2.8,3.5.3:', strict=True) \ if spec.satisfies('@2.7.13:2.8,3.5.3:', strict=True) \
and '+optimizations' in spec: and '+optimizations' in spec:
config_args.append('--enable-optimizations') config_args.append('--enable-optimizations')
@ -209,7 +220,7 @@ def configure_args(self):
elif spec.satisfies('@3.0:3.2'): elif spec.satisfies('@3.0:3.2'):
config_args.append('--with-wide-unicode') config_args.append('--with-wide-unicode')
elif spec.satisfies('@3.3:'): elif spec.satisfies('@3.3:'):
# https://docs.python.org/3.3/whatsnew/3.3.html # https://docs.python.org/3.3/whatsnew/3.3.html#functionality
raise ValueError( raise ValueError(
'+ucs4 variant not compatible with Python 3.3 and beyond') '+ucs4 variant not compatible with Python 3.3 and beyond')
@ -219,6 +230,35 @@ def configure_args(self):
if '+pic' in spec: if '+pic' in spec:
config_args.append('CFLAGS={0}'.format(self.compiler.pic_flag)) config_args.append('CFLAGS={0}'.format(self.compiler.pic_flag))
if spec.satisfies('@3.7:'):
if '+ssl' in spec:
config_args.append('--with-openssl={0}'.format(
spec['openssl'].prefix))
if '+dbm' in spec:
# Default order is ndbm:gdbm:bdb
config_args.append('--with-dbmliborder=gdbm:bdb:ndbm')
else:
config_args.append('--with-dbmliborder=')
if '+pyexpat' in spec:
config_args.append('--with-system-expat')
else:
config_args.append('--without-system-expat')
if '+ctypes' in spec:
config_args.append('--with-system-ffi')
else:
config_args.append('--without-system-ffi')
if '+tkinter' in spec:
config_args.extend([
'--with-tcltk-includes=-I{0} -I{1}'.format(
spec['tcl'].prefix.include, spec['tk'].prefix.include),
'--with-tcltk-libs={0} {1}'.format(
spec['tcl'].libs.ld_flags, spec['tk'].libs.ld_flags)
])
return config_args return config_args
@run_after('install') @run_after('install')
@ -260,26 +300,75 @@ def post_install(self):
os.symlink(os.path.join(prefix.bin, 'python3-config'), os.symlink(os.path.join(prefix.bin, 'python3-config'),
os.path.join(prefix.bin, 'python-config')) os.path.join(prefix.bin, 'python-config'))
# TODO: Once better testing support is integrated, add the following tests @run_after('install')
# https://wiki.python.org/moin/TkInter @on_package_attributes(run_tests=True)
# def import_tests(self):
# Note: Only works if ForwardX11Trusted is enabled, i.e. `ssh -Y` """Test that basic Python functionality works."""
#
# if '+tk' in spec: spec = self.spec
# env['TK_LIBRARY'] = join_path(spec['tk'].prefix.lib,
# 'tk{0}'.format(spec['tk'].version.up_to(2))) with working_dir('spack-test', create=True):
# env['TCL_LIBRARY'] = join_path(spec['tcl'].prefix.lib, # Ensure that readline module works
# 'tcl{0}'.format(spec['tcl'].version.up_to(2))) if '+readline' in spec:
# self.command('-c', 'import readline')
# $ python
# >>> import _tkinter # Ensure that ssl module works
# if '+ssl' in spec:
# if spec.satisfies('@3:') self.command('-c', 'import ssl')
# >>> import tkinter self.command('-c', 'import hashlib')
# >>> tkinter._test()
# else: # Ensure that sqlite3 module works
# >>> import Tkinter if '+sqlite3' in spec:
# >>> Tkinter._test() self.command('-c', 'import sqlite3')
# Ensure that dbm module works
if '+dbm' in spec:
self.command('-c', 'import dbm')
# Ensure that nis module works
if '+nis' in spec:
self.command('-c', 'import nis')
# Ensure that zlib module works
if '+zlib' in spec:
self.command('-c', 'import zlib')
# Ensure that bz2 module works
if '+bz2' in spec:
self.command('-c', 'import bz2')
# Ensure that lzma module works
if spec.satisfies('@3.3:'):
if '+lzma' in spec:
self.command('-c', 'import lzma')
# Ensure that pyexpat module works
if '+pyexpat' in spec:
self.command('-c', 'import xml.parsers.expat')
self.command('-c', 'import xml.etree.ElementTree')
# Ensure that ctypes module works
if '+ctypes' in spec:
self.command('-c', 'import ctypes')
# Ensure that tkinter module works
# https://wiki.python.org/moin/TkInter
if '+tkinter' in spec:
# Only works if ForwardX11Trusted is enabled, i.e. `ssh -Y`
if 'DISPLAY' in env:
if spec.satisfies('@3:'):
self.command('-c', 'import tkinter; tkinter._test()')
else:
self.command('-c', 'import Tkinter; Tkinter._test()')
else:
if spec.satisfies('@3:'):
self.command('-c', 'import tkinter')
else:
self.command('-c', 'import Tkinter')
# Ensure that uuid module works
if '+uuid' in spec:
self.command('-c', 'import uuid')
def _save_distutil_vars(self, prefix): def _save_distutil_vars(self, prefix):
""" """

View File

@ -0,0 +1,17 @@
diff -Naur a/setup.py b/setup.py
--- a/setup.py 2019-01-13 18:59:14.000000000 -0600
+++ b/setup.py 2019-01-13 19:00:31.000000000 -0600
@@ -1787,13 +1787,6 @@
if self.detect_tkinter_explicitly():
return
- # Rather than complicate the code below, detecting and building
- # AquaTk is a separate method. Only one Tkinter will be built on
- # Darwin - either AquaTk, if it is found, or X11 based Tk.
- if (host_platform == 'darwin' and
- self.detect_tkinter_darwin(inc_dirs, lib_dirs)):
- return
-
# Assume we haven't found any of the libraries or include files
# The versions with dots are used on Unix, and the versions without
# dots on Windows, for detection by cygwin.

View File

@ -0,0 +1,20 @@
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RpcsvcProto(AutotoolsPackage):
"""rpcsvc protocol definitions from glibc."""
homepage = "https://github.com/thkukuk/rpcsvc-proto"
url = "https://github.com/thkukuk/rpcsvc-proto/releases/download/v1.4/rpcsvc-proto-1.4.tar.gz"
version('1.4', sha256='867e46767812784d8dda6d8d931d6fabb30168abb02d87a2a205be6d5a2934a7')
depends_on('gettext')
def configure_args(self):
return ['LIBS=-lintl']

View File

@ -33,11 +33,6 @@ class Tcl(AutotoolsPackage):
configure_directory = 'unix' configure_directory = 'unix'
def setup_environment(self, spack_env, run_env):
# When using Tkinter from within spack provided python+tk, python
# will not be able to find Tcl/Tk unless TCL_LIBRARY is set.
run_env.set('TCL_LIBRARY', join_path(self.prefix, self.tcl_lib_dir))
def install(self, spec, prefix): def install(self, spec, prefix):
with working_dir(self.build_directory): with working_dir(self.build_directory):
make('install') make('install')
@ -77,7 +72,8 @@ def symlink_tclsh(self):
@property @property
def libs(self): def libs(self):
return LibraryList([]) return find_libraries(['libtcl{0}'.format(self.version.up_to(2))],
root=self.prefix, recursive=True)
@property @property
def command(self): def command(self):
@ -101,11 +97,18 @@ def tcl_builtin_lib_dir(self):
return join_path(self.tcl_lib_dir, return join_path(self.tcl_lib_dir,
'tcl{0}'.format(self.version.up_to(2))) 'tcl{0}'.format(self.version.up_to(2)))
def setup_environment(self, spack_env, run_env):
# When using Tkinter from within spack provided python+tkinter, python
# will not be able to find Tcl/Tk unless TCL_LIBRARY is set.
run_env.set('TCL_LIBRARY', join_path(self.prefix, self.tcl_lib_dir))
def setup_dependent_environment(self, spack_env, run_env, dependent_spec): def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
"""Set TCLLIBPATH to include the tcl-shipped directory for """Set TCLLIBPATH to include the tcl-shipped directory for
extensions and any other tcl extension it depends on. extensions and any other tcl extension it depends on.
For further info see: https://wiki.tcl.tk/1787""" For further info see: https://wiki.tcl.tk/1787"""
spack_env.set('TCL_LIBRARY', join_path(self.prefix, self.tcl_lib_dir))
# If we set TCLLIBPATH, we must also ensure that the corresponding # If we set TCLLIBPATH, we must also ensure that the corresponding
# tcl is found in the build environment. This to prevent cases # tcl is found in the build environment. This to prevent cases
# where a system provided tcl is run against the standard libraries # where a system provided tcl is run against the standard libraries

View File

@ -30,14 +30,19 @@ class Tk(AutotoolsPackage):
@property @property
def libs(self): def libs(self):
return LibraryList([]) return find_libraries(['libtk{0}'.format(self.version.up_to(2))],
root=self.prefix, recursive=True)
def setup_environment(self, spack_env, run_env): def setup_environment(self, spack_env, run_env):
# When using Tkinter from within spack provided python+tk, python # When using Tkinter from within spack provided python+tkinter, python
# will not be able to find Tcl/Tk unless TK_LIBRARY is set. # will not be able to find Tcl/Tk unless TK_LIBRARY is set.
run_env.set('TK_LIBRARY', join_path(self.prefix.lib, 'tk{0}'.format( run_env.set('TK_LIBRARY', join_path(self.prefix.lib, 'tk{0}'.format(
self.spec.version.up_to(2)))) self.spec.version.up_to(2))))
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
spack_env.set('TK_LIBRARY', join_path(self.prefix.lib, 'tk{0}'.format(
self.spec.version.up_to(2))))
def configure_args(self): def configure_args(self):
spec = self.spec spec = self.spec
return ['--with-tcl={0}'.format(spec['tcl'].prefix.lib)] return ['--with-tcl={0}'.format(spec['tcl'].prefix.lib)]

View File

@ -20,3 +20,7 @@ class Xz(AutotoolsPackage):
version('5.2.3', '1592e7ca3eece099b03b35f4d9179e7c') version('5.2.3', '1592e7ca3eece099b03b35f4d9179e7c')
version('5.2.2', 'f90c9a0c8b259aee2234c4e0d7fd70af') version('5.2.2', 'f90c9a0c8b259aee2234c4e0d7fd70af')
version('5.2.0', '867cc8611760240ebf3440bd6e170bb9') version('5.2.0', '867cc8611760240ebf3440bd6e170bb9')
@property
def libs(self):
return find_libraries(['liblzma'], root=self.prefix, recursive=True)