[paludis-commits] paludis.git (master) -- 58d3820 by Ciaran McCreesh

git at git.pioto.org git at git.pioto.org
Mon Aug 4 21:20:29 EDT 2008


Module:    paludis.git
Branch:    master
Commit:    58d38200b5a29264f4b15311461038143acb9149
URL:       http://git.pioto.org/?p=paludis.git;a=commit;h=58d38200b5a29264f4b15311461038143acb9149

Author:    Ciaran McCreesh <ciaran.mccreesh at googlemail.com>
Committer: Ciaran McCreesh <ciaran.mccreesh at googlemail.com>
Date:      Tue Aug  5 02:19:59 2008 +0100

----

Fix Python.

Because peper fails it.

----

 python/action.cc            |   35 ++++++++++++++++++-----------------
 python/action_TEST.py       |   10 +++++-----
 python/mask.cc              |   24 +++++++++++++++++++++---
 python/metadata_key_TEST.py |    2 +-
 python/repository.cc        |   28 ++++++++++++++--------------
 5 files changed, 59 insertions(+), 40 deletions(-)


diff --git a/python/action.cc b/python/action.cc
index 2012d7a..3e74732 100644
--- a/python/action.cc
+++ b/python/action.cc
@@ -50,25 +50,26 @@ class class_supports_action_test :
 
 namespace
 {
-    InstallActionOptions make_install_action_options(
-            const InstallActionDebugOption & d, const InstallActionChecksOption & c,
+    InstallActionOptions * make_install_action_options(
+            const InstallActionChecksOption & c, const InstallActionDebugOption & d,
             const std::tr1::shared_ptr<paludis::Repository> & r)
     {
-        return make_named_values<InstallActionOptions>(
-                value_for<n::checks>(c),
-                value_for<n::debug_build>(d),
-                value_for<n::destination>(r)
-                );
+        return new InstallActionOptions(make_named_values<InstallActionOptions>(
+                    value_for<n::checks>(c),
+                    value_for<n::debug_build>(d),
+                    value_for<n::destination>(r)
+                    ));
     }
 
-    FetchActionOptions make_fetch_action_options(
-            const bool fetch_unneeded, const bool safe_resume
+    FetchActionOptions * make_fetch_action_options(
+            const bool fetch_unneeded,
+            const bool safe_resume
             )
     {
-        return make_named_values<FetchActionOptions>(
-                value_for<n::fetch_unneeded>(fetch_unneeded),
-                value_for<n::safe_resume>(safe_resume)
-                );
+        return new FetchActionOptions(make_named_values<FetchActionOptions>(
+                    value_for<n::fetch_unneeded>(fetch_unneeded),
+                    value_for<n::safe_resume>(safe_resume)
+                    ));
     }
 
 }
@@ -120,8 +121,8 @@ void expose_action()
         )
 
         .def("__init__",
-                make_install_action_options,
-                "__init__(InstallActionDebugOption, InstallActionChecksOption, Repository)"
+                bp::make_constructor(&make_install_action_options),
+                "__init__(InstallActionChecksOption, InstallActionDebugOption, Repository)"
             )
 
         .add_property("debug_build",
@@ -154,7 +155,7 @@ void expose_action()
         )
 
         .def("__init__",
-                bp::make_constructor(make_fetch_action_options),
+                bp::make_constructor(&make_fetch_action_options),
                 "__init__(fetch_uneeded, safe_resume)"
             )
 
@@ -285,5 +286,5 @@ void expose_action()
     class_supports_action_test<PretendAction>("Pretend");
     class_supports_action_test<ConfigAction>("Config");
     class_supports_action_test<InfoAction>("Info");
-
 }
+
diff --git a/python/action_TEST.py b/python/action_TEST.py
index 3becb96..a8a30fe 100755
--- a/python/action_TEST.py
+++ b/python/action_TEST.py
@@ -31,11 +31,11 @@ class TestCase_01_InstallActionOptions(unittest.TestCase):
         repo2 = FakeRepository(env, "2")
 
     def test_01_create(self):
-        InstallActionOptions(InstallActionDebugOption.values[0], InstallActionChecksOption.values[0], repo1)
+        InstallActionOptions(InstallActionChecksOption.values[0], InstallActionDebugOption.values[0], repo1)
 
     def test_02_data_members(self):
-        iao = InstallActionOptions(InstallActionDebugOption.values[0],
-                InstallActionChecksOption.values[0], repo1)
+        iao = InstallActionOptions(InstallActionChecksOption.values[0],
+                InstallActionDebugOption.values[0], repo1)
 
         self.assertEquals(iao.debug_build, InstallActionDebugOption.values[0])
         self.assertEquals(iao.checks, InstallActionChecksOption.values[0])
@@ -71,8 +71,8 @@ class TestCase_04_InstallAction(unittest.TestCase):
     def test_01_create(self):
         env = TestEnvironment()
         repo1 = FakeRepository(env, "1")
-        iao = InstallActionOptions(InstallActionDebugOption.values[0],
-                InstallActionChecksOption.values[0], repo1)
+        iao = InstallActionOptions(InstallActionChecksOption.values[0],
+                InstallActionDebugOption.values[0], repo1)
         InstallAction(iao)
 
 class TestCase_05_FetchAction(unittest.TestCase):
diff --git a/python/mask.cc b/python/mask.cc
index c7df631..4e4abc2 100644
--- a/python/mask.cc
+++ b/python/mask.cc
@@ -22,11 +22,25 @@
 
 #include <paludis/mask.hh>
 #include <paludis/util/visitor-impl.hh>
