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.
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]¶ Bases:
waflib.Task.Task
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')
-
hcode
= b'${RUBY} ${RBFLAGS} -I ${SRC[0].parent.abspath()} ${SRC}'¶
-
orig_run_str
= '${RUBY} ${RBFLAGS} -I ${SRC[0].parent.abspath()} ${SRC}'¶
-
vars
= ['RBFLAGS', 'RUBY']¶
-
-
waflib.Tools.ruby.
options
(opt)[source]¶ Add the
--with-ruby-archdir
,--with-ruby-libdir
and--with-ruby-binary
options
-
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.Task 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
andwaflib.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
Features defined in this module: