Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for generating .gem files from .gemspec files and support for preinstallopts in the RubyGem easyblock #3381

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions easybuild/easyblocks/generic/rubygem.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def run(self):

def extract_step(self):
"""Skip extraction of .gem files, which are installed as downloaded"""

if len(self.src) > 1:
raise EasyBuildError("Don't know how to handle Ruby gems with multiple sources.")
else:
Expand All @@ -83,20 +82,35 @@ def extract_step(self):
# unpack zipped gems, use specified path to gem file
super(RubyGem, self).extract_step()

if self.cfg['gem_file']:
self.ext_src = os.path.join(src['finalpath'], self.cfg['gem_file'])
if not os.path.exists(self.ext_src):
raise EasyBuildError("Gem file not found at %s", self.ext_src)
else:
raise EasyBuildError("Location to gem file in unpacked sources must be specified via gem_file")

def configure_step(self):
"""No separate configuration for Ruby Gems."""
pass

def build_step(self):
"""No separate build procedure for Ruby Gems."""
pass
src = self.src[0]
if self.cfg['gem_file']:
self.ext_src = os.path.join(src['finalpath'], self.cfg['gem_file'])
if not os.path.exists(self.ext_src):
raise EasyBuildError("Gem file not found at %s", self.ext_src)
else:
gemfile = "%s.gem" % self.name
gemfile_lower = "%s.gem" % self.name.lower()
if os.path.exists(gemfile):
self.ext_src = os.path.join(src['finalpath'], gemfile)
elif os.path.exists(gemfile_lower):
self.ext_src = os.path.join(src['finalpath'], gemfile_lower)
else:
gemspec = "%s.gemspec" % self.name
gemspec_lower = "%s.gemspec" % self.name.lower()
if os.path.exists(gemspec):
run_cmd("gem build %s -o %s.gem" % (gemspec, self.name))
self.ext_src = "%s.gem" % self.name
elif os.path.exists(gemspec_lower):
run_cmd("gem build %s -o %s.gem" % (gemspec_lower, self.name.lower()))
self.ext_src = "%s.gem" % self.name.lower()
else:
raise EasyBuildError("No gem_file specified and no"
" %s.gemspec or %s.gemspec found." % (self.name, self.name.lower()))

def test_step(self):
"""No separate (standard) test procedure for Ruby Gems."""
Expand All @@ -113,7 +127,8 @@ def install_step(self):
env.setvar('GEM_HOME', self.installdir)

bindir = os.path.join(self.installdir, 'bin')
run_cmd("gem install --bindir %s --local %s" % (bindir, self.ext_src))
cmd = "%s gem install --bindir %s --local %s" % (self.cfg['preinstallopts'], bindir, self.ext_src)
run_cmd(cmd)

def make_module_extra(self):
"""Extend $GEM_PATH in module file."""
Expand Down
Loading