From 90bb855ffa2d39d4cd861dd65f51acfa72d11ea4 Mon Sep 17 00:00:00 2001 From: Elizabeth F Date: Fri, 11 Mar 2016 23:30:38 -0500 Subject: A new subclass StagedPackage(Package) is introduced. This PR should not change the behavior for existing packages that subclass from spack.Package. If a package subclasses spack.StagedPackage instead of spack.Package, the install() phase (run inside a forked process) is now separated into sub-stages: a) spconfig: Generate a script spconfig.py that will configure the package (eg by running CMake or ./configure) This is for use if the user wishes to build externally from Spack. Therefore, the Spack compiler wrappers are NOT used here. Currently, that means that RPATH support is up to the user. b) configure: Configure the project (eg: runs configure, CMake, etc). This will configure it for use within Spack, using the Spack wrapper. c) build: eg: "make" d) install: eg: "install" If one chooses to use StagedPackage instead of Package, then one must implement each of the install sub-stages as a separate method. StagedPackage.install() then calls each of the sub-stages as appropriate. StagedPackage can be configured to only run certain sub-stages. This is done by setting the optional kwarg install_phases when calling do_install(). Setting install_phases() ONLY has an effect on StagedPackage, not on any existing packages. By default, install_phases is set to make StagedPackage run the same stages that are normally run for any package: configure, build, install (and NOT spconfig). The ability for Spack to run stages selectively for StagedPackage instances will enable new functionality. For example, explicit CMake/Autotools helpers that allow Spack to help configure a user's project without fetching, building or installing it. ------------- One implementation of StagedPackage is provided, CMakePackage. This has the following advantage for CMake-based projects over using the standard Package class: a) By separating out the phases, it enables future new functionality for packages that use it. b) It provides an implementation of intall_spconfig(), which will help users configure their CMake-based projects. CMakePackage expects users to implement configure_args() and configure_env(). These methods provide the package-specific arguments and environment needed to properly configure the package. They are placed in separated functions because they are used in both the spconfig and configure stages. TODO: 1. Generate spconfig.py scripts that are more readable. This allows the users to understand how their project is configured. 2. Provide a practical way for the user to ACCESS the spconfig stage without building the project through Spack. 3. The CMAKE_TRANSITIVE_INCLUDE_PATH stuff needs to be reworked; it should be considered provisional for now. 4. User of Autotools might wish to make a similar ConfigurePackage subclass of StagedPackage. --------------- One package using CMakePackage is introduced. See ibmisc/package.py. --- var/spack/repos/builtin/packages/ibmisc/package.py | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 var/spack/repos/builtin/packages/ibmisc/package.py (limited to 'var') diff --git a/var/spack/repos/builtin/packages/ibmisc/package.py b/var/spack/repos/builtin/packages/ibmisc/package.py new file mode 100644 index 0000000000..9fadee7239 --- /dev/null +++ b/var/spack/repos/builtin/packages/ibmisc/package.py @@ -0,0 +1,47 @@ +from spack import * + +class Ibmisc(CMakePackage): + """Misc. reusable utilities used by IceBin.""" + + homepage = "https://github.com/citibeth/ibmisc" + url = "https://github.com/citibeth/ibmisc/tarball/123" + + version('0.1.0', '12f2a32432a11db48e00217df18e59fa') + + variant('everytrace', default=False, description='Report errors through Everytrace') + variant('proj', default=True, description='Compile utilities for PROJ.4 library') + variant('blitz', default=True, description='Compile utilities for Blitz library') + variant('netcdf', default=True, description='Compile utilities for NetCDF library') + variant('boost', default=True, description='Compile utilities for Boost library') + variant('udunits2', default=True, description='Compile utilities for UDUNITS2 library') + variant('googletest', default=True, description='Compile utilities for Google Test library') + variant('python', default=True, description='Compile utilities for use with Python/Cython') + + extends('python') + + depends_on('eigen') + depends_on('everytrace', when='+everytrace') + depends_on('proj', when='+proj') + depends_on('blitz', when='+blitz') + depends_on('netcdf-cxx4', when='+netcdf') + depends_on('udunits2', when='+udunits2') + depends_on('googletest', when='+googletest') + depends_on('py-cython', when='+python') + depends_on('py-numpy', when='+python') + depends_on('boost', when='+boost') + + # Build dependencies + depends_on('cmake') + depends_on('doxygen') + + def configure_args(self): + spec = self.spec + return [ + '-DUSE_EVERYTRACE=%s' % ('YES' if '+everytrace' in spec else 'NO'), + '-DUSE_PROJ4=%s' % ('YES' if '+proj' in spec else 'NO'), + '-DUSE_BLITZ=%s' % ('YES' if '+blitz' in spec else 'NO'), + '-DUSE_NETCDF=%s' % ('YES' if '+netcdf' in spec else 'NO'), + '-DUSE_BOOST=%s' % ('YES' if '+boost' in spec else 'NO'), + '-DUSE_UDUNITS2=%s' % ('YES' if '+udunits2' in spec else 'NO'), + '-DUSE_GTEST=%s' % ('YES' if '+googletest' in spec else 'NO')] + -- cgit v1.2.3-70-g09d2 From c1a8574d8f67d6b4fdce109ecf4dd3a1cbe18488 Mon Sep 17 00:00:00 2001 From: Elizabeth F Date: Sun, 13 Mar 2016 00:29:40 -0500 Subject: Fixed for Python 2.6 --- lib/spack/spack/package.py | 2 +- var/spack/repos/builtin/packages/ibmisc/package.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'var') diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 3d8e098346..f815628bba 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -831,7 +831,7 @@ class Package(object): def do_install(self, keep_prefix=False, keep_stage=False, ignore_deps=False, skip_patch=False, verbose=False, make_jobs=None, fake=False, - install_phases = {'configure', 'build', 'install', 'provenance'}): + install_phases = set(['configure', 'build', 'install', 'provenance'])): """Called by commands to install a package and its dependencies. Package implementations should override install() to describe diff --git a/var/spack/repos/builtin/packages/ibmisc/package.py b/var/spack/repos/builtin/packages/ibmisc/package.py index 9fadee7239..a3bd680655 100644 --- a/var/spack/repos/builtin/packages/ibmisc/package.py +++ b/var/spack/repos/builtin/packages/ibmisc/package.py @@ -1,4 +1,5 @@ from spack import * +import llnl.util.tty as tty class Ibmisc(CMakePackage): """Misc. reusable utilities used by IceBin.""" @@ -15,7 +16,7 @@ class Ibmisc(CMakePackage): variant('boost', default=True, description='Compile utilities for Boost library') variant('udunits2', default=True, description='Compile utilities for UDUNITS2 library') variant('googletest', default=True, description='Compile utilities for Google Test library') - variant('python', default=True, description='Compile utilities for use with Python/Cython') + variant('python', default=True, description='Compile utilities fro use with Python/Cython') extends('python') @@ -26,16 +27,18 @@ class Ibmisc(CMakePackage): depends_on('netcdf-cxx4', when='+netcdf') depends_on('udunits2', when='+udunits2') depends_on('googletest', when='+googletest') +# depends_on('python', when='+python') depends_on('py-cython', when='+python') depends_on('py-numpy', when='+python') depends_on('boost', when='+boost') + + # Build dependencies depends_on('cmake') depends_on('doxygen') - def configure_args(self): - spec = self.spec + def config_args(self, spec, prefix): return [ '-DUSE_EVERYTRACE=%s' % ('YES' if '+everytrace' in spec else 'NO'), '-DUSE_PROJ4=%s' % ('YES' if '+proj' in spec else 'NO'), -- cgit v1.2.3-70-g09d2 From 003957a689b8d3d6e6da5408d61c45e73e01b575 Mon Sep 17 00:00:00 2001 From: citibeth Date: Sun, 13 Mar 2016 00:33:13 -0500 Subject: Reverted bad change --- var/spack/repos/builtin/packages/ibmisc/package.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/ibmisc/package.py b/var/spack/repos/builtin/packages/ibmisc/package.py index a3bd680655..8e6cf429a7 100644 --- a/var/spack/repos/builtin/packages/ibmisc/package.py +++ b/var/spack/repos/builtin/packages/ibmisc/package.py @@ -1,5 +1,4 @@ from spack import * -import llnl.util.tty as tty class Ibmisc(CMakePackage): """Misc. reusable utilities used by IceBin.""" @@ -16,7 +15,7 @@ class Ibmisc(CMakePackage): variant('boost', default=True, description='Compile utilities for Boost library') variant('udunits2', default=True, description='Compile utilities for UDUNITS2 library') variant('googletest', default=True, description='Compile utilities for Google Test library') - variant('python', default=True, description='Compile utilities fro use with Python/Cython') + variant('python', default=True, description='Compile utilities for use with Python/Cython') extends('python') @@ -27,18 +26,16 @@ class Ibmisc(CMakePackage): depends_on('netcdf-cxx4', when='+netcdf') depends_on('udunits2', when='+udunits2') depends_on('googletest', when='+googletest') -# depends_on('python', when='+python') depends_on('py-cython', when='+python') depends_on('py-numpy', when='+python') depends_on('boost', when='+boost') - - # Build dependencies depends_on('cmake') depends_on('doxygen') - def config_args(self, spec, prefix): + def configure_args(self): + spec = self.spec return [ '-DUSE_EVERYTRACE=%s' % ('YES' if '+everytrace' in spec else 'NO'), '-DUSE_PROJ4=%s' % ('YES' if '+proj' in spec else 'NO'), @@ -47,4 +44,3 @@ class Ibmisc(CMakePackage): '-DUSE_BOOST=%s' % ('YES' if '+boost' in spec else 'NO'), '-DUSE_UDUNITS2=%s' % ('YES' if '+udunits2' in spec else 'NO'), '-DUSE_GTEST=%s' % ('YES' if '+googletest' in spec else 'NO')] - -- cgit v1.2.3-70-g09d2