Repository: spack/spack

Issue:
fenics doesn't install on Ubuntu 16
Would love to get this working but I keep getting the following super ambiguous error

[repos]$ spack install fenics @2016.2.0
==> Error: 'doc'
[repos]$ spack install fenics @2016.1.0
==> Error: 'doc'
[repos]$ spack install fenics @2017.1.0
==> Error: 'doc'
[repos]$ spack install fenics @1.6.0
==> Error: 'doc'
[repos]$ spack install fenics
==> Error: 'doc'




Discussion:
Can reproduce. I know what the problem is. I'll submit a PR shortly.
Wow, that was the fastest developer response I've ever received. Thank you! 

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/fenics/package.py b/var/spack/repos/builtin/packages/fenics/package.py
--- a/var/spack/repos/builtin/packages/fenics/package.py
+++ b/var/spack/repos/builtin/packages/fenics/package.py
@@ -25,7 +25,7 @@
 from spack import *
 
 
-class Fenics(Package):
+class Fenics(CMakePackage):
     """FEniCS is organized as a collection of interoperable components
     that together form the FEniCS Project. These components include
     the problem-solving environment DOLFIN, the form compiler FFC, the
@@ -35,9 +35,10 @@ class Fenics(Package):
 
     homepage = "http://fenicsproject.org/"
     url      = "https://bitbucket.org/fenics-project/dolfin/downloads/dolfin-1.6.0.tar.gz"
-
     base_url = "https://bitbucket.org/fenics-project/{pkg}/downloads/{pkg}-{version}.tar.gz"
 
+    python_components = ['ufl', 'ffc', 'fiat', 'instant']
+
     variant('hdf5',         default=True,  description='Compile with HDF5')
     variant('parmetis',     default=True,  description='Compile with ParMETIS')
     variant('scotch',       default=True,  description='Compile with Scotch')
@@ -56,6 +57,8 @@ class Fenics(Package):
             description='Enables the build of shared libraries')
     variant('debug',        default=False,
             description='Builds a debug version of the libraries')
+    variant('doc',          default=False,
+            description='Builds the documentation')
 
     # not part of spack list for now
     # variant('petsc4py',     default=True,  description='Uses PETSc4py')
@@ -68,7 +71,7 @@ class Fenics(Package):
 
     extends('python')
 
-    depends_on('eigen@3.2.0:', type='build')
+    depends_on('eigen@3.2.0:')
     depends_on('boost+filesystem+program_options+system+iostreams+timer+regex+chrono')
 
     depends_on('mpi', when='+mpi')
@@ -88,7 +91,7 @@ class Fenics(Package):
     depends_on('py-numpy', type=('build', 'run'))
     depends_on('py-sympy', type=('build', 'run'))
     depends_on('swig@3.0.3:', type=('build', 'run'))
-    depends_on('cmake@2.8.12:', type=('build', 'run'))
+    depends_on('cmake@2.8.12:', type='build')
 
     depends_on('py-setuptools', type='build')
     depends_on('py-sphinx@1.0.1:', when='+doc', type='build')
@@ -140,14 +143,14 @@ class Fenics(Package):
     def cmake_is_on(self, option):
         return 'ON' if option in self.spec else 'OFF'
 
-    def install(self, spec, prefix):
-        for package in ['ufl', 'ffc', 'fiat', 'instant']:
-            with working_dir(join_path('depends', package)):
-                setup_py('install', '--prefix=%s' % prefix)
+    def cmake_args(self):
+        spec = self.spec
 
-        cmake_args = [
+        return [
             '-DCMAKE_BUILD_TYPE:STRING={0}'.format(
                 'Debug' if '+debug' in spec else 'RelWithDebInfo'),
+            '-DDOLFIN_ENABLE_DOCS:BOOL={0}'.format(
+                self.cmake_is_on('+doc')),
             '-DBUILD_SHARED_LIBS:BOOL={0}'.format(
                 self.cmake_is_on('+shared')),
             '-DDOLFIN_SKIP_BUILD_TESTS:BOOL=ON',
@@ -189,10 +192,14 @@ def install(self, spec, prefix):
                 self.cmake_is_on('zlib')),
         ]
 
-        cmake_args.extend(std_cmake_args)
-
-        with working_dir('build', create=True):
-            cmake('..', *cmake_args)
+    @run_after('build')
+    def build_python_components(self):
+        for package in self.python_components:
+            with working_dir(join_path('depends', package)):
+                setup_py('build')
 
-            make()
-            make('install')
+    @run_after('install')
+    def install_python_components(self):
+        for package in self.python_components:
+            with working_dir(join_path('depends', package)):
+                setup_py('install', '--prefix={0}'.format(self.prefix))


Test patch: