summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Scogland <tscogland@llnl.gov>2015-06-11 13:51:31 -0700
committerThomas R. W. Scogland <scogland@llnl.gov>2015-06-11 13:51:53 -0700
commitd92ac2a6b2bf46fd8ad85ff8c0390fc2869f2e7c (patch)
tree3437641807de083fece8bade34f48451a168ce40
parent0e3d994b052c7db90865ed4387b44bae42211ecb (diff)
downloadspack-d92ac2a6b2bf46fd8ad85ff8c0390fc2869f2e7c.tar.gz
spack-d92ac2a6b2bf46fd8ad85ff8c0390fc2869f2e7c.tar.bz2
spack-d92ac2a6b2bf46fd8ad85ff8c0390fc2869f2e7c.tar.xz
spack-d92ac2a6b2bf46fd8ad85ff8c0390fc2869f2e7c.zip
Small ruby enhancement and tmuxinator package
It is currently less painful to pull the source from github, compile it into a gem, then install the gem, than it is to download a gem and install it. This still lacks an activation mechanism, but `spack use tmuxinator` is functional.
-rw-r--r--lib/spack/spack/modules.py7
-rw-r--r--var/spack/packages/ruby/package.py25
-rw-r--r--var/spack/packages/tmuxinator/package.py17
3 files changed, 49 insertions, 0 deletions
diff --git a/lib/spack/spack/modules.py b/lib/spack/spack/modules.py
index 493c454f1d..01915a5d64 100644
--- a/lib/spack/spack/modules.py
+++ b/lib/spack/spack/modules.py
@@ -130,6 +130,13 @@ class EnvModule(object):
if site_packages:
add_path('PYTHONPATH', site_packages[0])
+ if self.spec.package.extends(spack.spec.Spec('ruby')):
+ add_path('GEM_PATH', self.spec.prefix)
+
+ # Allow module path extensions from packages
+ for key, val in self.spec.package.extra_environment:
+ add_path(key, val)
+
# short description is just the package + version
# TODO: maybe packages can optionally provide it.
self.short_description = self.spec.format("$_ $@")
diff --git a/var/spack/packages/ruby/package.py b/var/spack/packages/ruby/package.py
index 718fd0a3be..6b6242362c 100644
--- a/var/spack/packages/ruby/package.py
+++ b/var/spack/packages/ruby/package.py
@@ -1,4 +1,6 @@
from spack import *
+import spack
+import os
class Ruby(Package):
"""A dynamic, open source programming language with a focus on
@@ -7,6 +9,8 @@ class Ruby(Package):
homepage = "https://www.ruby-lang.org/"
url = "http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.0.tar.gz"
+ extendable = True
+
version('2.2.0', 'cd03b28fd0b555970f5c4fd481700852')
def install(self, spec, prefix):
@@ -14,3 +18,24 @@ class Ruby(Package):
make()
make("install")
+
+ def setup_dependent_environment(self, module, spec, ext_spec):
+ """Called before ruby modules' install() methods. Sets GEM_HOME
+ and GEM_PATH to values appropriate for the package being built.
+
+ In most cases, extensions will only need to have one line::
+
+ gem('install', '<gem-name>.gem')
+ """
+ # Ruby extension builds have global ruby and gem functions
+ module.ruby = Executable(join_path(spec.prefix.bin, 'ruby'))
+ module.gem = Executable(join_path(spec.prefix.bin, 'gem'))
+
+ # Set GEM_PATH to include dependent gem directories
+ ruby_paths = []
+ for d in ext_spec.traverse():
+ if d.package.extends(self.spec):
+ ruby_paths.append(d.prefix)
+ os.environ['GEM_PATH'] = ':'.join(ruby_paths)
+ # The actual installation path for this gem
+ os.environ['GEM_HOME'] = ext_spec.prefix
diff --git a/var/spack/packages/tmuxinator/package.py b/var/spack/packages/tmuxinator/package.py
new file mode 100644
index 0000000000..26c061cbd6
--- /dev/null
+++ b/var/spack/packages/tmuxinator/package.py
@@ -0,0 +1,17 @@
+from spack import *
+
+class Tmuxinator(Package):
+ """A session configuration creator and manager for tmux"""
+ homepage = "https://github.com/tmuxinator/tmuxinator"
+ url = "https://github.com/tmuxinator/tmuxinator"
+
+ version('0.6.11',
+ git='https://github.com/tmuxinator/tmuxinator',
+ tag='v0.6.11')
+
+ extends('ruby')
+
+ def install(self, spec, prefix):
+ gem('build', 'tmuxinator.gemspec')
+ gem('install', 'tmuxinator-{}.gem'.format(self.version))
+