aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-06-27 20:52:53 +0000
committerAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-06-27 20:52:53 +0000
commitade74c32ce75de033d9d75fb958ff75896343097 (patch)
tree4d4c12f5cf6c7044d9100f733615b9d42ea4e42a
parent2da3ae5389124d0b951e331c09d6e986efad0de9 (diff)
downloadpaludis-ade74c32ce75de033d9d75fb958ff75896343097.tar.gz
paludis-ade74c32ce75de033d9d75fb958ff75896343097.tar.xz
(python) Prepare for enums with docstrings.
-rw-r--r--python/dep_spec.cc3
-rw-r--r--python/environment.cc3
-rw-r--r--python/log.cc6
-rw-r--r--python/mask_reasons.cc3
-rw-r--r--python/name.cc6
-rw-r--r--python/package_database.cc3
-rwxr-xr-xpython/paludis_python.hh7
-rw-r--r--python/version_operator.cc3
-rw-r--r--python/version_requirements.cc3
9 files changed, 26 insertions, 11 deletions
diff --git a/python/dep_spec.cc b/python/dep_spec.cc
index 54539a2..c4e2f3d 100644
--- a/python/dep_spec.cc
+++ b/python/dep_spec.cc
@@ -1076,7 +1076,8 @@ void PALUDIS_VISIBLE expose_dep_spec()
/**
* Enums
*/
- enum_auto("PackageDepSpecParseMode", last_pds_pm);
+ enum_auto("PackageDepSpecParseMode", last_pds_pm,
+ "How to parse a PackageDepSpec string.");
register_tree_to_python<DependencySpecTree>();
register_tree_to_python<ProvideSpecTree>();
diff --git a/python/environment.cc b/python/environment.cc
index cb975ad..904d092 100644
--- a/python/environment.cc
+++ b/python/environment.cc
@@ -66,7 +66,8 @@ void PALUDIS_VISIBLE expose_environment()
/**
* Enums
*/
- enum_auto("MaskReasonsOption", last_mro);
+ enum_auto("MaskReasonsOption", last_mro,
+ "Options for Environment.mask_reasons().");
/**
* EnvironmentMaker
diff --git a/python/log.cc b/python/log.cc
index 7d7cb0a..1b2efdb 100644
--- a/python/log.cc
+++ b/python/log.cc
@@ -30,8 +30,10 @@ void PALUDIS_VISIBLE expose_log()
/**
* Enums
*/
- enum_auto("LogLevel", last_ll);
- enum_auto("LogContext", last_lc);
+ enum_auto("LogLevel", last_ll,
+ "Specifies the level of a log message.");
+ enum_auto("LogContext", last_lc,
+ "Specifies whether a log message has context.");
/**
* Log
diff --git a/python/mask_reasons.cc b/python/mask_reasons.cc
index a3e0821..b48b45b 100644
--- a/python/mask_reasons.cc
+++ b/python/mask_reasons.cc
@@ -30,7 +30,8 @@ void PALUDIS_VISIBLE expose_mask_reasons()
/**
* Enums
*/
- enum_auto("MaskReason", last_mr);
+ enum_auto("MaskReason", last_mr,
+ "Each value represents one reason for a package being masked.");
/**
* MaskReasons
diff --git a/python/name.cc b/python/name.cc
index b999224..1f6c0a2 100644
--- a/python/name.cc
+++ b/python/name.cc
@@ -62,8 +62,10 @@ void PALUDIS_VISIBLE expose_name()
/**
* Enums
*/
- enum_auto("UseFlagState", last_use);
- enum_auto("IUseFlagParseMode", last_iuse_pm);
+ enum_auto("UseFlagState", last_use,
+ "A USE flag can be on, off or unspecified.");
+ enum_auto("IUseFlagParseMode", last_iuse_pm,
+ "How to parse an IUSE flag string.");
/**
* PackageNamePart
diff --git a/python/package_database.cc b/python/package_database.cc
index e3d662d..25cea5c 100644
--- a/python/package_database.cc
+++ b/python/package_database.cc
@@ -59,7 +59,8 @@ void PALUDIS_VISIBLE expose_package_database()
/**
* Enums
*/
- enum_auto("QueryOrder", last_qo);
+ enum_auto("QueryOrder", last_qo,
+ "How to order query results.");
/**
* PackageDatabase
diff --git a/python/paludis_python.hh b/python/paludis_python.hh
index 2bb177a..2ca0f16 100755
--- a/python/paludis_python.hh
+++ b/python/paludis_python.hh
@@ -80,8 +80,9 @@ namespace paludis
// expose stringifyable enums
template <typename E_>
void
- enum_auto(const std::string & name, E_ e_last)
+ enum_auto(const std::string & name, E_ e_last, std::string doc)
{
+ doc += "\n\nPossible values:";
boost::python::enum_<E_> enum_(name.c_str());
for (E_ e(static_cast<E_>(0)); e != e_last ; e = static_cast<E_>(static_cast<int>(e) + 1))
{
@@ -89,7 +90,11 @@ namespace paludis
std::string e_name_up;
std::transform(e_name_low.begin(), e_name_low.end(), std::back_inserter(e_name_up), &::toupper);
enum_.value(e_name_up.c_str(), e);
+ doc += "\n\t" + e_name_up;
}
+ // FIXME __doc__ is ro...
+ PyObject * py_doc = PyString_FromString(doc.c_str());
+ PyObject_SetAttrString(enum_.ptr(), "__doc__", py_doc);
}
// Compare
diff --git a/python/version_operator.cc b/python/version_operator.cc
index 102d1ff..00dd9a5 100644
--- a/python/version_operator.cc
+++ b/python/version_operator.cc
@@ -48,7 +48,8 @@ void PALUDIS_VISIBLE expose_version_operator()
/**
* Enums
*/
- enum_auto("VersionOperatorValue", last_vo);
+ enum_auto("VersionOperatorValue", last_vo,
+ "Represents an operator attached to a VersionSpec.");
/**
* VersionOperator
diff --git a/python/version_requirements.cc b/python/version_requirements.cc
index 09fa1ac..a56da09 100644
--- a/python/version_requirements.cc
+++ b/python/version_requirements.cc
@@ -30,7 +30,8 @@ void PALUDIS_VISIBLE expose_version_requirements()
/**
* Enums
*/
- enum_auto("VersionRequirementsMode", last_vr);
+ enum_auto("VersionRequirementsMode", last_vr,
+ "Whether our version requirements are an 'and' or an 'or' set.");
/**
* VersionRequirement