cs

C# support. A simple example:

def configure(conf):
        conf.load('cs')
def build(bld):
        bld(features='cs', source='main.cs', gen='foo')

Note that the configuration may compile C# snippets:

FRAG = '''
namespace Moo {
        public class Test { public static int Main(string[] args) { return 0; } }
}'''
def configure(conf):
        conf.check(features='cs', fragment=FRAG, compile_filename='test.cs', gen='test.exe',
                bintype='exe', csflags=['-pkg:gtk-sharp-2.0'], msg='Checking for Gtksharp support')
waflib.Tools.cs.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.cs.after_method(*k)[source]

Decorator that registers a task generator method which will be executed after the functions of given name(s):

from waflib.TaskGen import feature, after
@feature('myfeature')
@after_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.cs.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.cs.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.cs.apply_cs(self)[source]

Task generator method

Create a C# task bound to the attribute cs_task. There can be only one C# task by task generator.

Feature

cs

waflib.Tools.cs.use_cs(self)[source]

Task generator method

C# applications honor the use keyword:

def build(bld):
        bld(features='cs', source='My.cs', bintype='library', gen='my.dll', name='mylib')
        bld(features='cs', source='Hi.cs', includes='.', bintype='exe', gen='hi.exe', use='mylib', name='hi')
Feature

cs

waflib.Tools.cs.debug_cs(self)[source]

Task generator method

The C# targets may create .mdb or .pdb files:

def build(bld):
        bld(features='cs', source='My.cs', bintype='library', gen='my.dll', csdebug='full')
        # csdebug is a value in (True, 'full', 'pdbonly')
Feature

cs

waflib.Tools.cs.doc_cs(self)[source]

Task generator method

The C# targets may create .xml documentation files:

def build(bld):
        bld(features='cs', source='My.cs', bintype='library', gen='my.dll', csdoc=True)
        # csdoc is a boolean value
Feature

cs

class waflib.Tools.cs.mcs(*k, **kw)[source]

Compile C# files

color = 'YELLOW'

Color for the console display, see waflib.Logs.colors_lst

split_argfile(cmd)[source]

Splits a list of process commands into the executable part and its list of arguments

Returns

a tuple containing the executable first and then the rest of arguments

Return type

tuple

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'${MCS} ${CSTYPE} ${CSFLAGS} ${ASS_ST:ASSEMBLIES} ${RES_ST:RESOURCES} ${OUT} ${SRC}'

String representing an additional hash for the class representation

orig_run_str = '${MCS} ${CSTYPE} ${CSFLAGS} ${ASS_ST:ASSEMBLIES} ${RES_ST:RESOURCES} ${OUT} ${SRC}'
vars = ['ASSEMBLIES', 'ASS_ST', 'CSFLAGS', 'CSTYPE', 'MCS', 'OUT', 'RESOURCES', 'RES_ST']

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

waflib.Tools.cs.configure(conf)[source]

Find a C# compiler, set the variable MCS for the compiler and CS_NAME (mono or csc)

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

Add a command-line option for the configuration:

$ waf configure --with-csc-binary=/foo/bar/mcs
class waflib.Tools.cs.fake_csshlib(*k, **kw)[source]

Task used for reading a foreign .net assembly and adding the dependency on it

color = 'YELLOW'

Color for the console display, see waflib.Logs.colors_lst

runnable_status()[source]

Returns the Task status

Returns

a task state in waflib.Task.RUN_ME, waflib.Task.SKIP_ME, waflib.Task.CANCEL_ME or waflib.Task.ASK_LATER.

Return type

int

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

waflib.Tools.cs.read_csshlib(self, name, paths=[])[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

Read a foreign .net assembly for the use system:

def build(bld):
        bld.read_csshlib('ManagedLibrary.dll', paths=[bld.env.mylibrarypath])
        bld(features='cs', source='Hi.cs', bintype='exe', gen='hi.exe', use='ManagedLibrary.dll')
Parameters
  • name (string) – Name of the library

  • paths (list of string) – Folders in which the library may be found

Returns

A task generator having the feature fake_lib which will call waflib.Tools.ccroot.process_lib()

Return type

waflib.TaskGen.task_gen

Features defined in this module: