aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-01-03 23:19:02 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-01-03 23:19:02 +0000
commitd4a6d90e2cbd92e404757d330fa573aacf0d474b (patch)
tree602923df0a0d462ec476ade4510bbe04c07213a5 /python
parentceb5b2f5d8a0f012f246f031a46f860d39a150fb (diff)
downloadpaludis-d4a6d90e2cbd92e404757d330fa573aacf0d474b.tar.gz
paludis-d4a6d90e2cbd92e404757d330fa573aacf0d474b.tar.xz
Tidy up some of the EAPI options.
Diffstat (limited to 'python')
-rw-r--r--python/additional_tests.cc2
-rwxr-xr-xpython/metadata_key_TEST.py2
-rw-r--r--python/name.cc13
-rwxr-xr-xpython/name_TEST.py5
4 files changed, 15 insertions, 7 deletions
diff --git a/python/additional_tests.cc b/python/additional_tests.cc
index c34cc2672..b76289d87 100644
--- a/python/additional_tests.cc
+++ b/python/additional_tests.cc
@@ -263,7 +263,7 @@ namespace formatter
// CanFormat for IUseRoles
void test_iuse_roles(CanFormat<IUseFlag> & f)
{
- IUseFlag u("iuse_flag", iuse_pm_permissive, 1);
+ IUseFlag u("iuse_flag", IUseFlagParseOptions(), 1);
f.format(u, Plain());
f.format(u, Enabled());
f.format(u, Disabled());
diff --git a/python/metadata_key_TEST.py b/python/metadata_key_TEST.py
index 4822c9490..bf57184dc 100755
--- a/python/metadata_key_TEST.py
+++ b/python/metadata_key_TEST.py
@@ -155,7 +155,7 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase):
MetadataIUseFlagIterableKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
def value(self):
- return [IUseFlag("iuse", IUseFlagParseMode.PERMISSIVE, -1)]
+ return [IUseFlag("iuse", IUseFlagParseOptions(), -1)]
def pretty_print_flat(self, f):
return f.format_iuse_flag_plain(IUseFlag("foo", UseFlagState.ENABLED, 0))
diff --git a/python/name.cc b/python/name.cc
index 6fa1e4736..036a348de 100644
--- a/python/name.cc
+++ b/python/name.cc
@@ -21,6 +21,7 @@
#include <python/exception.hh>
#include <python/validated.hh>
#include <python/iterable.hh>
+#include <python/options.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/name.hh>
@@ -68,10 +69,16 @@ void expose_name()
*/
enum_auto("UseFlagState", last_use,
"A USE flag can be on, off or unspecified.");
- enum_auto("IUseFlagParseMode", last_iuse_pm,
+ enum_auto("IUseFlagParseOption", last_iufpo,
"How to parse an IUSE flag string.");
/**
+ * Options
+ */
+ class_options<IUseFlagParseOptions>("IUseFlagParseOptions", "IUseFlagParseOption",
+ "Options for IUseFlag.");
+
+ /**
* PackageNamePart
*/
register_shared_ptrs_to_python<PackageNamePart>();
@@ -249,8 +256,8 @@ void expose_name()
(
"IUseFlag",
"Represents an IUse flag.",
- bp::init<const std::string &, IUseFlagParseMode, const std::string::size_type>(
- "__init__(string, IUseFlagParseMode, Integer)")
+ bp::init<const std::string &, IUseFlagParseOptions, const std::string::size_type>(
+ "__init__(string, IUseFlagParseOptions, Integer)")
)
.def(bp::init<const UseFlagName &, const UseFlagState &, const std::string::size_type>(
"__init__(UseFlagName, UseFlagState, Integer)"))
diff --git a/python/name_TEST.py b/python/name_TEST.py
index 94419837d..e06b5b262 100755
--- a/python/name_TEST.py
+++ b/python/name_TEST.py
@@ -33,7 +33,7 @@ class TestCase_Names(unittest.TestCase):
self.names["repo"] = RepositoryName("repo")
self.names["keyword"] = KeywordName("keyword")
self.names["set"] = SetName("set")
- IUseFlag("foo", IUseFlagParseMode.PERMISSIVE, -1)
+ IUseFlag("foo", IUseFlagParseOptions(), -1)
IUseFlag("foo", UseFlagState.ENABLED, -1)
def test_2_create_error(self):
@@ -60,7 +60,8 @@ class TestCase_Names(unittest.TestCase):
def test_4_operators(self):
self.assert_(CategoryNamePart("cat-foo") + PackageNamePart("pkg") == QualifiedPackageName("cat-foo/pkg"))
- self.assert_(IUseFlag("foo", UseFlagState.ENABLED, -1) == IUseFlag("+foo", IUseFlagParseMode.PERMISSIVE, 2))
+ self.assert_(IUseFlag("foo", UseFlagState.ENABLED, -1) ==
+ IUseFlag("+foo", IUseFlagParseOptions() + IUseFlagParseOption.ALLOW_IUSE_DEFAULTS, 2))
def test_5_data_members(self):