Repository: spack/spack

Issue:
`spack setup`: fails with AttributeError
I am currently trying the command to see what needs to be modified in #1186. Filing issues as I see them (on `LLNL/develop`) : 

```
$ pwd
/home/mculpo/tmp/spack/ibmisc-0.1.0

$ ls
add_license.py  cmake  CMakeLists.txt  CMakeLists.txt.with_find  configme  ibmisc-devel-GCC-4.9.3.eb  LICENSE  pylib  README.md  slib  spack-build.env  spack-build.out  tests

$ spack setup ibmisc~netcdf~proj~udunits2~boost~python~googletest~blitz@0.1.0
==> Installing ibmisc
==> python is already installed in /home/mculpo/github/spack-llnl/opt/spack/linux-Ubuntu14-x86_64/gcc-4.8/python-2.7.11-cali4n6cc275duixxwoqvme7ciyzdv7l
==> doxygen is already installed in /home/mculpo/github/spack-llnl/opt/spack/linux-Ubuntu14-x86_64/gcc-4.8/doxygen-1.8.11-bodgnq4vvqmyzr4ejuy2o5uoupnkxgm7
==> cmake is already installed in /home/mculpo/github/spack-llnl/opt/spack/linux-Ubuntu14-x86_64/gcc-4.8/cmake-3.5.2-cjy7dyxzysrart3a3odcw6rzkpjzqkao
==> eigen is already installed in /home/mculpo/github/spack-llnl/opt/spack/linux-Ubuntu14-x86_64/gcc-4.8/eigen-3.2.7-tcbg3t5jbnqyll7qzpf2nlqajhqfdtfy
==> No need to fetch for DIY.
==> Sources for DIY stages are not cached
==> Using source directory: /home/mculpo/tmp/spack/ibmisc-0.1.0
==> No patches needed for ibmisc
==> Building ibmisc
Traceback (most recent call last):
  File "/home/mculpo/github/spack-llnl/lib/spack/spack/build_environment.py", line 513, in fork
    function()
  File "/home/mculpo/github/spack-llnl/lib/spack/spack/package.py", line 989, in build_process
    self.install(self.spec, self.prefix)
  File "/home/mculpo/github/spack-llnl/lib/spack/spack/package.py", line 1553, in install
    self.install_setup()
  File "/home/mculpo/github/spack-llnl/lib/spack/spack/package.py", line 1611, in install_setup
    '-DCMAKE_Fortran_COMPILER=%s' % os.environ['SPACK_FC']] + \
AttributeError: 'module' object has no attribute 'get_std_cmake_args'
==> Warning: Keeping install prefix in place despite error.
  Spack will think this package is installed. Manually remove this directory to fix:
  /home/mculpo/github/spack-llnl/opt/spack/linux-Ubuntu14-x86_64/gcc-4.8/ibmisc-0.1.0-4s5ct3qk7h2llgp47lncsr2c4k6iqwe2
==> Error: Installation process had nonzero exit code : 256
```



Discussion:

Resolving patch:
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -350,15 +350,7 @@ def set_module_variables_for_package(pkg, module):
     m.ctest = Executable('ctest')
 
     # standard CMake arguments
-    m.std_cmake_args = ['-DCMAKE_INSTALL_PREFIX=%s' % pkg.prefix,
-                        '-DCMAKE_BUILD_TYPE=RelWithDebInfo']
-    if platform.mac_ver()[0]:
-        m.std_cmake_args.append('-DCMAKE_FIND_FRAMEWORK=LAST')
-
-    # Set up CMake rpath
-    m.std_cmake_args.append('-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=FALSE')
-    m.std_cmake_args.append('-DCMAKE_INSTALL_RPATH=%s' %
-                            ":".join(get_rpaths(pkg)))
+    m.std_cmake_args = get_std_cmake_args(pkg)
 
     # Put spack compiler paths in module scope.
     link_dir = spack.build_env_path
@@ -410,6 +402,20 @@ def get_rpaths(pkg):
     return rpaths
 
 
+def get_std_cmake_args(cmake_pkg):
+    # standard CMake arguments
+    ret = ['-DCMAKE_INSTALL_PREFIX=%s' % cmake_pkg.prefix,
+           '-DCMAKE_BUILD_TYPE=RelWithDebInfo']
+    if platform.mac_ver()[0]:
+        ret.append('-DCMAKE_FIND_FRAMEWORK=LAST')
+
+    # Set up CMake rpath
+    ret.append('-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=FALSE')
+    ret.append('-DCMAKE_INSTALL_RPATH=%s' % ":".join(get_rpaths(cmake_pkg)))
+
+    return ret
+
+
 def parent_class_modules(cls):
     """
     Get list of super class modules that are all descend from spack.Package


Test patch: