Compare commits

...

20 Commits

Author SHA1 Message Date
Matthew Krafczyk
51cbe48cb5 Add first working version of enzo 2017-02-09 16:21:02 -06:00
Matthew Krafczyk
daf50693bf Update openssl package 2017-02-09 16:20:49 -06:00
Matthew Krafczyk
c2375d0ab6 Add completion file for bash 2017-02-08 17:04:39 -06:00
Matthew Krafczyk
2f6027486d Add version of environment modules which does not depend on X windows 2017-02-08 16:28:50 -06:00
Matthew Krafczyk
3c4959f666 No longer automatically install bootstrap packages.
Source spack-env.sh to execute spack bootstrap. Then source
spack-env.sh again to get module functionality.
2017-02-08 16:25:42 -06:00
Matthew Krafczyk
c0ee44bf27 Moved bootstrap to clone, new implementation of bootstrap
spack clone now contains the functionality of the old spack bootstrap.
spack bootstrap now installs needed packages for full functionality. A
list 'needed_specs' contains a list of specs for these packages and can
be expanded when more packages are recognized to be needed.
2017-02-08 16:25:39 -06:00
Matthew Krafczyk
4eb7b241c6 Add code to automatically build and enable module
If the module command doesn't exist in the shell, automatically build a
version which doesn't depend on X windows and create the module
function for the appropriate shell.
2017-02-08 16:24:54 -06:00
Matthew Krafczyk
81424dce5c Merge branch 'workaround/yt-py-pillow' into yt-dev-working-branch 2017-01-17 15:32:30 -06:00
Matthew Krafczyk
65be1a93f1 Merge branch 'update/yt-rockstar' into yt-dev-working-branch 2017-01-17 15:31:49 -06:00
Matthew Krafczyk
e2d4dadf33 Merge branch 'update/dev-yt' into yt-dev-working-branch 2017-01-17 15:31:14 -06:00
Matthew Krafczyk
67bfb782ef Merge branch 'new-package/rockstar' into yt-dev-working-branch 2017-01-17 15:30:59 -06:00
Matthew Krafczyk
40cbe69897 Fix installation of rockstar. 2017-01-17 15:28:57 -06:00
Matthew Krafczyk
fa39273e1f Correct how rockstar prefix is found and written to file 2017-01-16 12:04:52 -05:00
Matthew Krafczyk
ef32f3880f Add rockstar support to py-yt package 2017-01-16 12:04:51 -05:00
Matthew Krafczyk
31f7a01a9d Correct rockstar package installation process
Needed to change the way the necessary prefixes are found as well as
how the completed package is copied.

There should probably be a way to do the copying in a more 'spack' way.
2017-01-16 11:29:37 -05:00
Matthew Krafczyk
d74309a7b7 Correct how rockstar prefix is found and written to file 2017-01-16 11:29:37 -05:00
Matthew Krafczyk
190bd6ca65 Create rockstar package
rockstar is a halo finding algorithm
2017-01-16 11:29:37 -05:00
Matthew Krafczyk
209eb83d0d Add a +devmode variant to yt
When specifying +devmode when installing yt, a link to the source
directory will be used instead of creating an egg. This eases the
development process as changes you make in the yt source directory will
be instantly available when building the package as a diy.
2017-01-16 11:26:26 -05:00
Matthew Krafczyk
f10c3ca55e Add py-pillow explicit dependency 2017-01-16 11:25:45 -05:00
Matthew Krafczyk
dcab47cdc0 Add -d and -j options to diy
Also add -j to the common arguments
2017-01-16 11:16:36 -05:00
13 changed files with 1490 additions and 74 deletions

View File

@@ -22,84 +22,71 @@
# 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 argparse
import os
import llnl.util.filesystem as fs
import llnl.util.tty as tty
from llnl.util.filesystem import join_path, mkdirp
import spack
from spack.util.executable import ProcessError, which
import spack.cmd
import spack.cmd.common.arguments as arguments
from spack.build_environment import InstallError
from spack.fetch_strategy import FetchError
from spack.package import PackageBase
_SPACK_UPSTREAM = 'https://github.com/llnl/spack'
description = "Create a new installation of spack in another prefix"
from spack.util.executable import which
description = "bootstrap packages needed for spack to run smoothly."
def setup_parser(subparser):
subparser.add_argument(
'-r', '--remote', action='store', dest='remote',
help="name of the remote to bootstrap from", default='origin')
'-j', '--jobs', action='store', type=int,
help="explicitly set number of make jobs. default is #cpus")
subparser.add_argument(
'prefix',
help="names of prefix where we should install spack")
'--keep-prefix', action='store_true', dest='keep_prefix',
help="don't remove the install prefix if installation fails")
subparser.add_argument(
'--keep-stage', action='store_true', dest='keep_stage',
help="don't remove the build stage if installation succeeds")
subparser.add_argument(
'-n', '--no-checksum', action='store_true', dest='no_checksum',
help="do not check packages against checksum")
subparser.add_argument(
'-v', '--verbose', action='store_true', dest='verbose',
help="display verbose build output while installing")
cd_group = subparser.add_mutually_exclusive_group()
arguments.add_common_arguments(cd_group, ['clean', 'dirty'])
subparser.add_argument(
'--run-tests', action='store_true', dest='run_tests',
help="run package level tests during installation"
)
def get_origin_info(remote):
git_dir = join_path(spack.prefix, '.git')
git = which('git', required=True)
try:
branch = git('symbolic-ref', '--short', 'HEAD', output=str)
except ProcessError:
branch = 'develop'
tty.warn('No branch found; using default branch: %s' % branch)
if remote == 'origin' and \
branch not in ('master', 'develop'):
branch = 'develop'
tty.warn('Unknown branch found; using default branch: %s' % branch)
try:
origin_url = git(
'--git-dir=%s' % git_dir,
'config', '--get', 'remote.%s.url' % remote,
output=str)
except ProcessError:
origin_url = _SPACK_UPSTREAM
tty.warn('No git repository found; '
'using default upstream URL: %s' % origin_url)
return (origin_url.strip(), branch.strip())
def bootstrap(parser, args, **kwargs):
kwargs.update({
'keep_prefix': args.keep_prefix,
'keep_stage': args.keep_stage,
'install_deps': 'dependencies',
'make_jobs': args.jobs,
'run_tests': args.run_tests,
'verbose': args.verbose,
'dirty': args.dirty
})
#Define list of specs which need to be installed
needed_specs = ['environment-modules~X']
def bootstrap(parser, args):
origin_url, branch = get_origin_info(args.remote)
prefix = args.prefix
tty.msg("Fetching spack from '%s': %s" % (args.remote, origin_url))
if os.path.isfile(prefix):
tty.die("There is already a file at %s" % prefix)
mkdirp(prefix)
if os.path.exists(join_path(prefix, '.git')):
tty.die("There already seems to be a git repository in %s" % prefix)
files_in_the_way = os.listdir(prefix)
if files_in_the_way:
tty.die("There are already files there! "
"Delete these files before boostrapping spack.",
*files_in_the_way)
tty.msg("Installing:",
"%s/bin/spack" % prefix,
"%s/lib/spack/..." % prefix)
os.chdir(prefix)
git = which('git', required=True)
git('init', '--shared', '-q')
git('remote', 'add', 'origin', origin_url)
git('fetch', 'origin', '%s:refs/remotes/origin/%s' % (branch, branch),
'-n', '-q')
git('reset', '--hard', 'origin/%s' % branch, '-q')
git('checkout', '-B', branch, 'origin/%s' % branch, '-q')
tty.msg("Successfully created a new spack in %s" % prefix,
"Run %s/bin/spack to use this installation." % prefix)
for needed_spec in needed_specs:
tty.msg("Need %s" % needed_spec)
installed_specs = spack.store.db.query(needed_spec)
if(len(installed_specs) == 0):
possible_specs = spack.cmd.parse_specs(needed_spec, concretize=True)
spec = possible_specs[0]
tty.msg("Installing %s to satisfy need for %s" % (spec, needed_spec))
kwargs['explicit'] = True
package = spack.repo.get(spec)
package.do_install(**kwargs)
else:
tty.msg("%s Already Installed" % needed_spec)

View File

@@ -0,0 +1,105 @@
##############################################################################
# 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 os
import llnl.util.tty as tty
from llnl.util.filesystem import join_path, mkdirp
import spack
from spack.util.executable import ProcessError, which
_SPACK_UPSTREAM = 'https://github.com/llnl/spack'
description = "create a new installation of spack in another prefix"
def setup_parser(subparser):
subparser.add_argument(
'-r', '--remote', action='store', dest='remote',
help="name of the remote to clone from", default='origin')
subparser.add_argument(
'prefix',
help="names of prefix where we should install spack")
def get_origin_info(remote):
git_dir = join_path(spack.prefix, '.git')
git = which('git', required=True)
try:
branch = git('symbolic-ref', '--short', 'HEAD', output=str)
except ProcessError:
branch = 'develop'
tty.warn('No branch found; using default branch: %s' % branch)
if remote == 'origin' and \
branch not in ('master', 'develop'):
branch = 'develop'
tty.warn('Unknown branch found; using default branch: %s' % branch)
try:
origin_url = git(
'--git-dir=%s' % git_dir,
'config', '--get', 'remote.%s.url' % remote,
output=str)
except ProcessError:
origin_url = _SPACK_UPSTREAM
tty.warn('No git repository found; '
'using default upstream URL: %s' % origin_url)
return (origin_url.strip(), branch.strip())
def clone(parser, args):
origin_url, branch = get_origin_info(args.remote)
prefix = args.prefix
tty.msg("Fetching spack from '%s': %s" % (args.remote, origin_url))
if os.path.isfile(prefix):
tty.die("There is already a file at %s" % prefix)
mkdirp(prefix)
if os.path.exists(join_path(prefix, '.git')):
tty.die("There already seems to be a git repository in %s" % prefix)
files_in_the_way = os.listdir(prefix)
if files_in_the_way:
tty.die("There are already files there! "
"Delete these files before boostrapping spack.",
*files_in_the_way)
tty.msg("Installing:",
"%s/bin/spack" % prefix,
"%s/lib/spack/..." % prefix)
os.chdir(prefix)
git = which('git', required=True)
git('init', '--shared', '-q')
git('remote', 'add', 'origin', origin_url)
git('fetch', 'origin', '%s:refs/remotes/origin/%s' % (branch, branch),
'-n', '-q')
git('reset', '--hard', 'origin/%s' % branch, '-q')
git('checkout', '-B', branch, 'origin/%s' % branch, '-q')
tty.msg("Successfully created a new spack in %s" % prefix,
"Run %s/bin/spack to use this installation." % prefix)

View File

@@ -105,3 +105,7 @@ def _specs(self, **kwargs):
_arguments['very_long'] = Args(
'-L', '--very-long', action='store_true',
help='Show full dependency hashes as well as versions.')
_arguments['jobs'] = Args(
'-j', '--jobs', action='store', type=int, dest="jobs",
help="Explicitly set number of make jobs. Default is #cpus.")

View File

@@ -38,6 +38,10 @@
def setup_parser(subparser):
arguments.add_common_arguments(subparser, ['jobs'])
subparser.add_argument(
'-d', '--source-path', dest='source_path', default=None,
help="Path to the source directory. Defaults to the current directory")
subparser.add_argument(
'-i', '--ignore-dependencies', action='store_true', dest='ignore_deps',
help="Do not try to install dependencies of requested packages.")
@@ -62,6 +66,10 @@ def diy(self, args):
if not args.spec:
tty.die("spack diy requires a package spec argument.")
if args.jobs is not None:
if args.jobs <= 0:
tty.die("The -j option must be a positive integer!")
specs = spack.cmd.parse_specs(args.spec)
if len(specs) > 1:
tty.die("spack diy only takes one spec.")
@@ -91,13 +99,19 @@ def diy(self, args):
tty.msg("Uninstall or try adding a version suffix for this DIY build.")
sys.exit(1)
source_path = args.source_path
if source_path is None:
source_path = os.getcwd()
source_path = os.path.abspath(source_path)
# Forces the build to run out of the current directory.
package.stage = DIYStage(os.getcwd())
package.stage = DIYStage(source_path)
# TODO: make this an argument, not a global.
spack.do_checksum = False
package.do_install(
make_jobs=args.jobs,
keep_prefix=args.keep_prefix,
install_deps=not args.ignore_deps,
verbose=not args.quiet,

View File

@@ -54,9 +54,7 @@ def setup_parser(subparser):
Alternatively one can decide to install only the package or only
the dependencies."""
)
subparser.add_argument(
'-j', '--jobs', action='store', type=int,
help="Explicitly set number of make jobs. Default is #cpus.")
arguments.add_common_arguments(subparser, ['jobs'])
subparser.add_argument(
'--keep-prefix', action='store_true', dest='keep_prefix',
help="Don't remove the install prefix if installation fails.")

View File

@@ -27,7 +27,9 @@
#
# This file is part of Spack and sets up the spack environment for
# bash and zsh. This includes dotkit support, module support, and
# it also puts spack in your path. Source it like this:
# it also puts spack in your path. The script also checks that
# at least module support exists, and builds and enables it if it
# doesn't. Source it like this:
#
# . /path/to/spack/share/spack/setup-env.sh
#
@@ -182,14 +184,66 @@ if [ -z "$_sp_source_file" ]; then
fi
#
# Set up modules and dotkit search paths in the user environment
# Find root directory and add bin to path.
#
_sp_share_dir=$(cd "$(dirname $_sp_source_file)" && pwd)
_sp_prefix=$(cd "$(dirname $(dirname $_sp_share_dir))" && pwd)
_spack_pathadd PATH "${_sp_prefix%/}/bin"
export SPACK_ROOT=${_sp_prefix}
#
#
# Determine which shell is being used
#
function _spack_determine_shell() {
ps -p $$ | tail -n 1 | awk '{print $4}' | xargs basename
}
export SPACK_SHELL=$(_spack_determine_shell)
#
# Check whether at least one of 'use' and 'module' exists
#
function _spack_fn_exists() {
type $1 2>&1 | grep -q 'shell function'
}
need_module="no"
if [ ! $(_spack_fn_exists use) ]; then
if [ ! $(_spack_fn_exists module) ]; then
need_module="yes"
fi;
fi;
#
# build and make available environment-modules
#
if [ "${need_module}" = "yes" ]; then
#check if environment-modules~X is installed
module_prefix=`spack location -i environment-modules~X 2>&1`
if [ $? -eq 0 ]; then
#activate it!
export MODULE_PREFIX=${module_prefix}
module() { eval `${MODULE_PREFIX}/Modules/bin/modulecmd ${SPACK_SHELL} $*`; }
fi;
fi;
#
# Set up modules and dotkit search paths in the user environment
#
_sp_sys_type=$(spack-python -c 'print(spack.architecture.sys_type())')
_sp_dotkit_root=$(spack-python -c "print(spack.util.path.canonicalize_path(spack.config.get_config('config').get('module_roots', {}).get('dotkit')))")
_sp_tcl_root=$(spack-python -c "print(spack.util.path.canonicalize_path(spack.config.get_config('config').get('module_roots', {}).get('tcl')))")
_spack_pathadd DK_NODE "${_sp_dotkit_root%/}/$_sp_sys_type"
_spack_pathadd MODULEPATH "${_sp_tcl_root%/}/$_sp_sys_type"
# Export spack function so it is available in subshells (only works with bash)
if [ -n "${BASH_VERSION:-}" ]; then
export -f spack
fi
# Add programmable tab completion for Bash
#
if [ -n "${BASH_VERSION:-}" ]; then
source $_sp_share_dir/spack-completion.bash
fi

932
share/spack/spack-completion.bash Executable file
View File

@@ -0,0 +1,932 @@
##############################################################################
# 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
##############################################################################
# The following global variables are used/set by Bash programmable completion
# COMP_CWORD: An index into ${COMP_WORDS} of the word containing the
# current cursor position
# COMP_LINE: The current command line
# COMP_WORDS: an array containing individual command arguments typed so far
# COMPREPLY: an array containing possible completions as a result of your
# function
# Bash programmable completion for Spack
function _bash_completion_spack {
# In all following examples, let the cursor be denoted by brackets, i.e. []
# For our purposes, flags should not affect tab completion. For instance,
# `spack install []` and `spack -d install --jobs 8 []` should both give the same
# possible completions. Therefore, we need to ignore any flags in COMP_WORDS.
local COMP_WORDS_NO_FLAGS=()
local index=0
while [[ "$index" -lt "$COMP_CWORD" ]]
do
if [[ "${COMP_WORDS[$index]}" == [a-z]* ]]
then
COMP_WORDS_NO_FLAGS+=("${COMP_WORDS[$index]}")
fi
let index++
done
# Options will be listed by a subfunction named after non-flag arguments.
# For example, `spack -d install []` will call _spack_install
# and `spack compiler add []` will call _spack_compiler_add
local subfunction=$(IFS='_'; echo "_${COMP_WORDS_NO_FLAGS[*]}")
# However, the word containing the current cursor position needs to be
# added regardless of whether or not it is a flag. This allows us to
# complete something like `spack install --keep-st[]`
COMP_WORDS_NO_FLAGS+=("${COMP_WORDS[$COMP_CWORD]}")
# Since we have removed all words after COMP_CWORD, we can safely assume
# that COMP_CWORD_NO_FLAGS is simply the index of the last element
local COMP_CWORD_NO_FLAGS=$(( ${#COMP_WORDS_NO_FLAGS[@]} - 1 ))
# There is no guarantee that the cursor is at the end of the command line
# when tab completion is envoked. For example, in the following situation:
# `spack -d [] install`
# if the user presses the TAB key, a list of valid flags should be listed.
# Note that we cannot simply ignore everything after the cursor. In the
# previous scenario, the user should expect to see a list of flags, but
# not of other subcommands. Obviously, `spack -d list install` would be
# invalid syntax. To accomplish this, we use the variable list_options
# which is true if the current word starts with '-' or if the cursor is
# not at the end of the line.
local list_options=false
if [[ "${COMP_WORDS[$COMP_CWORD]}" == -* || \
"$COMP_CWORD" -ne "${#COMP_WORDS[@]}-1" ]]
then
list_options=true
fi
# In general, when envoking tab completion, the user is not expecting to
# see optional flags mixed in with subcommands or package names. Tab
# completion is used by those who are either lazy or just bad at spelling.
# If someone doesn't remember what flag to use, seeing single letter flags
# in their results won't help them, and they should instead consult the
# documentation. However, if the user explicitly declares that they are
# looking for a flag, we can certainly help them out.
# `spack install -[]`
# and
# `spack install --[]`
# should list all flags and long flags, respectively. Furthermore, if a
# subcommand has no non-flag completions, such as `spack arch []`, it
# should list flag completions.
local cur=${COMP_WORDS_NO_FLAGS[$COMP_CWORD_NO_FLAGS]}
local prev=${COMP_WORDS_NO_FLAGS[$COMP_CWORD_NO_FLAGS-1]}
#_test_vars
# Make sure function exists before calling it
if [[ "$(type -t $subfunction)" == "function" ]]
then
COMPREPLY=($($subfunction))
fi
}
# Spack commands
function _spack {
if $list_options
then
compgen -W "-h --help -d --debug -D --pdb -k --insecure -m --mock -p
--profile -v --verbose -s --stacktrace -V --version" -- "$cur"
else
compgen -W "$(_subcommands)" -- "$cur"
fi
}
function _spack_activate {
if $list_options
then
compgen -W "-h --help -f --force" -- "$cur"
else
compgen -W "$(_installed_packages)" -- "$cur"
fi
}
function _spack_arch {
compgen -W "-h --help -p --platform" -- "$cur"
}
function _spack_bootstrap {
# FIXME: What does this command even do?
if $list_options
then
compgen -W "-h --help -r --remote" -- "$cur"
else
compgen -o dirnames -- "$cur"
fi
}
function _spack_build {
if $list_options
then
compgen -W "-h --help -v --verbose" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_cd {
if $list_options
then
compgen -W "-h --help -m --module-dir -r --spack-root -i --install-dir
-p --package-dir -P --packages -s --stage-dir -S --stages
-b --build-dir" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_checksum {
if $list_options
then
compgen -W "-h --help --keep-stage" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_clean {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_compiler {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "find add remove rm list info" -- "$cur"
fi
}
function _spack_compiler_add {
if $list_options
then
compgen -W "-h --help --scope" -- "$cur"
else
compgen -o dirnames -- "$cur"
fi
}
function _spack_compiler_find {
# Alias to `spack compiler add`
_spack_compiler_add
}
function _spack_compiler_info {
if $list_options
then
compgen -W "-h --help --scope" -- "$cur"
else
compgen -W "$(_installed_compilers)" -- "$cur"
fi
}
function _spack_compiler_list {
compgen -W "-h --help --scope" -- "$cur"
}
function _spack_compiler_remove {
if $list_options
then
compgen -W "-h --help -a --all --scope" -- "$cur"
else
compgen -W "$(_installed_compilers)" -- "$cur"
fi
}
function _spack_compiler_rm {
# Alias to `spack compiler remove`
_spack_compiler_remove
}
function _spack_compilers {
compgen -W "-h --help --scope" -- "$cur"
}
function _spack_config {
if $list_options
then
compgen -W "-h --help --scope" -- "$cur"
else
compgen -W "edit get" -- "$cur"
fi
}
function _spack_config_edit {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "mirrors repos modules packages config compilers" -- "$cur"
fi
}
function _spack_config_get {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "mirrors repos modules packages config compilers" -- "$cur"
fi
}
function _spack_configure {
if $list_options
then
compgen -W "-h --help -v --verbose" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_create {
compgen -W "-h --help --keep-stage -n --name -t --template -r --repo
-N --namespace -f --force" -- "$cur"
}
function _spack_deactivate {
if $list_options
then
compgen -W "-h --help -f --force -a --all" -- "$cur"
else
compgen -W "$(_installed_packages)" -- "$cur"
fi
}
function _spack_debug {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "create-db-tarball" -- "$cur"
fi
}
function _spack_create-db-tarball {
compgen -W "-h --help" -- "$cur"
}
function _spack_dependents {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_diy {
if $list_options
then
compgen -W "-h --help -i --ignore-dependencies --keep-prefix
--skip-patch -q --quiet --clean --dirty" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_doc {
# FIXME: What does this command even do?
compgen -W "-h --help" -- "$cur"
}
function _spack_edit {
if $list_options
then
compgen -W "-h --help -b --build-system -c --command -t --test -m --module
-r --repo -N --namespace" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_env {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_extensions {
if $list_options
then
compgen -W "-h --help -l --long -p --paths -d --deps" -- "$cur"
else
compgen -W "go-bootstrap go lua octave python r ruby rust" -- "$cur"
fi
}
function _spack_fetch {
if $list_options
then
compgen -W "-h --help -n --no-checksum -m --missing
-D --dependencies" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_find {
if $list_options
then
compgen -W "-h --help -s --short -p --paths -d --deps -l --long
-L --very-long -f --show-flags -e --explicit
-E --implicit -u --unknown -m --missing -v --variants
-M --only-missing -N --namespace" -- "$cur"
else
compgen -W "$(_installed_packages)" -- "$cur"
fi
}
function _spack_flake8 {
if $list_options
then
compgen -W "-h --help -k --keep-temp -o --output
-r --root-relative -U --no-untracked" -- "$cur"
else
compgen -o filenames -- "$cur"
fi
}
function _spack_graph {
if $list_options
then
compgen -W "-h --help -a --ascii -d --dot -n --normalize -s --static
-i --installed -t --deptype" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_help {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "$(_subcommands)" -- "$cur"
fi
}
function _spack_info {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_install {
if $list_options
then
compgen -W "-h --help --only -j --jobs --keep-prefix --keep-stage
-n --no-checksum -v --verbose --fake --clean --dirty
--run-tests --log-format --log-file" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_list {
if $list_options
then
compgen -W "-h --help -d --search-description --format" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_load {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "$(_installed_packages)" -- "$cur"
fi
}
function _spack_location {
if $list_options
then
compgen -W "-h --help -m --module-dir -r --spack-root -i --install-dir
-p --package-dir -P --packages -s --stage-dir -S --stages
-b --build-dir" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_md5 {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -o filenames -- "$cur"
fi
}
function _spack_mirror {
if $list_options
then
compgen -W "-h --help -n --no-checksum" -- "$cur"
else
compgen -W "add create list remove rm" -- "$cur"
fi
}
function _spack_mirror_add {
if $list_options
then
compgen -W "-h --help --scope" -- "$cur"
else
compgen -o dirnames -- "$cur"
fi
}
function _spack_mirror_create {
if $list_options
then
compgen -W "-h --help -d --directory -f --file
-D --dependencies -o --one-version-per-spec" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_mirror_list {
compgen -W "-h --help --scope" -- "$cur"
}
function _spack_mirror_remove {
if $list_options
then
compgen -W "-h --help --scope" -- "$cur"
else
compgen -W "$(_mirrors)" -- "$cur"
fi
}
function _spack_module {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "find loads refresh rm" -- "$cur"
fi
}
function _spack_module_find {
if $list_options
then
compgen -W "-h --help -m --module-type" -- "$cur"
else
compgen -W "$(_installed_packages)" -- "$cur"
fi
}
function _spack_module_loads {
if $list_options
then
compgen -W "-h --help --input-only -p --prefix -x --exclude
-m --module-type -r --dependencies" -- "$cur"
else
compgen -W "$(_installed_packages)" -- "$cur"
fi
}
function _spack_module_refresh {
if $list_options
then
compgen -W "-h --help --delete-tree -m --module-type
-y --yes-to-all" -- "$cur"
else
compgen -W "$(_installed_packages)" -- "$cur"
fi
}
function _spack_module_rm {
if $list_options
then
compgen -W "-h --help -m --module-type -y --yes-to-all" -- "$cur"
else
compgen -W "$(_installed_packages)" -- "$cur"
fi
}
function _spack_patch {
if $list_options
then
compgen -W "-h --help -n --no-checksum" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_pkg {
# FIXME: What does this subcommand even do?
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "add added diff list removed" -- "$cur"
fi
}
function _spack_pkg_add {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_pkg_added {
# FIXME: How to list git revisions?
compgen -W "-h --help" -- "$cur"
}
function _spack_pkg_diff {
# FIXME: How to list git revisions?
compgen -W "-h --help" -- "$cur"
}
function _spack_pkg_list {
# FIXME: How to list git revisions?
compgen -W "-h --help" -- "$cur"
}
function _spack_pkg_removed {
# FIXME: How to list git revisions?
compgen -W "-h --help" -- "$cur"
}
function _spack_providers {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "blas daal elf golang ipp lapack mkl
mpe mpi pil scalapack" -- "$cur"
fi
}
function _spack_purge {
compgen -W "-h --help -s --stage -d --downloads
-m --misc-cache -a --all" -- "$cur"
}
function _spack_python {
if $list_options
then
compgen -W "-h --help -c" -- "$cur"
else
compgen -o filenames -- "$cur"
fi
}
function _spack_reindex {
compgen -W "-h --help" -- "$cur"
}
function _spack_repo {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "add create list remove rm" -- "$cur"
fi
}
function _spack_repo_add {
if $list_options
then
compgen -W "-h --help --scope" -- "$cur"
else
compgen -o dirnames -- "$cur"
fi
}
function _spack_repo_create {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -o dirnames -- "$cur"
fi
}
function _spack_repo_list {
compgen -W "-h --help --scope" -- "$cur"
}
function _spack_repo_remove {
if $list_options
then
compgen -W "-h --help --scope" -- "$cur"
else
compgen -W "$(_repos)" -- "$cur"
fi
}
function _spack_repo_rm {
# Alias to `spack repo remove`
_spack_repo_remove
}
function _spack_restage {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_setup {
if $list_options
then
compgen -W "-h --help -i --ignore-dependencies -v --verbose
--clean --dirty" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_spec {
if $list_options
then
compgen -W "-h --help -l --long -L --very-long -y --yaml -c --cover
-N --namespaces -I --install-status -t --types" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_stage {
if $list_options
then
compgen -W "-h --help -n --no-checksum -p --path" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_test {
if $list_options
then
compgen -W "-h --help -H --pytest-help -l --list
-L --long-list" -- "$cur"
else
compgen -W "$(_tests)" -- "$cur"
fi
}
function _spack_uninstall {
if $list_options
then
compgen -W "-h --help -f --force -a --all -d --dependents
-y --yes-to-all" -- "$cur"
else
compgen -W "$(_installed_packages)" -- "$cur"
fi
}
function _spack_unload {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "$(_installed_packages)"
fi
}
function _spack_unuse {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "$(_installed_packages)"
fi
}
function _spack_url {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "list parse test" -- "$cur"
fi
}
function _spack_url_list {
compgen -W "-h --help -c --color -e --extrapolation -n --incorrect-name
-v --incorrect-version" -- "$cur"
}
function _spack_url_parse {
compgen -W "-h --help -s --spider" -- "$cur"
}
function _spack_url_test {
compgen -W "-h --help" -- "$cur"
}
function _spack_use {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "$(_installed_packages)" -- "$cur"
fi
}
function _spack_versions {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_view {
if $list_options
then
compgen -W "-h --help -v --verbose -e --exclude
-d --dependencies" -- "$cur"
else
compgen -W "add check hard hardlink remove rm soft
statlink status symlink" -- "$cur"
fi
}
function _spack_view_add {
# Alias for `spack view symlink`
_spack_view_symlink
}
function _spack_view_check {
# Alias for `spack view statlink`
_spack_view_statlink
}
function _spack_view_hard {
# Alias for `spack view hardlink`
_spack_view_hardlink
}
function _spack_view_hardlink {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -o dirnames -- "$cur"
fi
}
function _spack_view_remove {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -o dirnames -- "$cur"
fi
}
function _spack_view_rm {
# Alias for `spack view remove`
_spack_view_remove
}
function _spack_view_soft {
# Alias for `spack view symlink`
_spack_view_symlink
}
function _spack_view_statlink {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -o dirnames -- "$cur"
fi
}
function _spack_view_status {
# Alias for `spack view statlink`
_spack_view_statlink
}
function _spack_view_symlink {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -o dirnames -- "$cur"
fi
}
# Helper functions for subcommands
function _subcommands {
spack help | grep "^ [a-z]" | awk '{print $1}'
}
function _all_packages {
spack list
}
function _installed_packages {
# Perl one-liner used to strip out color codes
spack find | grep -v "^--" | perl -pe 's/\e\[?.*?[\@-~]//g'
}
function _installed_compilers {
spack compilers | egrep -v "^(-|=)"
}
function _mirrors {
spack mirror list | awk '{print $1}'
}
function _repos {
spack repo list | awk '{print $1}'
}
function _tests {
spack test -l
}
# Testing functions
function _test_vars {
echo "-----------------------------------------------------" >> temp
echo "Full line: '$COMP_LINE'" >> temp
echo >> temp
echo "Word list w/ flags: $(_pretty_print COMP_WORDS[@])" >> temp
echo "# words w/ flags: '${#COMP_WORDS[@]}'" >> temp
echo "Cursor index w/ flags: '$COMP_CWORD'" >> temp
echo >> temp
echo "Word list w/out flags: $(_pretty_print COMP_WORDS_NO_FLAGS[@])" >> temp
echo "# words w/out flags: '${#COMP_WORDS_NO_FLAGS[@]}'" >> temp
echo "Cursor index w/out flags: '$COMP_CWORD_NO_FLAGS'" >> temp
echo >> temp
echo "Subfunction: '$subfunction'" >> temp
if $list_options
then
echo "List options: 'True'" >> temp
else
echo "List options: 'False'" >> temp
fi
echo "Current word: '$cur'" >> temp
echo "Previous word: '$prev'" >> temp
}
# Pretty-prints one or more arrays
# Syntax: _pretty_print array1[@] ...
function _pretty_print {
for arg in $@
do
local array=("${!arg}")
echo -n "$arg: ["
printf "'%s'" "${array[0]}"
printf ", '%s'" "${array[@]:1}"
echo "]"
done
}
complete -F _bash_completion_spack spack

View File

@@ -34,6 +34,8 @@ class EnvironmentModules(Package):
url = "http://prdownloads.sourceforge.net/modules/modules-3.2.10.tar.gz"
version('3.2.10', '8b097fdcb90c514d7540bb55a3cb90fb')
variant('X', default=True, description='Build with X functionality')
# Dependencies:
depends_on('tcl', type=('build', 'link', 'run'))
@@ -74,6 +76,9 @@ def install(self, spec, prefix):
'--datarootdir=' + prefix.share,
'CPPFLAGS=' + ' '.join(cpp_flags)
]
if '~X' in spec:
config_args = ['--without-x'] + config_args
configure(*config_args)
make()

View File

@@ -0,0 +1,242 @@
##############################################################################
# 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 *
from llnl.util.filesystem import join_path
from llnl.util import tty
from spack.architecture import sys_type
from spack.package import InstallError
import os
from shutil import copy
class Enzo(Package):
"""The Enzo package provides the hydrodynamic code enzo"""
homepage="http://enzo-project.org/"
url="https://bitbucket.org/enzo/enzo-dev/get/enzo-2.5.tar.bz2"
version("development", hg="https://bitbucket.org/enzo/enzo-dev")
version("stable", hg="https://bitbucket.org/enzo/enzo-dev", revision='stable')
version("2.5", "ede4a3a59cabf2cdb4a29c49f5bedb20")
version("2.4", "ad296817307be83b3bc9fe9b0494df8a")
version("2.3", "0b8a47117ef95fd561c3319e8992ddf9")
version("2.2", "65fe5a8dced223753e02aaa9e3e92603")
version("2.1.1", "0fe775d0a05d5e434b7d1c3e927146d2")
version("2.1.0", "224a426312af03a573c2087b6d94a2d4")
variant("warn", default=False, description="Warn compiling mode")
variant("debug", default=False, description="Debug compiling mode")
variant("high", default=True, description="High compiling mode")
variant("aggressive", default=False, description="Aggressive compiling mode")
depends_on('python@:2.7.999', type=('build'))
depends_on('mercurial', type=('build'))
depends_on('makedepend', type=('build'))
depends_on('hdf5@1.8.16', type=('build', 'link', 'run'))
depends_on('mpi', type=('build', 'link', 'run'))
def install(self, spec, prefix):
if ((('+warn' in spec) and ('+debug' in spec)) or
(('+warn' in spec) and ('+high' in spec)) or
(('+warn' in spec) and ('+aggressive' in spec)) or
(('+debug' in spec) and ('+high' in spec)) or
(('+debug' in spec) and ('+aggressive' in spec)) or
(('+high' in spec) and ('+aggressive' in spec))):
raise InstallError("Can only specify one of"
"+warn,+debug,+high,and+aggressive")
build_option = ""
if '+warn' in spec:
build_option = 'opt-warn'
elif '+debug' in spec:
build_option = 'opt-debug'
elif '+high' in spec:
build_option = 'opt-high'
elif '+aggressive' in spec:
build_option = 'opt-aggressive'
# destroy old bin
if os.path.exists("bin"):
rmtree("bin")
mkdir("bin")
# First run configure
configure()
# First, build enzo
cd("src/enzo")
tty.msg("Current directory is: %s" % os.getcwd())
# Remove configuration file
if(os.path.exists("Make.mach.spack")):
remove("Make.mach.spack")
#Write configuration file
build_config_file = open("Make.mach.spack", "w")
build_config_file.write("""
#=======================================================================\n
#\n
# FILE: Make.mach.spack\n
#\n
# DESCRIPTION: Makefile settings for a machine using spack\n
#\n
# AUTHOR: Matthew Krafczyk (krafczyk.matthew@gmail.com)\n
#\n
# DATE: 2017-02-09\n
#\n
# This configuration is built with w/e is needed using spack\n
#\n
#=======================================================================\n
\n
MACH_TEXT = Spack on %s\n
MACH_VALID = 1\n
MACH_FILE = Make.mach.spack\n
\n
#-----------------------------------------------------------------------\n
# Install paths (local variables)\n
#-----------------------------------------------------------------------\n
\n
""" % sys_type())
mpi_prefix = spec['mpi'].prefix
hdf5_prefix = spec['hdf5'].prefix
build_config_file.write("LOCAL_MPI_INSTALL = %s\n" % mpi_prefix)
build_config_file.write("LOCAL_HDF5_INSTALL = %s\n" % hdf5_prefix)
build_config_file.write("LOCAL_GRACKLE_INSTALL = /usr/local\n")
build_config_file.write("""
\n
#-----------------------------------------------------------------------\n
# Compiler settings\n
#-----------------------------------------------------------------------\n
\n
MACH_CPP = cpp # C preprocessor command\n
\n
# With MPI\n
\n
MACH_CC_MPI = mpicc # C compiler when using MPI\n
MACH_CXX_MPI = mpic++ # C++ compiler when using MPI\n
MACH_FC_MPI = gfortran # Fortran 77 compiler when using MPI\n
MACH_F90_MPI = gfortran # Fortran 90 compiler when using MPI\n
MACH_LD_MPI = mpic++ # Linker when using MPI\n
\n
# Without MPI\n
\n
MACH_CC_NOMPI = gcc # C compiler when not using MPI\n
MACH_CXX_NOMPI = g++ # C++ compiler when not using MPI\n
MACH_FC_NOMPI = gfortran # Fortran 77 compiler when not using MPI\n
MACH_F90_NOMPI = gfortran # Fortran 90 compiler when not using MPI\n
MACH_LD_NOMPI = g++ # Linker when not using MPI\n
\n
#-----------------------------------------------------------------------\n
# Machine-dependent defines\n
#-----------------------------------------------------------------------\n
\n
MACH_DEFINES = -DLINUX -DH5_USE_16_API \n
\n
#-----------------------------------------------------------------------\n
# Compiler flag settings\n
#-----------------------------------------------------------------------\n
\n
\n
MACH_CPPFLAGS = -P -traditional \n
MACH_CFLAGS = \n
MACH_CXXFLAGS = -DMPICH_IGNORE_CXX_SEEK -DMPICH_SKIP_MPICXX\n
MACH_FFLAGS = -fno-second-underscore -ffixed-line-length-132\n
MACH_F90FLAGS = -fno-second-underscore\n
MACH_LDFLAGS = \n
\n
#-----------------------------------------------------------------------\n
# Optimization flags\n
#-----------------------------------------------------------------------\n
\n
MACH_OPT_WARN = -Wall -g\n
MACH_OPT_DEBUG = -g\n
MACH_OPT_HIGH = -O2\n
MACH_OPT_AGGRESSIVE = -O3 -g\n
\n
#-----------------------------------------------------------------------\n
# Includes\n
#-----------------------------------------------------------------------\n
\n
LOCAL_INCLUDES_MPI = -I$(LOCAL_MPI_INSTALL)/include # MPI includes\n
LOCAL_INCLUDES_HDF5 = -I$(LOCAL_HDF5_INSTALL)/include # HDF5 includes\n
LOCAL_INCLUDES_HYPRE = # hypre includes\n
LOCAL_INCLUDES_PAPI = # PAPI includes\n
LOCAL_INCLUDES_GRACKLE = -I$(LOCAL_GRACKLE_INSTALL)/include\n
\n
MACH_INCLUDES = $(LOCAL_INCLUDES_MPI) $(LOCAL_INCLUDES_HDF5)\n
MACH_INCLUDES_MPI = $(LOCAL_INCLUDES_MPI)\n
MACH_INCLUDES_HYPRE = $(LOCAL_INCLUDES_HYPRE)\n
MACH_INCLUDES_PAPI = $(LOCAL_INCLUDES_PAPI)\n
MACH_INCLUDES_GRACKLE = $(LOCAL_INCLUDES_GRACKLE)\n
\n
#-----------------------------------------------------------------------\n
# Libraries\n
#-----------------------------------------------------------------------\n
\n
LOCAL_LIBS_MPI = -L$(LOCAL_MPI_INSTALL)/lib -lmpi -lmpicxx # MPI libraries\n
LOCAL_LIBS_HDF5 = -L$(LOCAL_HDF5_INSTALL)/lib -lhdf5 -lz # HDF5 libraries\n
LOCAL_LIBS_HYPRE = # hypre libraries\n
LOCAL_LIBS_PAPI = # PAPI libraries\n
LOCAL_LIBS_MACH = -lgfortran # Machine-dependent libraries\n
LOCAL_LIBS_GRACKLE = -L$(LOCAL_GRACKLE_INSTALL)/lib -lgrackle\n
\n
MACH_LIBS = $(LOCAL_LIBS_HDF5) $(LOCAL_LIBS_MACH)\n
MACH_LIBS_MPI = $(LOCAL_LIBS_MPI)\n
MACH_LIBS_HYPRE = $(LOCAL_LIBS_HYPRE)\n
MACH_LIBS_PAPI = $(LOCAL_LIBS_PAPI)\n
MACH_LIBS_GRACKLE = $(LOCAL_LIBS_GRACKLE)\n""")
build_config_file.close()
# Set machine options
make("machine-spack")
# Set debug mode
make(build_option)
make("clean")
# Build
make()
# Now for the inits tool
cd("../inits")
make("machine-spack")
make("clean")
make(build_option)
make()
# And the ring tool
cd("../ring")
make("machine-spack")
make(build_option)
make("clean")
make()
copy('ring.exe', '../../bin/ring')
cd("../..")
# Install results
mkdirp(join_path(prefix, "bin"))
for item in os.listdir("bin"):
install("bin/%s" % item, join_path(prefix, "bin/%s" % item))

View File

@@ -36,6 +36,7 @@ class Openssl(Package):
homepage = "http://www.openssl.org"
url = "ftp://openssl.org/source/openssl-1.0.1h.tar.gz"
version('1.0.2k', 'f965fc0bf01bf882b31314b61391ae65')
version('1.0.2j', '96322138f0b69e61b7212bc53d5e912b')
version('1.0.2i', '678374e63f8df456a697d3e5e5a931fb')
version('1.0.2h', '9392e65072ce4b614c1392eefc1f23d0')

View File

@@ -23,9 +23,9 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import os
from spack import *
class PyYt(Package):
"""Volumetric Data Analysis
@@ -53,6 +53,8 @@ class PyYt(Package):
variant("astropy", default=True, description="enable astropy support")
variant("h5py", default=True, description="enable h5py support")
variant("scipy", default=True, description="enable scipy support")
variant("devmode", default=False, description="enable development mode")
variant("rockstar", default=False, description="enable rockstar support")
extends("python")
@@ -65,9 +67,21 @@ class PyYt(Package):
depends_on("py-scipy", type=('build', 'run'), when="+scipy")
depends_on("py-setuptools", type="build")
depends_on("py-sympy", type=('build', 'run'))
depends_on("rockstar@yt", type=('build', 'run'), when="+rockstar")
depends_on("py-pillow", type=('build', 'run'))
depends_on("python @2.7:2.999,3.4:")
def install(self, spec, prefix):
if '+devmode' in spec:
setup_py("develop", "--prefix=%s" % prefix)
else:
setup_py("install", "--prefix=%s" % prefix)
if '+rockstar' in spec:
if os.path.exists('rockstar.cfg'):
os.remove('rockstar.cfg')
rockstar_cfg = open('rockstar.cfg', 'w')
rockstar_cfg.write(spec.get_dependency('rockstar').spec.prefix)
rockstar_cfg.close()
setup_py("install", "--prefix=%s" % prefix)
self.check_install(spec, prefix)

View File

@@ -0,0 +1,13 @@
diff --git a/Makefile b/Makefile
index fafba4b..a21ef9e 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ PROFFLAGS = -lm -g -pg -O2 -std=c99
CC = gcc
CFILES = rockstar.c check_syscalls.c fof.c groupies.c subhalo_metric.c potential.c nfw.c jacobi.c fun_times.c interleaving.c universe_time.c hubble.c integrate.c distance.c config_vars.c config.c bounds.c inthash.c io/read_config.c client.c server.c merger.c inet/socket.c inet/rsocket.c inet/address.c io/meta_io.c io/io_internal.c io/io_ascii.c io/stringparse.c io/io_gadget.c io/io_generic.c io/io_art.c io/io_tipsy.c io/io_bgc2.c io/io_util.c io/io_arepo.c io/io_hdf5.c
DIST_FLAGS =
-HDF5_FLAGS = -DH5_USE_16_API -lhdf5 -DENABLE_HDF5 -I/opt/local/include -L/opt/local/lib
+HDF5_FLAGS = -DH5_USE_16_API -lhdf5 -DENABLE_HDF5 -I$(HDF5_INC_DIR) -L$(HDF5_LIB_DIR)
all:
@make reg EXTRA_FLAGS="$(OFLAGS)"

View File

@@ -0,0 +1,47 @@
import os
import shutil
from spack import *
class Rockstar(Package):
"""Description"""
homepage = "https://bitbucket.org/gfcstanford/rockstar"
url = "https://bitbucket.org/gfcstanford/rockstar"
version('develop', git='https://bitbucket.org/gfcstanford/rockstar.git')
version('yt', hg='https://bitbucket.org/MatthewTurk/rockstar')
variant('hdf5', description='Build rockstar with HDF5 support')
patch('adjust_buildscript.patch')
depends_on('hdf5', when='+hdf5')
def install(self, spec, prefix):
# Set environment appropriately for HDF5
if '+hdf5' in spec:
os.environ['HDF5_INC_DIR'] = spec.get_dependency('hdf5').spec.prefix+"/include"
os.environ['HDF5_LIB_DIR'] = spec.get_dependency('hdf5').spec.prefix+"/lib"
# Build depending on whether hdf5 is to be used
if '+hdf5' in spec:
make('with_hdf5')
else:
make()
# Build rockstar library
make('lib')
# Install all files and directories
for filename in os.listdir('.'):
if filename != "." and filename != "..":
if os.path.isdir(filename):
shutil.copytree(join_path(".",filename), join_path(prefix, filename))
else:
install(filename, join_path(prefix, filename))
mkdir(prefix.bin)
mkdir(prefix.lib)
install('rockstar', join_path(prefix.bin, 'rockstar'))
install('librockstar.so', join_path(prefix.lib, 'librockstar.so'))