aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-26 21:22:37 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-26 21:22:37 +0000
commitdc6cdcbdc1430403fb52ad4baf859d09b5bed1c4 (patch)
tree54eb5c530f87fda06c5476e144fcab59f352dc90 /python
parent0c8eeda99a0bbef95e7729369ee293f526cd76a0 (diff)
downloadpaludis-dc6cdcbdc1430403fb52ad4baf859d09b5bed1c4.tar.gz
paludis-dc6cdcbdc1430403fb52ad4baf859d09b5bed1c4.tar.xz
Put repo mask info directly in the mask
Diffstat (limited to 'python')
-rw-r--r--python/additional_tests.cc1
-rw-r--r--python/mask.cc37
-rwxr-xr-xpython/mask_TEST.py4
3 files changed, 31 insertions, 11 deletions
diff --git a/python/additional_tests.cc b/python/additional_tests.cc
index 6b8fafe99..89d4958b4 100644
--- a/python/additional_tests.cc
+++ b/python/additional_tests.cc
@@ -120,7 +120,6 @@ namespace mask
void test_repository_mask(RepositoryMask & m)
{
test_mask(m);
- m.mask_key_name();
}
void test_unsupported_mask(UnsupportedMask & m)
diff --git a/python/mask.cc b/python/mask.cc
index 60ef4a597..1687b788c 100644
--- a/python/mask.cc
+++ b/python/mask.cc
@@ -214,7 +214,38 @@ struct RepositoryMaskWrapper :
else
throw PythonMethodNotImplemented("RepositoryMask", "description");
}
+
+ virtual const std::string comment() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("comment"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("RepositoryMask", "comment");
+ }
+
+ virtual const std::string token() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("token"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("RepositoryMask", "token");
+ }
+
+ virtual const FSPath mask_file() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("mask_file"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("RepositoryMask", "mask_file");
+ }
};
+
struct UnsupportedMaskWrapper :
UnsupportedMask,
bp::wrapper<UnsupportedMask>
@@ -426,12 +457,6 @@ void expose_mask()
"Can be subclassed in Python.",
bp::init<>()
)
- .def("mask_key_name", bp::pure_virtual(&RepositoryMask::mask_key_name),
- "mask_key_name() -> string\n"
- "Fetch the name of a metadata key explaining the mask. May return None,\n"
- "if no more information is available."
- )
-
.def("key", bp::pure_virtual(&Mask::key),
"key() -> string\n"
"A single character key, which can be used by clients if they need\n"
diff --git a/python/mask_TEST.py b/python/mask_TEST.py
index 833b9c221..f38a2dad3 100755
--- a/python/mask_TEST.py
+++ b/python/mask_TEST.py
@@ -72,7 +72,6 @@ class TestCase_01_Masks(unittest.TestCase):
package_mask_path = os.path.realpath(os.path.join(os.getcwd(),
"mask_TEST_dir/testrepo/profiles/package.mask"))
- self.assertEquals(m.mask_key_name(), "repository_mask")
def test_04_unsupported_mask(self):
q = Selection.RequireExactlyOne(Generator.Matches(
@@ -135,9 +134,6 @@ class TestCase_02_Masks_subclassing(unittest.TestCase):
def description(self):
return "test"
- def mask_key_name(self):
- return "monkey"
-
test_repository_mask(TestRepositoryMask())
def test_04_unsupported_mask(self):