2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-14 12:42:11 +00:00

Allow to specify the list of bound targets

and flags, when defining action from Python.


[SVN r39641]
This commit is contained in:
Vladimir Prus
2007-10-01 17:29:11 +00:00
parent f40dfd415a
commit a475ec69a1

View File

@@ -1696,22 +1696,43 @@ bjam_import_rule(PyObject* self, PyObject* args)
}
/* Accepts two arguments -- an action name and an action body.
/* Accepts four arguments:
- an action name
- an action body
- a list of variable that will be bound inside the action
- integer flags.
Defines an action on bjam side.
This interface does not (yet) support the list of bound
variables of the action flags (together/piecemeal/etc). */
*/
PyObject*
bjam_define_action(PyObject* self, PyObject *args)
{
char* name;
char* body;
module_t* m;
PyObject *bindlist_python;
int flags;
LIST *bindlist = L0;
int n;
int i;
if (!PyArg_ParseTuple(args, "ss:define_action", &name, &body))
if (!PyArg_ParseTuple(args, "ssO!i:define_action", &name, &body,
&PyList_Type, &bindlist_python, &flags))
return NULL;
n = PyList_Size (bindlist_python);
for (i = 0; i < n; ++i)
{
PyObject *next = PyList_GetItem(bindlist_python, i);
if (!PyString_Check(next))
{
PyErr_SetString(PyExc_RuntimeError,
"bind list has non-string type");
return NULL;
}
bindlist = list_new(bindlist, PyString_AsString(next));
}
new_rule_actions(root_module(), name, newstr(body), L0, 0);
new_rule_actions(root_module(), name, newstr(body), bindlist, flags);
return Py_None;
}