hammer/src/bindings/ruby/SConscript
Alex Willmer 0f3cadcc3e Enable absolute imports, true division, & print()
These have no effect in Python 3.x, they are the default. Enabling them
in Python 2.x, enabling them in Python 2.x allows single source
compatiblity.
2019-05-10 21:13:32 +01:00

36 lines
985 B
Python

# -*- python -*-
from __future__ import absolute_import, division, print_function
import os.path
Import("env libhammer_shared testruns targets")
rubysources = [
Glob("test/*.rb"),
Glob("lib/hammer.rb"),
Glob("lib/*/*.rb"),
"hammer-parser.gemspec",
"Rakefile",
"Gemfile",
"README.md",
]
rubyenv = env.Clone()
for k,v in os.environ.items():
if "RUBY" in k or "GEM" in k or "rvm" in k:
rubyenv['ENV'][k] = v
rubyenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0]))
rubyenv['RBDIR'] = os.path.dirname(str(rubyenv.File("Gemfile").path))
setup = rubyenv.Command(Dir(".bundle"), rubysources, "cd $RBDIR && bundle install")
AlwaysBuild(setup)
rubytestexec = rubyenv.Command(None, [setup] + rubysources, "cd $RBDIR && bundle exec rake test")
rubytest = Alias("testruby", [rubytestexec], rubytestexec)
AlwaysBuild(rubytestexec)
testruns.append(rubytest)
# No need for an install target; everybody just uses gems for that.