+#include <paludis/util/make_named_values.hh>
+#include <paludis/util/make_shared_ptr.hh>
 
 using namespace paludis;
 using namespace paludis::python;
 namespace bp = boost::python;
 
+namespace
+{
+    std::tr1::shared_ptr<RepositoryMaskInfo>  make_repository_mask_info(
+            const std::tr1::shared_ptr<const Sequence<std::string> > & s, const FSEntry & f)
+    {
+        return make_shared_ptr(new RepositoryMaskInfo(make_named_values<RepositoryMaskInfo>(
+                        value_for<n::comment>(s),
+                        value_for<n::mask_file>(f)
+                        )));
+    };
+}
+
 class MaskSptrToPythonVisitor :
     public ConstVisitor<MaskVisitorTypes>
 {
@@ -283,10 +297,14 @@ void expose_mask()
         (
          "RepositoryMaskInfo",
          "Information about a RepositoryMask.",
-         bp::init<const FSEntry &, const std::tr1::shared_ptr<const Sequence<std::string> > &>(
-             "__init__(path_str, list of string)"
-             )
+         bp::no_init
         )
+
+        .def("__init__",
+                bp::make_constructor(&make_repository_mask_info),
+                "__init__(list of string, path_str)"
+            )
+
         .add_property("mask_file",
                 &named_values_getter<RepositoryMaskInfo, n::mask_file, FSEntry, &RepositoryMaskInfo::mask_file>,
                 &named_values_setter<RepositoryMaskInfo, n::mask_file, FSEntry, &RepositoryMaskInfo::mask_file>,
diff --git a/python/metadata_key_TEST.py b/python/metadata_key_TEST.py
index 62bc388..4268326 100755
--- a/python/metadata_key_TEST.py
+++ b/python/metadata_key_TEST.py
@@ -119,7 +119,7 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase):
                 MetadataRepositoryMaskInfoKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
 
             def value(self):
-                return RepositoryMaskInfo("/foo", ["comment"])
+                return RepositoryMaskInfo(["comment"], "/foo")
 
         test_metadata_repository_mask_info_key(TestKey())
 
diff --git a/python/repository.cc b/python/repository.cc
index fcc6a6f..19821fa 100644
--- a/python/repository.cc
+++ b/python/repository.cc
@@ -42,61 +42,61 @@ struct RepositoryWrapper :
     static RepositorySetsInterface *
     get_sets_interface(const Repository & self)
     {
-        return self[k::sets_interface()];
+        return self.sets_interface();
     }
 
     static RepositorySyncableInterface *
     get_syncable_interface(const Repository & self)
     {
-        return self[k::syncable_interface()];
+        return self.syncable_interface();
     }
 
     static RepositoryUseInterface *
     get_use_interface(const Repository & self)
     {
-        return self[k::use_interface()];
+        return self.use_interface();
     }
 
     static RepositoryMirrorsInterface *
     get_mirrors_interface(const Repository & self)
     {
-        return self[k::mirrors_interface()];
+        return self.mirrors_interface();
     }
 
     static RepositoryEnvironmentVariableInterface *
     get_environment_variable_interface(const Repository & self)
     {
-        return self[k::environment_variable_interface()];
+        return self.environment_variable_interface();
     }
 
     static RepositoryProvidesInterface *
     get_provides_interface(const Repository & self)
     {
-        return self[k::provides_interface()];
+        return self.provides_interface();
     }
 
     static RepositoryVirtualsInterface *
     get_virtuals_interface(const Repository & self)
     {
-        return self[k::virtuals_interface()];
+        return self.virtuals_interface();
     }
 
     static RepositoryDestinationInterface *
     get_destination_interface(const Repository & self)
     {
-        return self[k::destination_interface()];
+        return self.destination_interface();
     }
 
     static RepositoryEInterface *
     get_e_interface(const Repository & self)
     {
-        return self[k::e_interface()];
+        return self.e_interface();
     }
 
     static RepositoryQAInterface *
     get_qa_interface(const Repository & self)
     {
-        return self[k::qa_interface()];
+        return self.qa_interface();
     }
 };
 
@@ -123,7 +123,7 @@ struct RepositoryEInterfaceWrapper
     static void
     my_set_profile(RepositoryEInterface & self, const RepositoryEInterface::ProfilesDescLine & pdl)
     {
-        self.set_profile(self.find_profile(pdl[k::path()]));
+        self.set_profile(self.find_profile(pdl.path()));
     }
 };
 
@@ -274,13 +274,13 @@ void expose_repository()
          bp::no_init
         )
         .add_property("path",
-                &kc_getter<RepositoryEInterfaceProfilesDescLine, FSEntry, k::path>
+                &named_values_getter<RepositoryEInterfaceProfilesDescLine, n::path, FSEntry, &RepositoryEInterfaceProfilesDescLine::path>
                 )
         .add_property("arch",
-                &kc_getter<RepositoryEInterfaceProfilesDescLine, std::string, k::arch>
+                &named_values_getter<RepositoryEInterfaceProfilesDescLine, n::arch, std::string, &RepositoryEInterfaceProfilesDescLine::arch>
                 )
         .add_property("status",
-                &kc_getter<RepositoryEInterfaceProfilesDescLine, std::string, k::status>
+                &named_values_getter<RepositoryEInterfaceProfilesDescLine, n::status, std::string, &RepositoryEInterfaceProfilesDescLine::status>
                 )
         ;
 
---


More information about the paludis-commits mailing list