diff --git a/lib/spack/docs/basic_usage.rst b/lib/spack/docs/basic_usage.rst index 7ec61334db1..f25247579b1 100644 --- a/lib/spack/docs/basic_usage.rst +++ b/lib/spack/docs/basic_usage.rst @@ -647,8 +647,8 @@ avoid ambiguity. When spack normalizes specs, it prints them out with no spaces boolean variants using the backwards compatibility syntax and uses only ``~`` -for disabled boolean variants. We allow ``-`` and spaces on the command -line is provided for convenience and legibility. +for disabled boolean variants. The ``-`` and spaces on the command +line are provided for convenience and legibility. ^^^^^^^^^^^^^^ Compiler Flags @@ -658,14 +658,17 @@ Compiler flags are specified using the same syntax as non-boolean variants, but fulfill a different purpose. While the function of a variant is set by the package, compiler flags are used by the compiler wrappers to inject flags into the compile line of the build. Additionally, compiler flags are -inherited by dependencies. ``spack install libdwarf cppflags=\"-g\"`` will +inherited by dependencies. ``spack install libdwarf cppflags="-g"`` will install both libdwarf and libelf with the ``-g`` flag injected into their compile line. -Notice that the value of the compiler flags must be escape quoted on the -command line. From within python files, the same spec would be specified -``libdwarf cppflags="-g"``. This is necessary because of how the shell -handles the quote symbols. +Notice that the value of the compiler flags must be quoted if it +contains any spaces. Any of ``cppflags=-O3``, ``cppflags="-O3"``, +``cppflags='-O3'``, and ``cppflags="-O3 -fPIC"`` are acceptable, but +``cppflags=-O3 -fPIC`` is not. Additionally, if they value of the +compiler flags is not the last thing on the line, it must be followed +by a space. The commmand ``spack install libelf cppflags="-O3"%intel`` +will be interpreted as an attempt to set `cppflags="-O3%intel"``. The six compiler flags are injected in the order of implicit make commands in GNU Autotools. If all flags are set, the order is diff --git a/lib/spack/docs/features.rst b/lib/spack/docs/features.rst index 2df1d182d6d..8d7c1ec0cdf 100644 --- a/lib/spack/docs/features.rst +++ b/lib/spack/docs/features.rst @@ -41,7 +41,7 @@ platform, all on the command line. $ spack install mpileaks@1.1.2 %gcc@4.7.3 +debug # Add compiler flags using the conventional names - $ spack install mpileaks@1.1.2 %gcc@4.7.3 cppflags=\"-O3 -floop-block\" + $ spack install mpileaks@1.1.2 %gcc@4.7.3 cppflags="-O3 -floop-block" # Cross-compile for a different architecture with arch= $ spack install mpileaks@1.1.2 arch=bgqos_0 diff --git a/lib/spack/docs/getting_started.rst b/lib/spack/docs/getting_started.rst index 8e5ee7f3790..efc1965ce97 100644 --- a/lib/spack/docs/getting_started.rst +++ b/lib/spack/docs/getting_started.rst @@ -632,7 +632,7 @@ the command line: .. code-block:: console - $ spack install openmpi fflags=\"-mismatch\" + $ spack install openmpi fflags="-mismatch" Or it can be set permanently in your ``compilers.yaml``: diff --git a/lib/spack/docs/tutorial_sc16_spack_basics.rst b/lib/spack/docs/tutorial_sc16_spack_basics.rst index 532410058dd..9511907cebb 100644 --- a/lib/spack/docs/tutorial_sc16_spack_basics.rst +++ b/lib/spack/docs/tutorial_sc16_spack_basics.rst @@ -184,15 +184,15 @@ compilers. [+] ~/spack/opt/spack/linux-redhat6-x86_64/intel-15.0.4/libelf-0.8.13-w33hrejdyqu2j2gggdswitls2zv6kdsi -The spec syntax also includes compiler flags. Spack accepts ``cppflags``, -``cflags``, ``cxxflags``, ``fflags``, ``ldflags``, and ``ldlibs`` -parameters. The values of these fields must be escape-quoted with ``\"`` -on the command line. These values are injected into the compile line -automatically by the Spack compiler wrappers. +The spec syntax also includes compiler flags. Spack accepts +``cppflags``, ``cflags``, ``cxxflags``, ``fflags``, ``ldflags``, and +``ldlibs`` parameters. The values of these fields must be quoted on +the command line if they include spaces. These values are injected +into the compile line automatically by the Spack compiler wrappers. .. code-block:: console - $ spack install libelf @0.8.12 cppflags=\"-O3\" + $ spack install libelf @0.8.12 cppflags="-O3" ==> Installing libelf ==> Trying to fetch from ~/spack/var/spack/cache/libelf/libelf-0.8.12.tar.gz ################################################################################################################################################################################# 100.0% @@ -309,7 +309,7 @@ top-level package, we can also specify about a dependency using ``^``. Packages can also be referred to from the command line by their package hash. Using the ``spack find -lf`` command earlier we saw that the hash -of our optimized installation of libelf (``cppflags=\"-O3\"``) began with +of our optimized installation of libelf (``cppflags="-O3"``) began with ``vrv2ttb``. We can now explicitly build with that package without typing the entire spec, by using the ``/`` sigil to refer to it by hash. As with other tools like git, you do not need to specify an *entire* hash on the @@ -1103,8 +1103,8 @@ already covered in the :ref:`basics-tutorial-install` and The ``spack find`` command can accept what we call "anonymous specs." These are expressions in spec syntax that do not contain a package name. For example, `spack find %intel` will return every package built -with the intel compiler, and ``spack find cppflags=\\"-O3\\"`` will -return every package which was built with ``cppflags=\\"-O3\\"``. +with the intel compiler, and ``spack find cppflags="-O3"`` will +return every package which was built with ``cppflags="-O3"``. .. code-block:: console @@ -1115,7 +1115,7 @@ return every package which was built with ``cppflags=\\"-O3\\"``. - $ spack find cppflags=\"-O3\" + $ spack find cppflags="-O3" ==> 1 installed packages. -- linux-redhat6-x86_64 / gcc@4.4.7 ----------------------------- libelf@0.8.12 diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 67b00c67494..3e6dc12b35a 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -432,19 +432,15 @@ 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', - '-DCMAKE_VERBOSE_MAKEFILE=ON'] - if platform.mac_ver()[0]: - ret.append('-DCMAKE_FIND_FRAMEWORK=LAST') +def get_std_cmake_args(pkg): + """Returns the list of standard arguments that would be used if this + package was a CMakePackage instance. - # Set up CMake rpath - ret.append('-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=FALSE') - ret.append('-DCMAKE_INSTALL_RPATH=%s' % ":".join(get_rpaths(cmake_pkg))) + :param pkg: pkg under consideration - return ret + :return: list of arguments for cmake + """ + return spack.CMakePackage._std_args(pkg) def parent_class_modules(cls): @@ -553,6 +549,11 @@ def child_execution(child_connection, input_stream): setup_package(pkg, dirty=dirty) function(input_stream) child_connection.send(None) + except StopIteration as e: + # StopIteration is used to stop installations + # before the final stage, mainly for debug purposes + tty.msg(e.message) + child_connection.send(None) except: # catch ANYTHING that goes wrong in the child process exc_type, exc, tb = sys.exc_info() diff --git a/lib/spack/spack/build_systems/autotools.py b/lib/spack/spack/build_systems/autotools.py index dea4ae002f0..78a4df5e117 100644 --- a/lib/spack/spack/build_systems/autotools.py +++ b/lib/spack/spack/build_systems/autotools.py @@ -31,6 +31,7 @@ from subprocess import check_call import llnl.util.tty as tty +from llnl.util.filesystem import working_dir from spack.package import PackageBase @@ -38,16 +39,17 @@ class AutotoolsPackage(PackageBase): """Specialized class for packages that are built using GNU Autotools This class provides four phases that can be overridden: - - autoreconf - - configure - - build - - install + + * autoreconf + * configure + * build + * install They all have sensible defaults and for many packages the only thing - necessary will be to override `configure_args` + necessary will be to override ``configure_args`` Additionally, you may specify make targets for build and install - phases by overriding `build_targets` and `install_targets` + phases by overriding ``build_targets`` and ``install_targets`` """ phases = ['autoreconf', 'configure', 'build', 'install'] # To be used in UI queries that require to know which @@ -124,6 +126,10 @@ def do_patch_config_guess(self): return False + def build_directory(self): + """Override to provide another place to build the package""" + return self.stage.source_path + def patch(self): """Perform any required patches.""" @@ -138,39 +144,44 @@ def autoreconf(self, spec, prefix): @PackageBase.sanity_check('autoreconf') def is_configure_or_die(self): - """Checks the presence of a `configure` file after the + """Checks the presence of a ``configure`` file after the autoreconf phase""" - if not os.path.exists('configure'): - raise RuntimeError( - 'configure script not found in {0}'.format(os.getcwd())) + with working_dir(self.build_directory()): + if not os.path.exists('configure'): + raise RuntimeError( + 'configure script not found in {0}'.format(os.getcwd())) def configure_args(self): """Method to be overridden. Should return an iterable containing - all the arguments that must be passed to configure, except --prefix + all the arguments that must be passed to configure, except ``--prefix`` """ return [] def configure(self, spec, prefix): - """Runs configure with the arguments specified in `configure_args` + """Runs configure with the arguments specified in ``configure_args`` and an appropriately set prefix """ options = ['--prefix={0}'.format(prefix)] + self.configure_args() - inspect.getmodule(self).configure(*options) + + with working_dir(self.build_directory()): + inspect.getmodule(self).configure(*options) def build(self, spec, prefix): """Make the build targets""" - inspect.getmodule(self).make(*self.build_targets) + with working_dir(self.build_directory()): + inspect.getmodule(self).make(*self.build_targets) def install(self, spec, prefix): """Make the install targets""" - inspect.getmodule(self).make(*self.install_targets) + with working_dir(self.build_directory()): + inspect.getmodule(self).make(*self.install_targets) @PackageBase.sanity_check('build') @PackageBase.on_package_attributes(run_tests=True) def _run_default_function(self): - """This function is run after build if self.run_tests == True + """This function is run after build if ``self.run_tests == True`` - It will search for a method named `check` and run it. A sensible + It will search for a method named ``check`` and run it. A sensible default is provided in the base class. """ try: @@ -181,11 +192,12 @@ def _run_default_function(self): tty.msg('Skipping default sanity checks [method `check` not implemented]') # NOQA: ignore=E501 def check(self): - """Default test : search the Makefile for targets `test` and `check` + """Default test: search the Makefile for targets ``test`` and ``check`` and run them if found. """ - self._if_make_target_execute('test') - self._if_make_target_execute('check') + with working_dir(self.build_directory()): + self._if_make_target_execute('test') + self._if_make_target_execute('check') # Check that self.prefix is there after installation PackageBase.sanity_check('install')(PackageBase.sanity_check_prefix) diff --git a/lib/spack/spack/build_systems/cmake.py b/lib/spack/spack/build_systems/cmake.py index e097f7e44f1..61d45784e8f 100644 --- a/lib/spack/spack/build_systems/cmake.py +++ b/lib/spack/spack/build_systems/cmake.py @@ -24,7 +24,6 @@ ############################################################################## import inspect -import os import platform import llnl.util.tty as tty @@ -35,21 +34,28 @@ class CMakePackage(PackageBase): - """Specialized class for packages that are built using cmake + """Specialized class for packages that are built using CMake This class provides three phases that can be overridden: - - cmake - - build - - install + + * cmake + * build + * install They all have sensible defaults and for many packages the only thing - necessary will be to override `cmake_args` + necessary will be to override ``cmake_args`` + + Additionally, you may specify make targets for build and install + phases by overriding ``build_targets`` and ``install_targets`` """ phases = ['cmake', 'build', 'install'] # To be used in UI queries that require to know which # build-system class we are using build_system_class = 'CMakePackage' + build_targets = [] + install_targets = ['install'] + depends_on('cmake', type='build') def build_type(self): @@ -97,8 +103,9 @@ def build_directory(self): def cmake_args(self): """Method to be overridden. Should return an iterable containing all the arguments that must be passed to configure, except: - - CMAKE_INSTALL_PREFIX - - CMAKE_BUILD_TYPE + + * CMAKE_INSTALL_PREFIX + * CMAKE_BUILD_TYPE """ return [] @@ -106,26 +113,25 @@ def cmake(self, spec, prefix): """Run cmake in the build directory""" options = [self.root_cmakelists_dir()] + self.std_cmake_args + \ self.cmake_args() - create = not os.path.exists(self.build_directory()) - with working_dir(self.build_directory(), create=create): + with working_dir(self.build_directory(), create=True): inspect.getmodule(self).cmake(*options) def build(self, spec, prefix): - """The usual `make` after cmake""" + """Make the build targets""" with working_dir(self.build_directory()): - inspect.getmodule(self).make() + inspect.getmodule(self).make(*self.build_targets) def install(self, spec, prefix): - """...and the final `make install` after cmake""" + """Make the install targets""" with working_dir(self.build_directory()): - inspect.getmodule(self).make('install') + inspect.getmodule(self).make(*self.install_targets) @PackageBase.sanity_check('build') @PackageBase.on_package_attributes(run_tests=True) def _run_default_function(self): - """This function is run after build if self.run_tests == True + """This function is run after build if ``self.run_tests == True`` - It will search for a method named `check` and run it. A sensible + It will search for a method named ``check`` and run it. A sensible default is provided in the base class. """ try: @@ -136,7 +142,7 @@ def _run_default_function(self): tty.msg('Skipping default build sanity checks [method `check` not implemented]') # NOQA: ignore=E501 def check(self): - """Default test : search the Makefile for the target `test` + """Default test: search the Makefile for the target ``test`` and run them if found. """ with working_dir(self.build_directory()): diff --git a/lib/spack/spack/build_systems/makefile.py b/lib/spack/spack/build_systems/makefile.py index fcc7ed2c995..a56f316109a 100644 --- a/lib/spack/spack/build_systems/makefile.py +++ b/lib/spack/spack/build_systems/makefile.py @@ -34,9 +34,10 @@ class MakefilePackage(PackageBase): """Specialized class for packages that are built using editable Makefiles This class provides three phases that can be overridden: - - edit - - build - - install + + * edit + * build + * install It is necessary to override the 'edit' phase, while 'build' and 'install' have sensible defaults. @@ -58,12 +59,12 @@ def edit(self, spec, prefix): tty.msg('Using default implementation: skipping edit phase.') def build(self, spec, prefix): - """Default build phase : call make passing build_args""" + """Make the build targets""" with working_dir(self.build_directory()): inspect.getmodule(self).make(*self.build_targets) def install(self, spec, prefix): - """Default install phase : call make passing install_args""" + """Make the install targets""" with working_dir(self.build_directory()): inspect.getmodule(self).make(*self.install_targets) diff --git a/lib/spack/spack/build_systems/r.py b/lib/spack/spack/build_systems/r.py index 52b3d82c601..f642f2dfd82 100644 --- a/lib/spack/spack/build_systems/r.py +++ b/lib/spack/spack/build_systems/r.py @@ -33,6 +33,7 @@ class RPackage(PackageBase): """Specialized class for packages that are built using R This class provides a single phase that can be overridden: + * install It has sensible defaults and for many packages the only thing diff --git a/lib/spack/spack/cmd/__init__.py b/lib/spack/spack/cmd/__init__.py index bcc4524b4f5..6fa08830144 100644 --- a/lib/spack/spack/cmd/__init__.py +++ b/lib/spack/spack/cmd/__init__.py @@ -108,9 +108,6 @@ def parse_specs(args, **kwargs): concretize = kwargs.get('concretize', False) normalize = kwargs.get('normalize', False) - if isinstance(args, (python_list, tuple)): - args = " ".join(args) - try: specs = spack.spec.parse(args) for spec in specs: @@ -219,9 +216,8 @@ def display_specs(specs, **kwargs): format = " %%-%ds%%s" % width for abbrv, spec in zip(abbreviated, specs): - if hashes: - print(gray_hash(spec, hlen), ) - print(format % (abbrv, spec.prefix)) + prefix = gray_hash(spec, hlen) if hashes else '' + print prefix + (format % (abbrv, spec.prefix)) elif mode == 'deps': for spec in specs: diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py index 2d25e8c8a9a..cac67f22af2 100644 --- a/lib/spack/spack/cmd/create.py +++ b/lib/spack/spack/cmd/create.py @@ -155,10 +155,6 @@ class CMakeGuess(DefaultGuess): """Provides appropriate overrides for cmake-based packages""" base_class_name = 'CMakePackage' - dependencies = """\ - # FIXME: Add additional dependencies if required. - depends_on('cmake', type='build')""" - body = """\ def cmake_args(self): # FIXME: Add arguments other than diff --git a/lib/spack/spack/cmd/install.py b/lib/spack/spack/cmd/install.py index 38994790ae3..3731fe3c81a 100644 --- a/lib/spack/spack/cmd/install.py +++ b/lib/spack/spack/cmd/install.py @@ -315,36 +315,36 @@ def install(parser, args, **kwargs): # Spec from cli specs = spack.cmd.parse_specs(args.package, concretize=True) - if len(specs) != 1: - tty.error('only one spec can be installed at a time.') - spec = specs.pop() + if len(specs) == 0: + tty.error('The `spack install` command requires a spec to install.') - # Check if we were asked to produce some log for dashboards - if args.log_format is not None: - # Compute the filename for logging - log_filename = args.log_file - if not log_filename: - log_filename = default_log_file(spec) - # Create the test suite in which to log results - test_suite = TestSuite(spec) - # Decorate PackageBase.do_install to get installation status - PackageBase.do_install = junit_output( - spec, test_suite - )(PackageBase.do_install) + for spec in specs: + # Check if we were asked to produce some log for dashboards + if args.log_format is not None: + # Compute the filename for logging + log_filename = args.log_file + if not log_filename: + log_filename = default_log_file(spec) + # Create the test suite in which to log results + test_suite = TestSuite(spec) + # Decorate PackageBase.do_install to get installation status + PackageBase.do_install = junit_output( + spec, test_suite + )(PackageBase.do_install) - # Do the actual installation - if args.things_to_install == 'dependencies': - # Install dependencies as-if they were installed - # for root (explicit=False in the DB) - kwargs['explicit'] = False - for s in spec.dependencies(): - p = spack.repo.get(s) - p.do_install(**kwargs) - else: - package = spack.repo.get(spec) - kwargs['explicit'] = True - package.do_install(**kwargs) + # Do the actual installation + if args.things_to_install == 'dependencies': + # Install dependencies as-if they were installed + # for root (explicit=False in the DB) + kwargs['explicit'] = False + for s in spec.dependencies(): + p = spack.repo.get(s) + p.do_install(**kwargs) + else: + package = spack.repo.get(spec) + kwargs['explicit'] = True + package.do_install(**kwargs) - # Dump log file if asked to - if args.log_format is not None: - test_suite.dump(log_filename) + # Dump log file if asked to + if args.log_format is not None: + test_suite.dump(log_filename) diff --git a/lib/spack/spack/cmd/module.py b/lib/spack/spack/cmd/module.py index 5887cbf495b..b4ee5613397 100644 --- a/lib/spack/spack/cmd/module.py +++ b/lib/spack/spack/cmd/module.py @@ -132,6 +132,7 @@ def loads(mtype, specs, args): module_commands = { 'tcl': 'module load ', + 'lmod': 'module load ', 'dotkit': 'dotkit use ' } diff --git a/lib/spack/spack/parse.py b/lib/spack/spack/parse.py index 1b88db2d7c5..e116175823b 100644 --- a/lib/spack/spack/parse.py +++ b/lib/spack/spack/parse.py @@ -23,6 +23,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## import re +import shlex import itertools import spack.error @@ -53,18 +54,55 @@ def __cmp__(self, other): class Lexer(object): """Base class for Lexers that keep track of line numbers.""" - def __init__(self, lexicon): - self.scanner = re.Scanner(lexicon) + def __init__(self, lexicon0, mode_switches_01=[], + lexicon1=[], mode_switches_10=[]): + self.scanner0 = re.Scanner(lexicon0) + self.mode_switches_01 = mode_switches_01 + self.scanner1 = re.Scanner(lexicon1) + self.mode_switches_10 = mode_switches_10 + self.mode = 0 def token(self, type, value=''): - return Token(type, value, - self.scanner.match.start(0), self.scanner.match.end(0)) + if self.mode == 0: + return Token(type, value, + self.scanner0.match.start(0), + self.scanner0.match.end(0)) + else: + return Token(type, value, + self.scanner1.match.start(0), + self.scanner1.match.end(0)) + + def lex_word(self, word): + scanner = self.scanner0 + mode_switches = self.mode_switches_01 + if self.mode == 1: + scanner = self.scanner1 + mode_switches = self.mode_switches_10 + + tokens, remainder = scanner.scan(word) + remainder_used = 0 + + for i, t in enumerate(tokens): + if t.type in mode_switches: + # Combine post-switch tokens with remainder and + # scan in other mode + self.mode = 1 - self.mode # swap 0/1 + remainder_used = 1 + tokens = tokens[:i + 1] + self.lex_word( + word[word.index(t.value) + len(t.value):]) + break + + if remainder and not remainder_used: + raise LexError("Invalid character", word, word.index(remainder)) + + return tokens def lex(self, text): - tokens, remainder = self.scanner.scan(text) - if remainder: - raise LexError("Invalid character", text, text.index(remainder)) - return tokens + lexed = [] + for word in text: + tokens = self.lex_word(word) + lexed.extend(tokens) + return lexed class Parser(object): @@ -121,6 +159,8 @@ def expect(self, id): sys.exit(1) def setup(self, text): + if isinstance(text, basestring): + text = shlex.split(text) self.text = text self.push_tokens(self.lexer.lex(text)) diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 8c6dd36c845..e34f2b799d3 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -614,7 +614,7 @@ def __str__(self): if type(self.value) == bool: return '{0}{1}'.format('+' if self.value else '~', self.name) else: - return ' {0}={1}'.format(self.name, self.value) + return ' {0}={1} '.format(self.name, self.value) class VariantMap(HashableMap): @@ -731,7 +731,8 @@ def __str__(self): cond_symbol = ' ' if len(sorted_keys) > 0 else '' return cond_symbol + ' '.join( str(key) + '=\"' + ' '.join( - str(f) for f in self[key]) + '\"' for key in sorted_keys) + str(f) for f in self[key]) + '\"' + for key in sorted_keys) + cond_symbol class DependencyMap(HashableMap): @@ -2447,7 +2448,8 @@ def write(s, c): write(fmt % str(self.variants), c) elif c == '=': if self.architecture and str(self.architecture): - write(fmt % (' arch' + c + str(self.architecture)), c) + a_str = ' arch' + c + str(self.architecture) + ' ' + write(fmt % (a_str), c) elif c == '#': out.write('-' + fmt % (self.dag_hash(7))) elif c == '$': @@ -2506,7 +2508,7 @@ def write(s, c): write(fmt % str(self.variants), '+') elif named_str == 'ARCHITECTURE': if self.architecture and str(self.architecture): - write(fmt % str(self.architecture), ' arch=') + write(fmt % str(self.architecture) + ' ', ' arch=') elif named_str == 'SHA1': if self.dependencies: out.write(fmt % str(self.dag_hash(7))) @@ -2576,7 +2578,8 @@ def __cmp__(self, other): return 0 def __str__(self): - return self.format() + self.dep_string() + ret = self.format() + self.dep_string() + return ret.strip() def _install_status(self): """Helper for tree to print DB install status.""" @@ -2650,7 +2653,7 @@ def __repr__(self): # # These are possible token types in the spec grammar. # -HASH, DEP, AT, COLON, COMMA, ON, OFF, PCT, EQ, QT, ID = range(11) +HASH, DEP, AT, COLON, COMMA, ON, OFF, PCT, EQ, ID, VAL = range(11) class SpecLexer(spack.parse.Lexer): @@ -2671,10 +2674,12 @@ def __init__(self): (r'\=', lambda scanner, val: self.token(EQ, val)), # This is more liberal than identifier_re (see above). # Checked by check_identifier() for better error messages. - (r'([\"\'])(?:(?=(\\?))\2.)*?\1', - lambda scanner, val: self.token(QT, val)), (r'\w[\w.-]*', lambda scanner, val: self.token(ID, val)), - (r'\s+', lambda scanner, val: None)]) + (r'\s+', lambda scanner, val: None)], + [EQ], + [(r'[\S].*', lambda scanner, val: self.token(VAL, val)), + (r'\s+', lambda scanner, val: None)], + [VAL]) # Lexer is always the same for every parser. @@ -2689,36 +2694,49 @@ def __init__(self): def do_parse(self): specs = [] + try: - while self.next: + while self.next or self.previous: # TODO: clean this parsing up a bit if self.previous: + # We picked up the name of this spec while finishing the + # previous spec specs.append(self.spec(self.previous.value)) - if self.accept(ID): + self.previous = None + elif self.accept(ID): self.previous = self.token if self.accept(EQ): + # We're either parsing an anonymous spec beginning + # with a key-value pair or adding a key-value pair + # to the last spec if not specs: specs.append(self.spec(None)) - if self.accept(QT): - self.token.value = self.token.value[1:-1] - else: - self.expect(ID) + self.expect(VAL) specs[-1]._add_flag( self.previous.value, self.token.value) + self.previous = None else: - specs.append(self.spec(self.previous.value)) - self.previous = None + # We're parsing a new spec by name + value = self.previous.value + self.previous = None + specs.append(self.spec(value)) elif self.accept(HASH): + # We're finding a spec by hash specs.append(self.spec_by_hash()) elif self.accept(DEP): if not specs: + # We're parsing an anonymous spec beginning with a + # dependency self.previous = self.token specs.append(self.spec(None)) self.previous = None if self.accept(HASH): + # We're finding a dependency by hash for an anonymous + # spec dep = self.spec_by_hash() else: + # We're adding a dependency to the last spec self.expect(ID) dep = self.spec(self.token.value) @@ -2727,11 +2745,12 @@ def do_parse(self): specs[-1]._add_dependency(dep, ()) else: - # Attempt to construct an anonymous spec, but check that - # the first token is valid - # TODO: Is this check even necessary, or will it all be Lex - # errors now? - specs.append(self.spec(None, True)) + # If the next token can be part of a valid anonymous spec, + # create the anonymous spec + if self.next.type in (AT, ON, OFF, PCT): + specs.append(self.spec(None)) + else: + self.unexpected_token() except spack.parse.ParseError as e: raise SpecParseError(e) @@ -2768,7 +2787,7 @@ def spec_by_hash(self): return matches[0] - def spec(self, name, check_valid_token=False): + def spec(self, name): """Parse a spec out of the input. If a spec is supplied, then initialize and return it instead of creating a new one.""" if name: @@ -2819,35 +2838,28 @@ def spec(self, name, check_valid_token=False): for version in vlist: spec._add_version(version) added_version = True - check_valid_token = False elif self.accept(ON): spec._add_variant(self.variant(), True) - check_valid_token = False elif self.accept(OFF): spec._add_variant(self.variant(), False) - check_valid_token = False elif self.accept(PCT): spec._set_compiler(self.compiler()) - check_valid_token = False elif self.accept(ID): self.previous = self.token if self.accept(EQ): - if self.accept(QT): - self.token.value = self.token.value[1:-1] - else: - self.expect(ID) + # We're adding a key-value pair to the spec + self.expect(VAL) spec._add_flag(self.previous.value, self.token.value) self.previous = None else: - return spec + # We've found the start of a new spec. Go back to do_parse + break else: - if check_valid_token: - self.unexpected_token() break # If there was no version in the spec, consier it an open range diff --git a/lib/spack/spack/test/build_systems.py b/lib/spack/spack/test/build_systems.py new file mode 100644 index 00000000000..2cafba0333c --- /dev/null +++ b/lib/spack/spack/test/build_systems.py @@ -0,0 +1,42 @@ +############################################################################## +# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://github.com/llnl/spack +# Please also see the LICENSE file for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License (as +# published by the Free Software Foundation) version 2.1, February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## + +import spack +from spack.build_environment import get_std_cmake_args +from spack.spec import Spec + + +def test_cmake_std_args(config, builtin_mock): + # Call the function on a CMakePackage instance + s = Spec('cmake-client') + s.concretize() + pkg = spack.repo.get(s) + assert pkg.std_cmake_args == get_std_cmake_args(pkg) + + # Call it on another kind of package + s = Spec('mpich') + s.concretize() + pkg = spack.repo.get(s) + assert get_std_cmake_args(pkg) diff --git a/lib/spack/spack/test/concretize_preferences.py b/lib/spack/spack/test/concretize_preferences.py index b95fc83010b..54df4e15631 100644 --- a/lib/spack/spack/test/concretize_preferences.py +++ b/lib/spack/spack/test/concretize_preferences.py @@ -43,6 +43,9 @@ def concretize_scope(config, tmpdir): spack.config.config_scopes.pop('concretize') spack.package_prefs._pkgsort = PreferredPackages() + # reset provider index each time, too + spack.repo._provider_index = None + def concretize(abstract_spec): return Spec(abstract_spec).concretized() @@ -123,7 +126,8 @@ def test_no_virtuals_in_packages_yaml(self): # set up a packages.yaml file with a vdep as a key. We use # syaml.load here to make sure source lines in the config are # attached to parsed strings, as the error message uses them. - conf = syaml.load("""mpi: + conf = syaml.load("""\ +mpi: paths: mpi-with-lapack@2.1: /path/to/lapack """) @@ -135,7 +139,8 @@ def test_no_virtuals_in_packages_yaml(self): def test_all_is_not_a_virtual(self): """Verify that `all` is allowed in packages.yaml.""" - conf = syaml.load("""all: + conf = syaml.load("""\ +all: variants: [+mpi] """) spack.config.update_config('packages', conf, 'concretize') @@ -143,3 +148,26 @@ def test_all_is_not_a_virtual(self): # should be no error for 'all': spack.package_prefs._pkgsort = PreferredPackages() spack.package_prefs.get_packages_config() + + def test_external_mpi(self): + # make sure this doesn't give us an external first. + spec = Spec('mpi') + spec.concretize() + assert not spec['mpi'].external + + # load config + conf = syaml.load("""\ +all: + providers: + mpi: [mpich] +mpich: + buildable: false + paths: + mpich@3.0.4: /dummy/path +""") + spack.config.update_config('packages', conf, 'concretize') + + # ensure that once config is in place, external is used + spec = Spec('mpi') + spec.concretize() + assert spec['mpich'].external == '/dummy/path' diff --git a/lib/spack/spack/test/spec_syntax.py b/lib/spack/spack/test/spec_syntax.py index 3cf094f25ae..043d9b176fb 100644 --- a/lib/spack/spack/test/spec_syntax.py +++ b/lib/spack/spack/test/spec_syntax.py @@ -23,6 +23,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## import pytest +import shlex import spack.spec as sp from spack.parse import Token @@ -53,6 +54,34 @@ Token(sp.AT), Token(sp.ID, '8.1_1e')] +# Another sample lexer output with a kv pair. +kv_lex = [Token(sp.ID, 'mvapich_foo'), + Token(sp.ID, 'debug'), + Token(sp.EQ), + Token(sp.VAL, '4'), + Token(sp.DEP), + Token(sp.ID, '_openmpi'), + Token(sp.AT), + Token(sp.ID, '1.2'), + Token(sp.COLON), + Token(sp.ID, '1.4'), + Token(sp.COMMA), + Token(sp.ID, '1.6'), + Token(sp.PCT), + Token(sp.ID, 'intel'), + Token(sp.AT), + Token(sp.ID, '12.1'), + Token(sp.COLON), + Token(sp.ID, '12.6'), + Token(sp.ON), + Token(sp.ID, 'debug'), + Token(sp.OFF), + Token(sp.ID, 'qt_4'), + Token(sp.DEP), + Token(sp.ID, 'stackwalker'), + Token(sp.AT), + Token(sp.ID, '8.1_1e')] + class TestSpecSyntax(object): # ======================================================================== @@ -81,9 +110,10 @@ def check_parse(self, expected, spec=None, remove_arch=True): def check_lex(self, tokens, spec): """Check that the provided spec parses to the provided token list.""" + spec = shlex.split(spec) lex_output = sp.SpecLexer().lex(spec) for tok, spec_tok in zip(tokens, lex_output): - if tok.type == sp.ID: + if tok.type == sp.ID or tok.type == sp.VAL: assert tok == spec_tok else: # Only check the type for non-identifiers. @@ -112,10 +142,19 @@ def test_dependencies_with_versions(self): self.check_parse("openmpi^hwloc@:1.4b7-rc3") self.check_parse("openmpi^hwloc@1.2e6:1.4b7-rc3") - @pytest.mark.xfail def test_multiple_specs(self): self.check_parse("mvapich emacs") + def test_multiple_specs_after_kv(self): + self.check_parse('mvapich cppflags="-O3 -fPIC" emacs') + self.check_parse('mvapich cflags="-O3" emacs', + 'mvapich cflags=-O3 emacs') + + def test_multiple_specs_long_second(self): + self.check_parse('mvapich emacs@1.1.1%intel cflags="-O3"', + 'mvapich emacs @1.1.1 %intel cflags=-O3') + self.check_parse('mvapich cflags="-O3 -fPIC" emacs^ncurses%intel') + def test_full_specs(self): self.check_parse( "mvapich_foo" @@ -123,15 +162,15 @@ def test_full_specs(self): "^stackwalker@8.1_1e") self.check_parse( "mvapich_foo" - "^_openmpi@1.2:1.4,1.6%intel@12.1 debug=2~qt_4" + "^_openmpi@1.2:1.4,1.6%intel@12.1 debug=2 ~qt_4" "^stackwalker@8.1_1e") self.check_parse( 'mvapich_foo' - '^_openmpi@1.2:1.4,1.6%intel@12.1 cppflags="-O3"+debug~qt_4' + '^_openmpi@1.2:1.4,1.6%intel@12.1 cppflags="-O3" +debug~qt_4' '^stackwalker@8.1_1e') self.check_parse( "mvapich_foo" - "^_openmpi@1.2:1.4,1.6%intel@12.1 debug=2~qt_4" + "^_openmpi@1.2:1.4,1.6%intel@12.1 debug=2 ~qt_4" "^stackwalker@8.1_1e arch=test-redhat6-x86_32") def test_canonicalize(self): @@ -158,19 +197,19 @@ def test_canonicalize(self): "x ^y~f+e~d+c~b+a@4,2:3,1%intel@4,3,2,1") self.check_parse( - "x arch=test-redhat6-None" - "^y arch=test-None-x86_64" + "x arch=test-redhat6-None " + "^y arch=test-None-x86_64 " "^z arch=linux-None-None", - "x os=fe" - "^y target=be" + "x os=fe " + "^y target=be " "^z platform=linux") self.check_parse( - "x arch=test-debian6-x86_64" + "x arch=test-debian6-x86_64 " "^y arch=test-debian6-x86_64", - "x os=default_os target=default_target" + "x os=default_os target=default_target " "^y os=default_os target=default_target") self.check_parse("x^y", "x@: ^y@:") @@ -184,7 +223,7 @@ def test_duplicate_variant(self): 'x@1.2+debug+debug', 'x ^y@1.2+debug debug=true', 'x ^y@1.2 debug=false debug=true', - 'x ^y@1.2 debug=false~debug' + 'x ^y@1.2 debug=false ~debug' ] self._check_raises(DuplicateVariantError, duplicates) @@ -277,3 +316,49 @@ def test_way_too_many_spaces(self): "mvapich_foo " "^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug - qt_4 " "^ stackwalker @ 8.1_1e") + self.check_lex( + complex_lex, + "mvapich_foo " + "^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug ~ qt_4 " + "^ stackwalker @ 8.1_1e") + + def test_kv_with_quotes(self): + self.check_lex( + kv_lex, + "mvapich_foo debug='4' " + "^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug - qt_4 " + "^ stackwalker @ 8.1_1e") + self.check_lex( + kv_lex, + 'mvapich_foo debug="4" ' + "^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug - qt_4 " + "^ stackwalker @ 8.1_1e") + self.check_lex( + kv_lex, + "mvapich_foo 'debug = 4' " + "^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug - qt_4 " + "^ stackwalker @ 8.1_1e") + + def test_kv_without_quotes(self): + self.check_lex( + kv_lex, + "mvapich_foo debug=4 " + "^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug - qt_4 " + "^ stackwalker @ 8.1_1e") + + def test_kv_with_spaces(self): + self.check_lex( + kv_lex, + "mvapich_foo debug = 4 " + "^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug - qt_4 " + "^ stackwalker @ 8.1_1e") + self.check_lex( + kv_lex, + "mvapich_foo debug =4 " + "^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug - qt_4 " + "^ stackwalker @ 8.1_1e") + self.check_lex( + kv_lex, + "mvapich_foo debug= 4 " + "^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug - qt_4 " + "^ stackwalker @ 8.1_1e") diff --git a/var/spack/repos/builtin.mock/packages/cmake-client/package.py b/var/spack/repos/builtin.mock/packages/cmake-client/package.py index 0c78f0bf688..51704e3f4b6 100644 --- a/var/spack/repos/builtin.mock/packages/cmake-client/package.py +++ b/var/spack/repos/builtin.mock/packages/cmake-client/package.py @@ -32,15 +32,13 @@ def check(condition, msg): raise InstallError(msg) -class CmakeClient(Package): +class CmakeClient(CMakePackage): """A dumy package that uses cmake.""" homepage = 'https://www.example.com' url = 'https://www.example.com/cmake-client-1.0.tar.gz' version('1.0', '4cb3ff35b2472aae70f542116d616e63') - depends_on('cmake', type='build') - def setup_environment(self, spack_env, run_env): spack_cc # Ensure spack module-scope variable is avaiabl check(from_cmake == "from_cmake", @@ -68,6 +66,11 @@ def setup_dependent_package(self, module, dspec): "link arg on dependency spec not readable from " "setup_dependent_package.") + def cmake(self, spec, prefix): + pass + + build = cmake + def install(self, spec, prefix): # check that cmake is in the global scope. global cmake diff --git a/var/spack/repos/builtin/packages/astra/package.py b/var/spack/repos/builtin/packages/astra/package.py new file mode 100644 index 00000000000..e32e70cada2 --- /dev/null +++ b/var/spack/repos/builtin/packages/astra/package.py @@ -0,0 +1,41 @@ +############################################################################## +# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://github.com/llnl/spack +# Please also see the LICENSE file for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License (as +# published by the Free Software Foundation) version 2.1, February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +from spack import * + + +class Astra(Package): + """A Space Charge Tracking Algorithm.""" + + homepage = "http://www.desy.de/~mpyflo/" + + version('2016-11-30', '17135b7a4adbacc1843a50a6a2ae2c25', expand=False, + url='http://www.desy.de/~mpyflo/Astra_for_64_Bit_Linux/Astra') + + def install(self, spec, prefix): + mkdir(prefix.bin) + install('Astra', prefix.bin) + + chmod = which('chmod') + chmod('+x', join_path(prefix.bin, 'Astra')) diff --git a/var/spack/repos/builtin/packages/boost/boost_10125.patch b/var/spack/repos/builtin/packages/boost/boost_10125.patch new file mode 100644 index 00000000000..71cfaa871e8 --- /dev/null +++ b/var/spack/repos/builtin/packages/boost/boost_10125.patch @@ -0,0 +1,51 @@ +--- a/boost/thread/pthread/once.hpp ++++ b/boost/thread/pthread/once.hpp +@@ -42,7 +42,7 @@ namespace boost + } + + #ifdef BOOST_THREAD_PROVIDES_ONCE_CXX11 +-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES ++#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template + inline void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f, BOOST_THREAD_RV_REF(ArgTypes)... args); + #else +@@ -65,7 +65,7 @@ namespace boost + private: + volatile thread_detail::uintmax_atomic_t epoch; + +-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES ++#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template + friend void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f, BOOST_THREAD_RV_REF(ArgTypes)... args); + #else +@@ -118,7 +118,7 @@ namespace boost + // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2444.html + + +-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES ++#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + + + template +--- a/boost/thread/pthread/once_atomic.hpp ++++ b/boost/thread/pthread/once_atomic.hpp +@@ -115,7 +115,7 @@ namespace boost + #endif + + +-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES ++#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + + template + inline void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f, BOOST_THREAD_RV_REF(ArgTypes)... args) +--- a/boost/thread/win32/once.hpp ++++ b/boost/thread/win32/once.hpp +@@ -227,7 +227,7 @@ namespace boost + } + } + +-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES ++#if !defined BOOST_NO_CXX11_VARIADIC_TEMPLATES && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + //#if defined(BOOST_THREAD_RVALUE_REFERENCES_DONT_MATCH_FUNTION_PTR) + inline void call_once(once_flag& flag, void (*f)()) + { diff --git a/var/spack/repos/builtin/packages/boost/package.py b/var/spack/repos/builtin/packages/boost/package.py index fa3f66d8f48..738e8a0e35a 100644 --- a/var/spack/repos/builtin/packages/boost/package.py +++ b/var/spack/repos/builtin/packages/boost/package.py @@ -130,6 +130,9 @@ class Boost(Package): # Patch fix from https://svn.boost.org/trac/boost/ticket/11856 patch('boost_11856.patch', when='@1.60.0%gcc@4.4.7') + # Patch fix from https://svn.boost.org/trac/boost/ticket/10125 + patch('boost_10125.patch', when='@1.55.0%gcc@5.0:5.9') + def url_for_version(self, version): """ Handle Boost's weird URLs, @@ -251,6 +254,13 @@ def determine_b2_options(self, spec, options): 'toolset=%s' % self.determine_toolset(spec) ]) + # clang is not officially supported for pre-compiled headers + # and at least in clang 3.9 still fails to build + # http://www.boost.org/build/doc/html/bbv2/reference/precompiled_headers.html + # https://svn.boost.org/trac/boost/ticket/12496 + if spec.satisfies('%clang'): + options.extend(['pch=off']) + return threadingOpts def add_buildopt_symlinks(self, prefix): diff --git a/var/spack/repos/builtin/packages/boxlib/package.py b/var/spack/repos/builtin/packages/boxlib/package.py index 4f41aba6c6a..8d46014d3b2 100644 --- a/var/spack/repos/builtin/packages/boxlib/package.py +++ b/var/spack/repos/builtin/packages/boxlib/package.py @@ -25,26 +25,28 @@ from spack import * -class Boxlib(Package): +class Boxlib(CMakePackage): """BoxLib, a software framework for massively parallel block-structured adaptive mesh refinement (AMR) codes.""" homepage = "https://ccse.lbl.gov/BoxLib/" - url = "https://ccse.lbl.gov/pub/Downloads/BoxLib.git" + url = "https://github.com/BoxLib-Codes/BoxLib/archive/16.12.2.tar.gz" - # TODO: figure out how best to version this. No tags in the repo! - version('master', git='https://ccse.lbl.gov/pub/Downloads/BoxLib.git') + version('16.12.2', 'a28d92a5ff3fbbdbbd0a776a59f18526') depends_on('mpi') - depends_on('cmake', type='build') - def install(self, spec, prefix): - args = std_cmake_args - args += ['-DCCSE_ENABLE_MPI=1', - '-DCMAKE_C_COMPILER=%s' % which('mpicc'), - '-DCMAKE_CXX_COMPILER=%s' % which('mpicxx'), - '-DCMAKE_Fortran_COMPILER=%s' % which('mpif90')] + def cmake_args(self): + spec = self.spec + options = [] - cmake('.', *args) - make() - make("install") + options.extend([ + # '-DBL_SPACEDIM=3', + '-DENABLE_POSITION_INDEPENDENT_CODE=ON', + '-DENABLE_FBASELIB=ON', + '-DCMAKE_C_COMPILER=%s' % spec['mpi'].mpicc, + '-DCMAKE_CXX_COMPILER=%s' % spec['mpi'].mpicxx, + '-DCMAKE_Fortran_COMPILER=%s' % spec['mpi'].mpifc + ]) + + return options diff --git a/var/spack/repos/builtin/packages/cmake/package.py b/var/spack/repos/builtin/packages/cmake/package.py index d2f1e27a0b2..60c95b91842 100644 --- a/var/spack/repos/builtin/packages/cmake/package.py +++ b/var/spack/repos/builtin/packages/cmake/package.py @@ -28,8 +28,10 @@ class Cmake(Package): """A cross-platform, open-source build system. CMake is a family of tools designed to build, test and package software.""" - homepage = 'https://www.cmake.org' - url = 'https://cmake.org/files/v3.4/cmake-3.4.3.tar.gz' + homepage = 'https://www.cmake.org' + url = 'https://cmake.org/files/v3.4/cmake-3.4.3.tar.gz' + list_url = 'https://cmake.org/files/' + list_depth = 2 version('3.7.1', 'd031d5a06e9f1c5367cdfc56fbd2a1c8') version('3.6.1', 'd6dd661380adacdb12f41b926ec99545') diff --git a/var/spack/repos/builtin/packages/cppad/package.py b/var/spack/repos/builtin/packages/cppad/package.py new file mode 100644 index 00000000000..1ec31bbeefa --- /dev/null +++ b/var/spack/repos/builtin/packages/cppad/package.py @@ -0,0 +1,48 @@ +############################################################################## +# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://github.com/llnl/spack +# Please also see the LICENSE file for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License (as +# published by the Free Software Foundation) version 2.1, February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +from spack import * + + +class Cppad(CMakePackage): + """A Package for Differentiation of C++ Algorithms.""" + + homepage = "https://www.coin-or.org/CppAD/" + + version('20170114', '565a534dc813fa1289764222cd8c11ea') + version('develop', git='https://github.com/coin-or/CppAD.git') + + depends_on('cmake', type='build') + + def url_for_version(self, version): + """Handle version-based custom URLs.""" + return "http://www.coin-or.org/download/source/CppAD/cppad-%s.gpl.tgz" % (version) + + def cmake_args(self): + # This package does not obey CMAKE_INSTALL_PREFIX + args = [ + "-Dcppad_prefix=%s" % (self.prefix), + "-Dcmake_install_docdir=share/cppad/doc" + ] + return args diff --git a/var/spack/repos/builtin/packages/cuda/package.py b/var/spack/repos/builtin/packages/cuda/package.py index 36cf3058d73..ed8518f98fe 100644 --- a/var/spack/repos/builtin/packages/cuda/package.py +++ b/var/spack/repos/builtin/packages/cuda/package.py @@ -50,6 +50,8 @@ class Cuda(Package): homepage = "http://www.nvidia.com/object/cuda_home_new.html" + version('8.0.44', '6dca912f9b7e2b7569b0074a41713640', expand=False, + url="file://%s/cuda_8.0.44_linux.run" % os.getcwd()) version('7.5.18', '4b3bcecf0dfc35928a0898793cf3e4c6', expand=False, url="file://%s/cuda_7.5.18_linux.run" % os.getcwd()) version('6.5.14', '90b1b8f77313600cc294d9271741f4da', expand=False, diff --git a/var/spack/repos/builtin/packages/dealii/package.py b/var/spack/repos/builtin/packages/dealii/package.py index 8c31b90f519..66267b2d9a7 100644 --- a/var/spack/repos/builtin/packages/dealii/package.py +++ b/var/spack/repos/builtin/packages/dealii/package.py @@ -66,7 +66,7 @@ class Dealii(CMakePackage): description='Compile with Trilinos (only with MPI)') variant('python', default=True, description='Compile with Python bindings') - variant('64bit', default=False, + variant('int64', default=False, description='Compile with 64 bit indices support') # required dependencies, light version @@ -108,11 +108,11 @@ class Dealii(CMakePackage): depends_on("netcdf-cxx", when='+netcdf+mpi') depends_on("oce", when='+oce') depends_on("p4est", when='+p4est+mpi') - depends_on("petsc+mpi", when='@8.4.2:+petsc+mpi~64bit') + depends_on("petsc+mpi", when='@8.4.2:+petsc+mpi~int64') depends_on('python', when='@8.5.0:+python') - depends_on("slepc", when='@8.4.2:+slepc+petsc+mpi~64bit') - depends_on("petsc@:3.6.4+mpi", when='@:8.4.1+petsc+mpi~64bit') - depends_on("slepc@:3.6.3", when='@:8.4.1+slepc+petsc+mpi~64bit') + depends_on("slepc", when='@8.4.2:+slepc+petsc+mpi~int64') + depends_on("petsc@:3.6.4+mpi", when='@:8.4.1+petsc+mpi~int64') + depends_on("slepc@:3.6.3", when='@:8.4.1+slepc+petsc+mpi~int64') depends_on("trilinos", when='+trilinos+mpi') def build_type(self): @@ -244,7 +244,7 @@ def cmake_args(self): # 64 bit indices options.extend([ - '-DDEAL_II_WITH_64BIT_INDICES=%s' % ('+64bit' in spec) + '-DDEAL_II_WITH_64BIT_INDICES=%s' % ('+int64' in spec) ]) return options diff --git a/var/spack/repos/builtin/packages/espressopp/package.py b/var/spack/repos/builtin/packages/espressopp/package.py index 21e1cc13178..2903a02f7de 100644 --- a/var/spack/repos/builtin/packages/espressopp/package.py +++ b/var/spack/repos/builtin/packages/espressopp/package.py @@ -36,7 +36,7 @@ class Espressopp(CMakePackage): url = "https://github.com/espressopp/espressopp/tarball/v1.9.4.1" version('develop', git='https://github.com/espressopp/espressopp.git', branch='master') - version('1.9.4.1', '0da74a6d4e1bfa6a2a24fca354245a4f') + version('1.9.4.1', '0da74a6d4e1bfa6a2a24fca354245a4f') version('1.9.4', 'f2a27993a83547ad014335006eea74ea') variant('debug', default=False, description='Build debug version') @@ -54,20 +54,23 @@ class Espressopp(CMakePackage): depends_on("fftw") depends_on("py-sphinx", when="+ug", type='build') depends_on("py-sphinx", when="+pdf", type='build') + depends_on('py-numpy', when="+ug", type='build') + depends_on('py-numpy', when="+pdf", type='build') + depends_on('py-matplotlib', when="+ug", type='build') + depends_on('py-matplotlib', when="+pdf", type='build') depends_on("texlive", when="+pdf", type='build') depends_on("doxygen", when="+dg", type='build') - def cmake_args(self): + def build_type(self): spec = self.spec - options = [] - options.extend(['-DEXTERNAL_MPI4PY=ON', '-DEXTERNAL_BOOST=ON']) if '+debug' in spec: - options.extend(['-DCMAKE_BUILD_TYPE:STRING=Debug']) + return 'Debug' else: - options.extend(['-DCMAKE_BUILD_TYPE:STRING=Release']) - - return options - + return 'Release' + + def cmake_args(self): + return ['-DEXTERNAL_MPI4PY=ON', '-DEXTERNAL_BOOST=ON'] + def build(self, spec, prefix): with working_dir(self.build_directory()): make() diff --git a/var/spack/repos/builtin/packages/everytrace-example/package.py b/var/spack/repos/builtin/packages/everytrace-example/package.py index 8c49e04634a..76b437a38a0 100644 --- a/var/spack/repos/builtin/packages/everytrace-example/package.py +++ b/var/spack/repos/builtin/packages/everytrace-example/package.py @@ -33,7 +33,6 @@ class EverytraceExample(CMakePackage): git='https://github.com/citibeth/everytrace-example.git', branch='develop') - depends_on('cmake', type='build') depends_on('everytrace+mpi+fortran') # Currently the only MPI this everytrace works with. diff --git a/var/spack/repos/builtin/packages/everytrace/package.py b/var/spack/repos/builtin/packages/everytrace/package.py index a3f3e2cfcee..d884c7b165b 100644 --- a/var/spack/repos/builtin/packages/everytrace/package.py +++ b/var/spack/repos/builtin/packages/everytrace/package.py @@ -39,7 +39,6 @@ class Everytrace(CMakePackage): variant('fortran', default=True, description='Enable use with Fortran programs') - depends_on('cmake', type='build') depends_on('mpi', when='+mpi') def cmake_args(self): diff --git a/var/spack/repos/builtin/packages/hypre/package.py b/var/spack/repos/builtin/packages/hypre/package.py index 82a6b06b1f1..ed0f665462f 100644 --- a/var/spack/repos/builtin/packages/hypre/package.py +++ b/var/spack/repos/builtin/packages/hypre/package.py @@ -46,6 +46,8 @@ class Hypre(Package): # SuperluDist have conflicting headers with those in Hypre variant('internal-superlu', default=True, description="Use internal Superlu routines") + variant('int64', default=False, + description="Use 64bit integers") depends_on("mpi") depends_on("blas") @@ -68,6 +70,9 @@ def install(self, spec, prefix): '--with-blas-lib-dirs=%s' % ' '.join(blas.directories) ] + if '+int64' in self.spec: + configure_args.append('--enable-bigint') + if '+shared' in self.spec: configure_args.append("--enable-shared") diff --git a/var/spack/repos/builtin/packages/ibmisc/package.py b/var/spack/repos/builtin/packages/ibmisc/package.py index 7365eac46aa..f3252055078 100644 --- a/var/spack/repos/builtin/packages/ibmisc/package.py +++ b/var/spack/repos/builtin/packages/ibmisc/package.py @@ -64,7 +64,6 @@ class Ibmisc(CMakePackage): depends_on('boost', when='+boost') # Build dependencies - depends_on('cmake', type='build') depends_on('doxygen', type='build') def cmake_args(self): diff --git a/var/spack/repos/builtin/packages/icet/package.py b/var/spack/repos/builtin/packages/icet/package.py index cdace1481f6..f8260f19519 100644 --- a/var/spack/repos/builtin/packages/icet/package.py +++ b/var/spack/repos/builtin/packages/icet/package.py @@ -36,7 +36,6 @@ class Icet(CMakePackage): git='https://gitlab.kitware.com/icet/icet.git') version('2.1.1', '4f971c51105a64937460d482adca2a6c') - depends_on('cmake', type='build') depends_on('mpi') def url_for_version(self, version): diff --git a/var/spack/repos/builtin/packages/isl/package.py b/var/spack/repos/builtin/packages/isl/package.py index 259f4881f5a..f6188e6b3e0 100644 --- a/var/spack/repos/builtin/packages/isl/package.py +++ b/var/spack/repos/builtin/packages/isl/package.py @@ -31,6 +31,7 @@ class Isl(Package): homepage = "http://isl.gforge.inria.fr" url = "http://isl.gforge.inria.fr/isl-0.14.tar.bz2" + version('0.18', '11436d6b205e516635b666090b94ab32') version('0.14', 'acd347243fca5609e3df37dba47fd0bb') depends_on("gmp") diff --git a/var/spack/repos/builtin/packages/jansson/package.py b/var/spack/repos/builtin/packages/jansson/package.py index 8ba7829bbc7..e6100607aaf 100644 --- a/var/spack/repos/builtin/packages/jansson/package.py +++ b/var/spack/repos/builtin/packages/jansson/package.py @@ -33,5 +33,3 @@ class Jansson(CMakePackage): url = "https://github.com/akheron/jansson/archive/v2.9.tar.gz" version('2.9', 'd2db25c437b359fc5a065ed938962237') - - depends_on('cmake', type='build') diff --git a/var/spack/repos/builtin/packages/libspatialindex/package.py b/var/spack/repos/builtin/packages/libspatialindex/package.py index 731e47a9914..5dd839a7c37 100644 --- a/var/spack/repos/builtin/packages/libspatialindex/package.py +++ b/var/spack/repos/builtin/packages/libspatialindex/package.py @@ -30,5 +30,3 @@ class Libspatialindex(CMakePackage): url = "https://github.com/libspatialindex/libspatialindex/tarball/1.8.5" version('1.8.5', 'a95d8159714dbda9a274792cd273d298') - - depends_on("cmake", type='build') diff --git a/var/spack/repos/builtin/packages/libwebsockets/package.py b/var/spack/repos/builtin/packages/libwebsockets/package.py index 904ad887ecb..3ce58a4c369 100644 --- a/var/spack/repos/builtin/packages/libwebsockets/package.py +++ b/var/spack/repos/builtin/packages/libwebsockets/package.py @@ -35,6 +35,5 @@ class Libwebsockets(CMakePackage): version('2.0.3', 'a025156d606d90579e65d53ccd062a94') version('1.7.9', '7b3692ead5ae00fd0e1d56c080170f07') - depends_on('cmake', type='build') depends_on('zlib') depends_on('openssl') diff --git a/var/spack/repos/builtin/packages/m4/package.py b/var/spack/repos/builtin/packages/m4/package.py index 15dbf4793ba..ebfbc28612e 100644 --- a/var/spack/repos/builtin/packages/m4/package.py +++ b/var/spack/repos/builtin/packages/m4/package.py @@ -23,7 +23,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from spack import * -import sys class M4(AutotoolsPackage): @@ -52,8 +51,9 @@ def configure_args(self): args.append('--without-libsigsegv-prefix') # http://lists.gnu.org/archive/html/bug-m4/2016-09/msg00002.html - if (sys.platform == 'darwin') and (spec.satisfies('%gcc')) and \ - (spec.architecture.platform_os.version == '10.12'): + arch = spec.architecture + if (arch.platform == 'darwin' and arch.platform_os == 'sierra' and + '%gcc' in spec): args.append('ac_cv_type_struct_sched_param=yes') return args diff --git a/var/spack/repos/builtin/packages/metis/package.py b/var/spack/repos/builtin/packages/metis/package.py index ca48a47817a..b66677288c1 100644 --- a/var/spack/repos/builtin/packages/metis/package.py +++ b/var/spack/repos/builtin/packages/metis/package.py @@ -47,7 +47,7 @@ class Metis(Package): variant('debug', default=False, description='Builds the library in debug mode.') variant('gdb', default=False, description='Enables gdb support.') - variant('idx64', default=False, description='Sets the bit width of METIS\'s index type to 64.') + variant('int64', default=False, description='Sets the bit width of METIS\'s index type to 64.') variant('real64', default=False, description='Sets the bit width of METIS\'s real type to 64.') depends_on('cmake@2.8:', when='@5:', type='build') @@ -69,7 +69,7 @@ def patch(self): metis_header.filter( r'(\b)(IDXTYPEWIDTH )(\d+)(\b)', - r'\1\2{0}\4'.format('64' if '+idx64' in self.spec else '32'), + r'\1\2{0}\4'.format('64' if '+int64' in self.spec else '32'), ) metis_header.filter( r'(\b)(REALTYPEWIDTH )(\d+)(\b)', @@ -87,9 +87,9 @@ def patch(self): @when('@:4') def install(self, spec, prefix): # Process library spec and options - if any('+{0}'.format(v) in spec for v in ['gdb', 'idx64', 'real64']): + if any('+{0}'.format(v) in spec for v in ['gdb', 'int64', 'real64']): raise InstallError('METIS@:4 does not support the following ' - 'variants: gdb, idx64, real64.') + 'variants: gdb, int64, real64.') options = ['COPTIONS=-fPIC'] if '+debug' in spec: diff --git a/var/spack/repos/builtin/packages/mumps/package.py b/var/spack/repos/builtin/packages/mumps/package.py index fcb6549d297..82d0c606b68 100644 --- a/var/spack/repos/builtin/packages/mumps/package.py +++ b/var/spack/repos/builtin/packages/mumps/package.py @@ -55,7 +55,7 @@ class Mumps(Package): description='Activate the compilation of smumps') variant('complex', default=True, description='Activate the compilation of cmumps and/or zmumps') - variant('idx64', default=False, + variant('int64', default=False, description='Use int64_t/integer*8 as default index type') variant('shared', default=True, description='Build shared libraries') @@ -125,7 +125,7 @@ def write_makefile_inc(self): fpic = '-fPIC' if '+shared' in self.spec else '' # TODO: test this part, it needs a full blas, scalapack and # partitionning environment with 64bit integers - if '+idx64' in self.spec: + if '+int64' in self.spec: makefile_conf.extend( # the fortran compilation flags most probably are # working only for intel and gnu compilers this is diff --git a/var/spack/repos/builtin/packages/octopus/package.py b/var/spack/repos/builtin/packages/octopus/package.py index a100f7896a2..b74befbe350 100644 --- a/var/spack/repos/builtin/packages/octopus/package.py +++ b/var/spack/repos/builtin/packages/octopus/package.py @@ -30,22 +30,47 @@ class Octopus(Package): theory code.""" homepage = "http://www.tddft.org/programs/octopus/" - url = "http://www.tddft.org/programs/octopus/down.php?file=5.0.1/octopus-5.0.1.tar.gz" + base_url = "http://www.tddft.org/programs/octopus/down.php?file=" + version('6.0', '5d1168c2a8d7fd9cb9492eaebaa7182e') version('5.0.1', '2b6392ab67b843f9d4ca7413fc07e822') + # Sample url is: + # "http://www.tddft.org/programs/octopus/down.php?file=5.0.1/octopus-5.0.1.tar.gz" + def url_for_version(self, version): + return '{0}/{1}/octopus-{1}.tar.gz'.format(Octopus.base_url, + version.dotted) + + variant('scalapack', default=False, + description='Compile with Scalapack') + variant('metis', default=True, + description='Compile with METIS') + variant('parmetis', default=False, + description='Compile with ParMETIS') + variant('netcdf', default=False, + description='Compile with Netcdf') + variant('arpack-ng', default=False, + description='Compile with ARPACK-ng') + depends_on('blas') depends_on('gsl') depends_on('lapack') depends_on('libxc') depends_on('mpi') depends_on('fftw+mpi') + depends_on('metis@5:', when='+metis') + depends_on('parmetis', when='+parmetis') + depends_on('scalapack', when='+scalapack') + depends_on('netcdf-fortran', when='+netcdf') + depends_on('arpack-ng', when='+arpack-ng') # optional dependencies: - # TODO: scalapack, metis, parmetis, netcdf, etsf-io, sparskit, arpack, + # TODO: parmetis, etsf-io, sparskit, # feast, libfm, pfft, isf, pnfft def install(self, spec, prefix): + arpack = find_libraries(['libarpack'], root=spec[ + 'arpack-ng'].prefix.lib, shared=True) lapack = spec['lapack'].lapack_libs blas = spec['blas'].blas_libs args = [] @@ -58,17 +83,37 @@ def install(self, spec, prefix): 'CC=%s' % spec['mpi'].mpicc, 'FC=%s' % spec['mpi'].mpifc, '--enable-mpi', - '--with-fft-lib=-L%s -lfftw3' % spec['fftw'].prefix.lib - # --with-blacs=${prefix}/lib/libscalapack.dylib - # --with-netcdf-prefix=netcdf-fortran + '--with-fft-lib=-L%s -lfftw3' % spec['fftw'].prefix.lib, + ]) + if '+metis' in spec: + args.extend([ + '--with-metis-prefix=%s' % spec['metis'].prefix, + ]) + if '+parmetis' in spec: + args.extend([ + '--with-parmetis-prefix=%s' % spec['parmetis'].prefix, + ]) + if '+netcdf' in spec: + args.extend([ + '--with-netcdf-prefix=%s' % spec['netcdf-fortran'].prefix, + '--with-netcdf-include=%s' % + spec['netcdf-fortran'].prefix.include, + ]) + if '+arpack-ng' in spec: + args.extend([ + '--with-arpack={0}'.format(arpack.joined()), + ]) + if '+scalapack' in spec: + args.extend([ + '--with-blacs=%s' % spec['scalapack'].scalapack_libs, + '--with-scalapack=%s' % spec['scalapack'].scalapack_libs, + ]) # --with-etsf-io-prefix= # --with-sparskit=${prefix}/lib/libskit.a # --with-pfft-prefix=${prefix} --with-mpifftw-prefix=${prefix} - # --with-arpack=${prefix}/lib/libarpack.dylib # --with-parpack=${prefix}/lib/libparpack.dylib - # --with-metis-prefix=${prefix} --with-parmetis-prefix=${prefix} + # --with-parmetis-prefix=${prefix} # --with-berkeleygw-prefix=${prefix} - ]) # When preprocessor expands macros (i.e. CFLAGS) defined as quoted # strings the result may be > 132 chars and is terminated. diff --git a/var/spack/repos/builtin/packages/petsc/package.py b/var/spack/repos/builtin/packages/petsc/package.py index 7d51bbad487..a9d4ff60655 100644 --- a/var/spack/repos/builtin/packages/petsc/package.py +++ b/var/spack/repos/builtin/packages/petsc/package.py @@ -41,6 +41,7 @@ class Petsc(Package): version('for-pflotran-0.1.0', git='https://bitbucket.org/petsc/petsc.git', commit='7943f4e1472fff9cf1fc630a1100136616e4970f') + version('3.7.5', 'f00f6e6a3bac39052350dd47194b58a3') version('3.7.4', 'aaf94fa54ef83022c14091f10866eedf') version('3.7.2', '50da49867ce7a49e7a0c1b37f4ec7b34') version('3.6.4', '7632da2375a3df35b8891c9526dbdde7') @@ -66,14 +67,19 @@ class Petsc(Package): variant('hypre', default=True, description='Activates support for Hypre (only parallel)') variant('mumps', default=True, - description='Activates support for MUMPS (only parallel)') + description='Activates support for MUMPS (only parallel' + ' and 32bit indices)') variant('superlu-dist', default=True, description='Activates support for SuperluDist (only parallel)') + variant('int64', default=False, + description='Compile with 64bit indices') # Virtual dependencies # Git repository needs sowing to build Fortran interface depends_on('sowing', when='@develop') + # PETSc, hypre, superlu_dist when built with int64 use 32 bit integers + # with BLAS/LAPACK depends_on('blas') depends_on('lapack') depends_on('mpi', when='+mpi') @@ -83,7 +89,8 @@ class Petsc(Package): # Other dependencies depends_on('boost', when='@:3.5+boost') - depends_on('metis@5:', when='+metis') + depends_on('metis@5:~int64', when='+metis~int64') + depends_on('metis@5:+int64', when='+metis+int64') depends_on('hdf5+mpi', when='+hdf5+mpi') depends_on('parmetis', when='+metis+mpi') @@ -91,12 +98,16 @@ class Petsc(Package): # Also PETSc prefer to build it without internal superlu, likely due to # conflict in headers see # https://bitbucket.org/petsc/petsc/src/90564b43f6b05485163c147b464b5d6d28cde3ef/config/BuildSystem/config/packages/hypre.py - depends_on('hypre~internal-superlu', when='+hypre+mpi~complex') - depends_on('superlu-dist@:4.3', when='@3.4.4:3.6.4+superlu-dist+mpi') - depends_on('superlu-dist@5.0.0:', when='@3.7:+superlu-dist+mpi') - depends_on('superlu-dist@5.0.0:', when='@for-pflotran-0.1.0+superlu-dist+mpi') - depends_on('mumps+mpi', when='+mumps+mpi') - depends_on('scalapack', when='+mumps+mpi') + depends_on('hypre~internal-superlu~int64', when='+hypre+mpi~complex~int64') + depends_on('hypre~internal-superlu+int64', when='+hypre+mpi~complex+int64') + depends_on('superlu-dist@:4.3~int64', when='@3.4.4:3.6.4+superlu-dist+mpi~int64') + depends_on('superlu-dist@:4.3+int64', when='@3.4.4:3.6.4+superlu-dist+mpi+int64') + depends_on('superlu-dist@5.0.0:~int64', when='@3.7:+superlu-dist+mpi~int64') + depends_on('superlu-dist@5.0.0:+int64', when='@3.7:+superlu-dist+mpi+int64') + depends_on('superlu-dist@5.0.0:~int64', when='@for-pflotran-0.1.0+superlu-dist+mpi~int64') + depends_on('superlu-dist@5.0.0:+int64', when='@for-pflotran-0.1.0+superlu-dist+mpi+int64') + depends_on('mumps+mpi', when='+mumps+mpi~int64') + depends_on('scalapack', when='+mumps+mpi~int64') def mpi_dependent_options(self): if '~mpi' in self.spec: @@ -145,7 +156,8 @@ def install(self, spec, prefix): '--with-scalar-type=%s' % ( 'complex' if '+complex' in spec else 'real'), '--with-shared-libraries=%s' % ('1' if '+shared' in spec else '0'), - '--with-debugging=%s' % ('1' if '+debug' in spec else '0') + '--with-debugging=%s' % ('1' if '+debug' in spec else '0'), + '--with-64-bit-indices=%s' % ('1' if '+int64' in spec else '0') ]) # Make sure we use exactly the same Blas/Lapack libraries # across the DAG. To that end list them explicitly diff --git a/var/spack/repos/builtin/packages/pgi/package.py b/var/spack/repos/builtin/packages/pgi/package.py index 6fa8457dc9f..e8a2f53497b 100644 --- a/var/spack/repos/builtin/packages/pgi/package.py +++ b/var/spack/repos/builtin/packages/pgi/package.py @@ -39,10 +39,10 @@ class Pgi(Package): set up a mirror, see http://spack.readthedocs.io/en/latest/mirrors.html""" homepage = "http://www.pgroup.com/" - url = "file://%s/pgi-16.3.tar.gz" % os.getcwd() version('16.5', 'a40e8852071b5d600cb42f31631b3de1') version('16.3', '618cb7ddbc57d4e4ed1f21a0ab25f427') + version('15.7', '84a689217b17cdaf78c39270c70bea5d') variant('network', default=True, description="Perform a network install") @@ -64,6 +64,10 @@ class Pgi(Package): license_vars = ['PGROUPD_LICENSE_FILE', 'LM_LICENSE_FILE'] license_url = 'http://www.pgroup.com/doc/pgiinstall.pdf' + def url_for_version(self, version): + return "file://{0}/pgilinux-20{1}-{2}-x86_64.tar.gz".format( + os.getcwd(), version.up_to(1), version.joined) + def install(self, spec, prefix): # Enable the silent installation feature os.environ['PGI_SILENT'] = "true" diff --git a/var/spack/repos/builtin/packages/py-ipdb/package.py b/var/spack/repos/builtin/packages/py-ipdb/package.py new file mode 100644 index 00000000000..ab7982a76a3 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-ipdb/package.py @@ -0,0 +1,58 @@ +############################################################################## +# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://github.com/llnl/spack +# Please also see the LICENSE file for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License (as +# published by the Free Software Foundation) version 2.1, February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +from spack import * + + +class PyIpdb(Package): + """ipdb is the iPython debugger and has many additional features, including + a better interactive debugging experience via colorized output.""" + + homepage = "https://pypi.python.org/pypi/ipdb" + url = "https://pypi.io/packages/source/i/ipdb/ipdb-0.10.1.tar.gz" + + version('0.10.1', '4aeab65f633ddc98ebdb5eebf08dc713') + + # :TODO: + # There might be potential to add variants here, but at the time of writing + # this the original packager does not know what they are. See the 3rd party + # section on ipdb's GitHub: + # https://github.com/gotcha/ipdb#third-party-support + extends('python') + depends_on('python@2.6:2.7,3.2:') + + # Dependencies gathered from: + # https://github.com/gotcha/ipdb/blob/master/setup.py + # However additional dependencies added below were found via testing. + depends_on('py-setuptools', type='build') + # ipdb needs iPython and others available at runtime + depends_on('py-ipython@0.10.2:', type=('build', 'link')) + depends_on('py-traitlets', type=('build', 'link')) + depends_on('py-six', type=('build', 'link')) + depends_on('py-pexpect', type=('build', 'link')) + depends_on('py-prompt-toolkit', type=('build', 'link')) + + def install(self, spec, prefix): + # Installation is uncomplicated, this should suffice. + setup_py('install', '--prefix={0}'.format(prefix)) diff --git a/var/spack/repos/builtin/packages/py-psutil/package.py b/var/spack/repos/builtin/packages/py-psutil/package.py new file mode 100644 index 00000000000..7aa776d2a12 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-psutil/package.py @@ -0,0 +1,43 @@ +############################################################################## +# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://github.com/llnl/spack +# Please also see the LICENSE file for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License (as +# published by the Free Software Foundation) version 2.1, February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +from spack import * + + +class PyPsutil(Package): + """psutil is a cross-platform library for retrieving information on + running processes and system utilization (CPU, memory, disks, network) + in Python.""" + + homepage = "https://pypi.python.org/pypi/psutil" + url = "https://pypi.python.org/packages/d9/c8/8c7a2ab8ec108ba9ab9a4762c5a0d67c283d41b13b5ce46be81fdcae3656/psutil-5.0.1.tar.gz" + + version('5.0.1', '153dc8be94badc4072016ceeac7808dc') + + extends('python') + depends_on('python@2.6:') + depends_on('py-setuptools', type='build') + + def install(self, spec, prefix): + setup_py('install', '--prefix=%s' % prefix) diff --git a/var/spack/repos/builtin/packages/py-sphinx-bootstrap-theme/package.py b/var/spack/repos/builtin/packages/py-sphinx-bootstrap-theme/package.py new file mode 100644 index 00000000000..38f127dfc44 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-sphinx-bootstrap-theme/package.py @@ -0,0 +1,41 @@ +############################################################################## +# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://github.com/llnl/spack +# Please also see the LICENSE file for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License (as +# published by the Free Software Foundation) version 2.1, February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +from spack import * + + +class PySphinxBootstrapTheme(Package): + """Sphinx Bootstrap Theme.""" + + homepage = "https://pypi.python.org/pypi/sphinx-bootstrap-theme/" + url = "https://pypi.io/packages/source/s/sphinx-bootstrap-theme/sphinx-bootstrap-theme-0.4.13.tar.gz" + + version('0.4.13', '32e513a9c8ffbb8c1e4b036e8f74fb51') + + extends('python') + + depends_on('py-setuptools', type='build') + + def install(self, spec, prefix): + setup_py('install', '--prefix={0}'.format(prefix)) diff --git a/var/spack/repos/builtin/packages/superlu-dist/package.py b/var/spack/repos/builtin/packages/superlu-dist/package.py index 7d04673182b..f076358e90e 100644 --- a/var/spack/repos/builtin/packages/superlu-dist/package.py +++ b/var/spack/repos/builtin/packages/superlu-dist/package.py @@ -43,6 +43,9 @@ class SuperluDist(Package): version('4.0', 'c0b98b611df227ae050bc1635c6940e0') version('3.3', 'f4805659157d93a962500902c219046b') + variant('int64', default=False, + description="Use 64bit integers") + depends_on('mpi') depends_on('blas') depends_on('lapack') @@ -66,8 +69,10 @@ def install(self, spec, prefix): 'ARCHFLAGS = cr', 'RANLIB = true', 'CC = {0}'.format(self.spec['mpi'].mpicc), - 'CFLAGS = -fPIC -std=c99 -O2 -I%s -I%s' % ( - spec['parmetis'].prefix.include, spec['metis'].prefix.include), + 'CFLAGS = -fPIC -std=c99 -O2 -I%s -I%s %s' % ( + spec['parmetis'].prefix.include, + spec['metis'].prefix.include, + '-D_LONGINT' if '+int64' in spec else ''), 'NOOPTS = -fPIC -std=c99', 'FORTRAN = {0}'.format(self.spec['mpi'].mpif77), 'F90FLAGS = -O2', diff --git a/var/spack/repos/builtin/packages/tcl/package.py b/var/spack/repos/builtin/packages/tcl/package.py index 16d896acc6c..d9b535305db 100644 --- a/var/spack/repos/builtin/packages/tcl/package.py +++ b/var/spack/repos/builtin/packages/tcl/package.py @@ -25,7 +25,7 @@ from spack import * -class Tcl(Package): +class Tcl(AutotoolsPackage): """Tcl (Tool Command Language) is a very powerful but easy to learn dynamic programming language, suitable for a very wide range of uses, including web and desktop applications, @@ -52,10 +52,10 @@ def setup_environment(self, spack_env, env): env.set('TCL_LIBRARY', join_path(self.prefix.lib, 'tcl{0}'.format( self.spec.version.up_to(2)))) - def install(self, spec, prefix): - with working_dir('unix'): - configure("--prefix={0}".format(prefix)) - make() - make("install") - with working_dir(prefix.bin): + def build_directory(self): + return 'unix' + + @AutotoolsPackage.sanity_check('install') + def symlink_tclsh(self): + with working_dir(self.prefix.bin): symlink('tclsh{0}'.format(self.version.up_to(2)), 'tclsh') diff --git a/var/spack/repos/builtin/packages/tk/package.py b/var/spack/repos/builtin/packages/tk/package.py index 1abcd26a240..071db04e635 100644 --- a/var/spack/repos/builtin/packages/tk/package.py +++ b/var/spack/repos/builtin/packages/tk/package.py @@ -25,7 +25,7 @@ from spack import * -class Tk(Package): +class Tk(AutotoolsPackage): """Tk is a graphical user interface toolkit that takes developing desktop applications to a higher level than conventional approaches. Tk is the standard GUI not only for Tcl, but for @@ -46,15 +46,15 @@ def url_for_version(self, version): base_url = "http://prdownloads.sourceforge.net/tcl" return "{0}/tk{1}-src.tar.gz".format(base_url, version) - def setup_environment(self, spack_env, env): + 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 TK_LIBRARY is set. - env.set('TK_LIBRARY', join_path(self.prefix.lib, 'tk{0}'.format( - self.spec.version.up_to(2)))) + run_env.set('TK_LIBRARY', join_path(self.prefix.lib, 'tk{0}'.format( + self.spec.version.up_to(2)))) - def install(self, spec, prefix): - with working_dir('unix'): - configure("--prefix={0}".format(prefix), - "--with-tcl={0}".format(spec['tcl'].prefix.lib)) - make() - make("install") + def build_directory(self): + return 'unix' + + def configure_args(self): + spec = self.spec + return ['--with-tcl={0}'.format(spec['tcl'].prefix.lib)] diff --git a/var/spack/repos/builtin/packages/trilinos/package.py b/var/spack/repos/builtin/packages/trilinos/package.py index 7558430953c..4b3412ce7af 100644 --- a/var/spack/repos/builtin/packages/trilinos/package.py +++ b/var/spack/repos/builtin/packages/trilinos/package.py @@ -90,8 +90,6 @@ def url_for_version(self, version): description='Builds a debug version of the libraries') variant('boost', default=True, description='Compile with Boost') - depends_on('cmake', type='build') - # Everything should be compiled with -fpic depends_on('blas') depends_on('lapack') diff --git a/var/spack/repos/builtin/packages/visit/package.py b/var/spack/repos/builtin/packages/visit/package.py index ba1224daee1..48a3762a2a7 100644 --- a/var/spack/repos/builtin/packages/visit/package.py +++ b/var/spack/repos/builtin/packages/visit/package.py @@ -44,7 +44,6 @@ class Visit(Package): def install(self, spec, prefix): qt_bin = spec['qt'].prefix.bin - python_bin = spec['python'].prefix.bin with working_dir('spack-build', create=True): cmake_args = std_cmake_args[:] @@ -53,7 +52,7 @@ def install(self, spec, prefix): '-DVTK_MINOR_VERSION=1', '-DVISIT_USE_GLEW=OFF', '-DVISIT_LOC_QMAKE_EXE:FILEPATH={0}/qmake-qt4'.format(qt_bin), - '-DPYTHON_EXECUTABLE:FILEPATH={0}/python'.format(python_bin), + '-DPYTHON_DIR:PATH={0}'.format(spec['python'].prefix), '-DVISIT_SILO_DIR:PATH={0}'.format(spec['silo'].prefix), '-DVISIT_HDF5_DIR:PATH={0}'.format(spec['hdf5'].prefix), '-DVISIT_VTK_DIR:PATH={0}'.format(spec['vtk'].prefix), diff --git a/var/spack/repos/builtin/packages/xsdktrilinos/package.py b/var/spack/repos/builtin/packages/xsdktrilinos/package.py index 7aea15ed9cd..ea490544354 100644 --- a/var/spack/repos/builtin/packages/xsdktrilinos/package.py +++ b/var/spack/repos/builtin/packages/xsdktrilinos/package.py @@ -28,7 +28,7 @@ class Xsdktrilinos(CMakePackage): """xSDKTrilinos contains the portions of Trilinos that depend on PETSc - because they would cause a circular dependency if built as part of + because they would cause a circular dependency if built as part of Trilinos. """ homepage = "https://trilinos.org/" @@ -51,8 +51,6 @@ def url_for_version(self, version): variant('debug', default=False, description='Builds a debug version of the libraries') - depends_on('cmake', type='build') - # MPI related dependencies depends_on('mpi') depends_on('hypre~internal-superlu', when='+hypre') diff --git a/var/spack/repos/builtin/packages/zlib/package.py b/var/spack/repos/builtin/packages/zlib/package.py index a20f6ff802b..ea758e01889 100644 --- a/var/spack/repos/builtin/packages/zlib/package.py +++ b/var/spack/repos/builtin/packages/zlib/package.py @@ -23,7 +23,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from spack import * -from os import environ class Zlib(AutotoolsPackage): @@ -35,17 +34,13 @@ class Zlib(AutotoolsPackage): version('1.2.10', 'd9794246f853d15ce0fcbf79b9a3cf13') # author had this to say about 1.2.9.... - # Due to the bug fixes, any installations of 1.2.9 should be immediately + # Due to the bug fixes, any installations of 1.2.9 should be immediately # replaced with 1.2.10. version('1.2.8', '44d667c142d7cda120332623eab69f40') variant('pic', default=True, description='Produce position-independent code (for shared libs)') - def configure(self, spec, prefix): - - if '+pic' in spec: - environ['CFLAGS'] = self.compiler.pic_flag - - config_args = ['--prefix', prefix] - configure(*config_args) + def setup_environment(self, spack_env, run_env): + if '+pic' in self.spec: + spack_env.set('CFLAGS', self.compiler.pic_flag)