From b43e8fcaa767d5262e76a1d932b3ca52a6f60ed1 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Sat, 23 Feb 2019 12:36:26 -0600 Subject: 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 --- .../packages/cdecimal/darwin_install_name.patch | 24 +++ .../repos/builtin/packages/cdecimal/package.py | 18 ++ var/spack/repos/builtin/packages/libbsd/package.py | 3 + var/spack/repos/builtin/packages/libnsl/package.py | 29 +++ .../repos/builtin/packages/libtirpc/package.py | 22 ++ .../repos/builtin/packages/libxdmcp/package.py | 3 +- .../repos/builtin/packages/mpdecimal/package.py | 24 +++ .../repos/builtin/packages/py-pymol/package.py | 2 +- .../repos/builtin/packages/python/ncurses.patch | 11 - var/spack/repos/builtin/packages/python/package.py | 223 ++++++++++++++------- .../repos/builtin/packages/python/tkinter.patch | 17 ++ .../repos/builtin/packages/rpcsvc-proto/package.py | 20 ++ var/spack/repos/builtin/packages/tcl/package.py | 15 +- var/spack/repos/builtin/packages/tk/package.py | 9 +- var/spack/repos/builtin/packages/xz/package.py | 4 + 15 files changed, 336 insertions(+), 88 deletions(-) create mode 100644 var/spack/repos/builtin/packages/cdecimal/darwin_install_name.patch create mode 100644 var/spack/repos/builtin/packages/cdecimal/package.py create mode 100644 var/spack/repos/builtin/packages/libnsl/package.py create mode 100644 var/spack/repos/builtin/packages/libtirpc/package.py create mode 100644 var/spack/repos/builtin/packages/mpdecimal/package.py delete mode 100644 var/spack/repos/builtin/packages/python/ncurses.patch create mode 100644 var/spack/repos/builtin/packages/python/tkinter.patch create mode 100644 var/spack/repos/builtin/packages/rpcsvc-proto/package.py diff --git a/var/spack/repos/builtin/packages/cdecimal/darwin_install_name.patch b/var/spack/repos/builtin/packages/cdecimal/darwin_install_name.patch new file mode 100644 index 0000000000..c49ef765bf --- /dev/null +++ b/var/spack/repos/builtin/packages/cdecimal/darwin_install_name.patch @@ -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: diff --git a/var/spack/repos/builtin/packages/cdecimal/package.py b/var/spack/repos/builtin/packages/cdecimal/package.py new file mode 100644 index 0000000000..38abf47476 --- /dev/null +++ b/var/spack/repos/builtin/packages/cdecimal/package.py @@ -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') diff --git a/var/spack/repos/builtin/packages/libbsd/package.py b/var/spack/repos/builtin/packages/libbsd/package.py index d0fc9d64e7..987d90043e 100644 --- a/var/spack/repos/builtin/packages/libbsd/package.py +++ b/var/spack/repos/builtin/packages/libbsd/package.py @@ -22,3 +22,6 @@ class Libbsd(AutotoolsPackage): version('0.8.6', sha256='467fbf9df1f49af11f7f686691057c8c0a7613ae5a870577bef9155de39f9687') patch('cdefs.h.patch', when='@0.8.6 %gcc@:4') + + # https://gitlab.freedesktop.org/libbsd/libbsd/issues/1 + conflicts('platform=darwin') diff --git a/var/spack/repos/builtin/packages/libnsl/package.py b/var/spack/repos/builtin/packages/libnsl/package.py new file mode 100644 index 0000000000..1a1f9ab837 --- /dev/null +++ b/var/spack/repos/builtin/packages/libnsl/package.py @@ -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') diff --git a/var/spack/repos/builtin/packages/libtirpc/package.py b/var/spack/repos/builtin/packages/libtirpc/package.py new file mode 100644 index 0000000000..eb56c34627 --- /dev/null +++ b/var/spack/repos/builtin/packages/libtirpc/package.py @@ -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'] diff --git a/var/spack/repos/builtin/packages/libxdmcp/package.py b/var/spack/repos/builtin/packages/libxdmcp/package.py index cb527c6122..fe1bdfa8d7 100644 --- a/var/spack/repos/builtin/packages/libxdmcp/package.py +++ b/var/spack/repos/builtin/packages/libxdmcp/package.py @@ -17,4 +17,5 @@ class Libxdmcp(AutotoolsPackage): depends_on('xproto', type='build') depends_on('pkgconfig', type='build') depends_on('util-macros', type='build') - depends_on('libbsd') + depends_on('libbsd', when='platform=linux') + depends_on('libbsd', when='platform=cray') diff --git a/var/spack/repos/builtin/packages/mpdecimal/package.py b/var/spack/repos/builtin/packages/mpdecimal/package.py new file mode 100644 index 0000000000..3353041931 --- /dev/null +++ b/var/spack/repos/builtin/packages/mpdecimal/package.py @@ -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')) diff --git a/var/spack/repos/builtin/packages/py-pymol/package.py b/var/spack/repos/builtin/packages/py-pymol/package.py index 62fb54e27d..ca88919a48 100644 --- a/var/spack/repos/builtin/packages/py-pymol/package.py +++ b/var/spack/repos/builtin/packages/py-pymol/package.py @@ -17,7 +17,7 @@ class PyPymol(PythonPackage): version('2.1.0', 'ef2ab2ce11d65785ca3258b4e6982dfb') - depends_on('python+tk', type=('build', 'run')) + depends_on('python+tkinter', type=('build', 'run')) depends_on('tcl') depends_on('tk') depends_on('py-pmw') diff --git a/var/spack/repos/builtin/packages/python/ncurses.patch b/var/spack/repos/builtin/packages/python/ncurses.patch deleted file mode 100644 index 9054c03e7b..0000000000 --- a/var/spack/repos/builtin/packages/python/ncurses.patch +++ /dev/null @@ -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'): diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py index 898d1d4424..30f2c2571e 100644 --- a/var/spack/repos/builtin/packages/python/package.py +++ b/var/spack/repos/builtin/packages/python/package.py @@ -24,8 +24,8 @@ from spack import * class Python(AutotoolsPackage): """The Python programming language.""" - homepage = "http://www.python.org" - url = "http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz" + homepage = "https://www.python.org/" + url = "https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz" list_url = "https://www.python.org/downloads/" list_depth = 1 @@ -63,9 +63,6 @@ class Python(AutotoolsPackage): # See http://bugs.python.org/issue29846 variant('shared', default=sys.platform != 'darwin', 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 # 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 @@ -73,10 +70,10 @@ class Python(AutotoolsPackage): # 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 # compatible. + variant('ucs4', default=False, + description='Enable UCS4 (wide) unicode strings') variant('pic', default=True, description='Produce position-independent code (for shared libs)') - - variant('dbm', default=True, description='Provide support for dbm') variant( 'optimizations', default=False, @@ -87,31 +84,49 @@ class Python(AutotoolsPackage): description="Symlink 'python3' executable to 'python' " "(not PEP 394 compliant)") - depends_on("pkgconfig", type="build") - depends_on("openssl") - depends_on("bzip2") - depends_on("readline") - depends_on("ncurses") - depends_on("sqlite") - depends_on("zlib") - depends_on("tk", when="+tk") - depends_on("tcl", when="+tk") - depends_on("gdbm", when='+dbm') - - # https://docs.python.org/3/whatsnew/3.7.html#build-changes - depends_on("libffi", when="@3.7:") - depends_on("openssl@1.0.2:", when="@3.7:") - - # Patch does not work for Python 3.1 - patch('ncurses.patch', when='@:2.8,3.2:') + # Optional Python modules + variant('readline', default=True, description='Build readline module') + variant('ssl', default=True, description='Build ssl module') + variant('sqlite3', default=True, description='Build sqlite3 module') + variant('dbm', default=True, description='Build dbm module') + variant('nis', default=False, description='Build nis module') + variant('zlib', default=True, description='Build zlib module') + variant('bz2', default=True, description='Build bz2 module') + variant('lzma', default=True, description='Build lzma module') + 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') + + depends_on('pkgconfig@0.9.0:', type='build') + + # Optional dependencies + # 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: - 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-2.3.patch', when='@2.3:3.0.1 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 # 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: # https://bugs.python.org/issue29712 @@ -156,37 +171,33 @@ class Python(AutotoolsPackage): def configure_args(self): spec = self.spec + config_args = [] # setup.py needs to be able to read the CPPFLAGS and LDFLAGS # as it scans for the library and headers to build link_deps = spec.dependencies('link') - # Header files are often included assuming they reside in a - # subdirectory of prefix.include, e.g. #include , - # which is why we don't use HeaderList here. The header files of - # libffi reside in prefix.lib but the configure script of Python - # finds them using pkg-config. - cppflags = '-I' + ' -I'.join(dep.prefix.include - for dep in link_deps - if dep.name != 'libffi') + if link_deps: + # Header files are often included assuming they reside in a + # subdirectory of prefix.include, e.g. #include , + # which is why we don't use HeaderList here. The header files of + # libffi reside in prefix.lib but the configure script of Python + # finds them using pkg-config. + cppflags = ' '.join('-I' + spec[dep.name].prefix.include + for dep in link_deps) - # Currently, the only way to get SpecBuildInterface wrappers of the - # dependencies (which we need to get their 'libs') is to get them - # using spec.__getitem__. - ldflags = ' '.join(spec[dep.name].libs.search_flags - for dep in link_deps) + # Currently, the only way to get SpecBuildInterface wrappers of the + # dependencies (which we need to get their 'libs') is to get them + # using spec.__getitem__. + ldflags = ' '.join(spec[dep.name].libs.search_flags + 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 if spec.satisfies('@:3.6'): 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) \ and '+optimizations' in spec: config_args.append('--enable-optimizations') @@ -209,7 +220,7 @@ class Python(AutotoolsPackage): elif spec.satisfies('@3.0:3.2'): config_args.append('--with-wide-unicode') 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( '+ucs4 variant not compatible with Python 3.3 and beyond') @@ -219,6 +230,35 @@ class Python(AutotoolsPackage): if '+pic' in spec: 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 @run_after('install') @@ -260,26 +300,75 @@ class Python(AutotoolsPackage): os.symlink(os.path.join(prefix.bin, 'python3-config'), os.path.join(prefix.bin, 'python-config')) - # TODO: Once better testing support is integrated, add the following tests - # https://wiki.python.org/moin/TkInter - # - # Note: Only works if ForwardX11Trusted is enabled, i.e. `ssh -Y` - # - # if '+tk' in spec: - # env['TK_LIBRARY'] = join_path(spec['tk'].prefix.lib, - # 'tk{0}'.format(spec['tk'].version.up_to(2))) - # env['TCL_LIBRARY'] = join_path(spec['tcl'].prefix.lib, - # 'tcl{0}'.format(spec['tcl'].version.up_to(2))) - # - # $ python - # >>> import _tkinter - # - # if spec.satisfies('@3:') - # >>> import tkinter - # >>> tkinter._test() - # else: - # >>> import Tkinter - # >>> Tkinter._test() + @run_after('install') + @on_package_attributes(run_tests=True) + def import_tests(self): + """Test that basic Python functionality works.""" + + spec = self.spec + + with working_dir('spack-test', create=True): + # Ensure that readline module works + if '+readline' in spec: + self.command('-c', 'import readline') + + # Ensure that ssl module works + if '+ssl' in spec: + self.command('-c', 'import ssl') + self.command('-c', 'import hashlib') + + # Ensure that sqlite3 module works + if '+sqlite3' in spec: + 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): """ diff --git a/var/spack/repos/builtin/packages/python/tkinter.patch b/var/spack/repos/builtin/packages/python/tkinter.patch new file mode 100644 index 0000000000..87e1901807 --- /dev/null +++ b/var/spack/repos/builtin/packages/python/tkinter.patch @@ -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. diff --git a/var/spack/repos/builtin/packages/rpcsvc-proto/package.py b/var/spack/repos/builtin/packages/rpcsvc-proto/package.py new file mode 100644 index 0000000000..44d2be710a --- /dev/null +++ b/var/spack/repos/builtin/packages/rpcsvc-proto/package.py @@ -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'] diff --git a/var/spack/repos/builtin/packages/tcl/package.py b/var/spack/repos/builtin/packages/tcl/package.py index 117dadaeef..d5bd686743 100644 --- a/var/spack/repos/builtin/packages/tcl/package.py +++ b/var/spack/repos/builtin/packages/tcl/package.py @@ -33,11 +33,6 @@ class Tcl(AutotoolsPackage): 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): with working_dir(self.build_directory): make('install') @@ -77,7 +72,8 @@ class Tcl(AutotoolsPackage): @property def libs(self): - return LibraryList([]) + return find_libraries(['libtcl{0}'.format(self.version.up_to(2))], + root=self.prefix, recursive=True) @property def command(self): @@ -101,11 +97,18 @@ class Tcl(AutotoolsPackage): return join_path(self.tcl_lib_dir, '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): """Set TCLLIBPATH to include the tcl-shipped directory for extensions and any other tcl extension it depends on. 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 # tcl is found in the build environment. This to prevent cases # where a system provided tcl is run against the standard libraries diff --git a/var/spack/repos/builtin/packages/tk/package.py b/var/spack/repos/builtin/packages/tk/package.py index a675de5b73..3ab1180e84 100644 --- a/var/spack/repos/builtin/packages/tk/package.py +++ b/var/spack/repos/builtin/packages/tk/package.py @@ -30,14 +30,19 @@ class Tk(AutotoolsPackage): @property 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): - # 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. run_env.set('TK_LIBRARY', join_path(self.prefix.lib, 'tk{0}'.format( 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): spec = self.spec return ['--with-tcl={0}'.format(spec['tcl'].prefix.lib)] diff --git a/var/spack/repos/builtin/packages/xz/package.py b/var/spack/repos/builtin/packages/xz/package.py index 86d1329e16..c7f53e840b 100644 --- a/var/spack/repos/builtin/packages/xz/package.py +++ b/var/spack/repos/builtin/packages/xz/package.py @@ -20,3 +20,7 @@ class Xz(AutotoolsPackage): version('5.2.3', '1592e7ca3eece099b03b35f4d9179e7c') version('5.2.2', 'f90c9a0c8b259aee2234c4e0d7fd70af') version('5.2.0', '867cc8611760240ebf3440bd6e170bb9') + + @property + def libs(self): + return find_libraries(['liblzma'], root=self.prefix, recursive=True) -- cgit v1.2.3-70-g09d2