ruby

Support for Ruby extensions. A C/C++ compiler is required:

def options(opt):
        opt.load('compiler_c ruby')
def configure(conf):
        conf.load('compiler_c ruby')
        conf.check_ruby_version((1,8,0))
        conf.check_ruby_ext_devel()
        conf.check_ruby_module('libxml')
def build(bld):
        bld(
                features = 'c cshlib rubyext',
                source = 'rb_mytest.c',
                target = 'mytest_ext',
                install_path = '${ARCHDIR_RUBY}')
        bld.install_files('${LIBDIR_RUBY}', 'Mytest.rb')
waflib.Tools.ruby.before_method(*k)[source]

Decorator that registera task generator method which will be executed before the functions of given name(s):

from waflib.TaskGen import feature, before
@feature('myfeature')
@before_method('fun2')
def fun1(self):
        print('feature 1!')
@feature('myfeature')
def fun2(self):
        print('feature 2!')
def build(bld):
        bld(features='myfeature')
Parameters

k (list of string) – method names

waflib.Tools.ruby.feature(*k)

Decorator that registers a task generator method that will be executed when the object attribute feature contains the corresponding key(s):

from waflib.TaskGen import feature
@feature('myfeature')
def myfunction(self):
        print('that is my feature!')
def build(bld):
        bld(features='myfeature')
Parameters

k (list of string) – feature names

waflib.Tools.ruby.extension(*k)

Decorator that registers a task generator method which will be invoked during the processing of source files for the extension given:

from waflib import Task
class mytask(Task):
        run_str = 'cp ${SRC} ${TGT}'
@extension('.moo')
def create_maa_file(self, node):
        self.create_task('mytask', node, node.change_ext('.maa'))
def build(bld):
        bld(source='foo.moo')
waflib.Tools.ruby.conf(f)

Decorator: attach new configuration functions to waflib.Build.BuildContext and waflib.Configure.ConfigurationContext. The methods bound will accept a parameter named ‘mandatory’ to disable the configuration errors:

def configure(conf):
        conf.find_program('abc', mandatory=False)
Parameters

f (function) – method to bind

waflib.Tools.ruby.init_rubyext(self)[source]

Task generator method

Add required variables for ruby extensions

Feature

rubyext

waflib.Tools.ruby.apply_ruby_so_name(self)[source]

Task generator method

Strip the lib prefix from ruby extensions

Feature

rubyext

waflib.Tools.ruby.check_ruby_version(self, minver=())[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

Checks if ruby is installed. If installed the variable RUBY will be set in environment. The ruby binary can be overridden by --with-ruby-binary command-line option.

waflib.Tools.ruby.check_ruby_ext_devel(self)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

Check if a ruby extension can be created

waflib.Tools.ruby.check_ruby_module(self, module_name)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

Check if the selected ruby interpreter can require the given ruby module:

def configure(conf):
        conf.check_ruby_module('libxml')
Parameters

module_name (string) – module

class waflib.Tools.ruby.run_ruby(*k, **kw)[source]

Task to run ruby files detected by file extension .rb:

def options(opt):
        opt.load('ruby')

def configure(ctx):
        ctx.check_ruby_version()

def build(bld):
        bld.env.RBFLAGS = '-e puts "hello world"'
        bld(source='a_ruby_file.rb')
hasrun
generator
env

waflib.ConfigSet.ConfigSet object (make sure to provide one)

inputs

List of input nodes, which represent the files used by the task instance

outputs

List of output nodes, which represent the files created by the task instance

dep_nodes

List of additional nodes to depend on

run_after

Set of tasks that must be executed before this one

hcode = b'${RUBY} ${RBFLAGS} -I ${SRC[0].parent.abspath()} ${SRC}'

String representing an additional hash for the class representation

orig_run_str = '${RUBY} ${RBFLAGS} -I ${SRC[0].parent.abspath()} ${SRC}'
vars = ['RBFLAGS', 'RUBY']

ConfigSet variables that should trigger a rebuild (class attribute used for waflib.Task.Task.sig_vars())

waflib.Tools.ruby.options(opt)[source]

Add the --with-ruby-archdir, --with-ruby-libdir and --with-ruby-binary options

Features defined in this module: