aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-11 18:45:04 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-11 18:45:04 +0000
commit169409361945a4de3f6ceb229568214d9d07c25a (patch)
treee5b3bc0e2a79a5b50136d480019581367dde14dc
parentcce405d54052fa56220320997aa2d560fa0b0932 (diff)
downloadpaludis-169409361945a4de3f6ceb229568214d9d07c25a.tar.gz
paludis-169409361945a4de3f6ceb229568214d9d07c25a.tar.xz
Update bindings
-rw-r--r--python/action.cc75
-rwxr-xr-xpython/action_TEST.py6
-rwxr-xr-xpython/package_id_TEST.py6
-rw-r--r--ruby/action.cc35
4 files changed, 108 insertions, 14 deletions
diff --git a/python/action.cc b/python/action.cc
index 5c55ee3..1f32528 100644
--- a/python/action.cc
+++ b/python/action.cc
@@ -85,6 +85,27 @@ namespace
));
}
+ InfoActionOptions * make_info_action_options()
+ {
+ return new InfoActionOptions(make_named_values<InfoActionOptions>(
+ value_for<n::make_output_manager>(&make_standard_output_manager)
+ ));
+ }
+
+ ConfigActionOptions * make_config_action_options()
+ {
+ return new ConfigActionOptions(make_named_values<ConfigActionOptions>(
+ value_for<n::make_output_manager>(&make_standard_output_manager)
+ ));
+ }
+
+ PretendActionOptions * make_pretend_action_options()
+ {
+ return new PretendActionOptions(make_named_values<PretendActionOptions>(
+ value_for<n::make_output_manager>(&make_standard_output_manager)
+ ));
+ }
+
FetchActionOptions * make_fetch_action_options(
const bool exclude_unmirrorable,
const bool fetch_unneeded,
@@ -170,6 +191,54 @@ void expose_action()
;
/**
+ * ConfigActionOptions
+ */
+ bp::class_<ConfigActionOptions>
+ (
+ "ConfigActionOptions",
+ "Options for ConfigAction.",
+ bp::no_init
+ )
+
+ .def("__init__",
+ bp::make_constructor(&make_config_action_options),
+ "__init__()"
+ )
+ ;
+
+ /**
+ * InfoActionOptions
+ */
+ bp::class_<InfoActionOptions>
+ (
+ "InfoActionOptions",
+ "Options for InfoAction.",
+ bp::no_init
+ )
+
+ .def("__init__",
+ bp::make_constructor(&make_info_action_options),
+ "__init__()"
+ )
+ ;
+
+ /**
+ * PretendActionOptions
+ */
+ bp::class_<PretendActionOptions>
+ (
+ "PretendActionOptions",
+ "Options for PretendAction.",
+ bp::no_init
+ )
+
+ .def("__init__",
+ bp::make_constructor(&make_pretend_action_options),
+ "__init__()"
+ )
+ ;
+
+ /**
* FetchActionOptions
*/
bp::class_<FetchActionOptions>
@@ -265,7 +334,7 @@ void expose_action()
"PretendAction",
"A PretendAction is used by InstallTask to handle install-pretend-phase\n"
"checks on a PackageID.",
- bp::init<>("__init__()")
+ bp::init<const PretendActionOptions &>("__init__(PretendActionOptions)")
)
.add_property("failed", &PretendAction::failed,
"[ro] bool\n"
@@ -282,7 +351,7 @@ void expose_action()
"A ConfigAction is used via PackageID::perform_action to execute\n"
"post-install configuration (for example, via 'paludis --config')\n"
"on a PackageID.",
- bp::init<>("__init__()")
+ bp::init<ConfigActionOptions>("__init__(ConfigActionOptions)")
);
/**
@@ -294,7 +363,7 @@ void expose_action()
"An InfoAction is used via PackageID::perform_action to execute\n"
"additional information (for example, via 'paludis --info')\n"
"on a PackageID.",
- bp::init<>("__init__()")
+ bp::init<InfoActionOptions>("__init__(InfoActionOptions)")
);
/**
diff --git a/python/action_TEST.py b/python/action_TEST.py
index a123935..8bee223 100755
--- a/python/action_TEST.py
+++ b/python/action_TEST.py
@@ -84,15 +84,15 @@ class TestCase_07_InstalledAction(unittest.TestCase):
class TestCase_08_PretendAction(unittest.TestCase):
def test_01_create(self):
- PretendAction()
+ PretendAction(PretendActionOptions())
class TestCase_09_ConfigAction(unittest.TestCase):
def test_01_create(self):
- ConfigAction()
+ ConfigAction(ConfigActionOptions())
class TestCase_10_InfoAction(unittest.TestCase):
def test_01_create(self):
- InfoAction()
+ InfoAction(InfoActionOptions())
class TestCase_10_SupportsActionTests(unittest.TestCase):
def test_01_create(self):
diff --git a/python/package_id_TEST.py b/python/package_id_TEST.py
index 1e243fa..231094d 100755
--- a/python/package_id_TEST.py
+++ b/python/package_id_TEST.py
@@ -84,9 +84,9 @@ class TestCase_01_PackageID(unittest.TestCase):
self.assert_(isinstance(self.pid.find_metadata("DEPEND"), MetadataDependencySpecTreeKey))
def test_10_perform_action(self):
- self.pid.perform_action(PretendAction())
- self.assertRaises(UnsupportedActionError, self.pid.perform_action, ConfigAction())
- self.assertRaises(UnsupportedActionError, self.ipid.perform_action, PretendAction())
+ self.pid.perform_action(PretendAction(PretendActionOptions()))
+ self.assertRaises(UnsupportedActionError, self.pid.perform_action, ConfigAction(ConfigActionOptions()))
+ self.assertRaises(UnsupportedActionError, self.ipid.perform_action, PretendAction(PretendActionOptions()))
def test_11_supports_action(self):
self.assert_(self.pid.supports_action(SupportsFetchActionTest()))
diff --git a/ruby/action.cc b/ruby/action.cc
index de77477..88acbf1 100644
--- a/ruby/action.cc
+++ b/ruby/action.cc
@@ -467,12 +467,37 @@ namespace
*
* Create new PretendAction
*/
- template <typename A_>
+ template <typename A_, typename O_>
struct EasyActionNew
{
static VALUE
easy_action_new(VALUE self)
{
+ O_ options(make_named_values<O_>(
+ value_for<n::make_output_manager>(&make_standard_output_manager)
+ ));
+
+ std::tr1::shared_ptr<Action> * a(new std::tr1::shared_ptr<Action>(new A_(options)));
+ VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::tr1::shared_ptr<Action> >::free, a));
+ rb_obj_call_init(tdata, 1, &self);
+ return tdata;
+ }
+ };
+
+ /*
+ * Document-method InstalledAction.new
+ *
+ * call-seq:
+ * InstalledAction.new -> InstalledAction
+ *
+ * Create new InstalledAction
+ */
+ template <typename A_>
+ struct ReallyEasyActionNew
+ {
+ static VALUE
+ easy_action_new(VALUE self)
+ {
std::tr1::shared_ptr<Action> * a(new std::tr1::shared_ptr<Action>(new A_()));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::tr1::shared_ptr<Action> >::free, a));
rb_obj_call_init(tdata, 1, &self);
@@ -771,7 +796,7 @@ namespace
*/
c_info_action = rb_define_class_under(paludis_module(), "InfoAction", c_action);
rb_define_singleton_method(c_info_action, "new",
- RUBY_FUNC_CAST((&EasyActionNew<InfoAction>::easy_action_new)), 0);
+ RUBY_FUNC_CAST((&EasyActionNew<InfoAction, InfoActionOptions>::easy_action_new)), 0);
rb_define_method(c_info_action, "initialize", RUBY_FUNC_CAST(&empty_init), -1);
/*
@@ -781,7 +806,7 @@ namespace
*/
c_config_action = rb_define_class_under(paludis_module(), "ConfigAction", c_action);
rb_define_singleton_method(c_config_action, "new",
- RUBY_FUNC_CAST((&EasyActionNew<ConfigAction>::easy_action_new)), 0);
+ RUBY_FUNC_CAST((&EasyActionNew<ConfigAction, ConfigActionOptions>::easy_action_new)), 0);
rb_define_method(c_config_action, "initialize", RUBY_FUNC_CAST(&empty_init), -1);
/*
@@ -832,7 +857,7 @@ namespace
*/
c_installed_action = rb_define_class_under(paludis_module(), "InstalledAction", c_action);
rb_define_singleton_method(c_installed_action, "new",
- RUBY_FUNC_CAST((&EasyActionNew<InstalledAction>::easy_action_new)), 0);
+ RUBY_FUNC_CAST((&ReallyEasyActionNew<InstalledAction>::easy_action_new)), 0);
rb_define_method(c_installed_action, "initialize", RUBY_FUNC_CAST(&empty_init), -1);
/*
@@ -842,7 +867,7 @@ namespace
*/
c_pretend_action = rb_define_class_under(paludis_module(), "PretendAction", c_action);
rb_define_singleton_method(c_pretend_action, "new",
- RUBY_FUNC_CAST((&EasyActionNew<PretendAction>::easy_action_new)), 0);
+ RUBY_FUNC_CAST((&EasyActionNew<PretendAction, PretendActionOptions>::easy_action_new)), 0);
rb_define_method(c_pretend_action, "initialize", RUBY_FUNC_CAST(&empty_init), -1);
rb_define_method(c_pretend_action, "failed?", RUBY_FUNC_CAST(&pretend_action_failed), 0);
rb_define_method(c_pretend_action, "set_failed", RUBY_FUNC_CAST(&pretend_action_set_failed), 0);