aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-06-22 19:05:49 +0000
committerAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-06-22 19:05:49 +0000
commit1e5290d4a82c9c83314a6c81aaad7324e12b5321 (patch)
treeb7b4cb56637fbd77d9d630072fe818a51838fe58
parent6844c38b9b9e5f538168742cf022759ee4ed9f68 (diff)
downloadpaludis-1e5290d4a82c9c83314a6c81aaad7324e12b5321.tar.gz
paludis-1e5290d4a82c9c83314a6c81aaad7324e12b5321.tar.xz
(python) Code clean up #1.
-rw-r--r--python/contents.cc135
-rw-r--r--python/dep_spec.cc358
-rw-r--r--python/eapi.cc112
-rw-r--r--python/environment.cc237
-rw-r--r--python/exception.cc3
-rw-r--r--python/fs_entry.cc6
-rw-r--r--python/log.cc53
-rw-r--r--python/mask_reasons.cc13
-rw-r--r--python/name.cc268
-rw-r--r--python/package_database.cc118
-rw-r--r--python/portage_dep_parser.cc73
-rw-r--r--python/query.cc152
-rw-r--r--python/repository.cc719
-rw-r--r--python/version_metadata.cc325
-rw-r--r--python/version_operator.cc55
-rw-r--r--python/version_requirements.cc49
-rw-r--r--python/version_spec.cc74
17 files changed, 1686 insertions, 1064 deletions
diff --git a/python/contents.cc b/python/contents.cc
index 7ba6f23..c98ccc4 100644
--- a/python/contents.cc
+++ b/python/contents.cc
@@ -43,72 +43,109 @@ class class_contents:
void PALUDIS_VISIBLE expose_contents()
{
+ /**
+ * ContentsEntry
+ */
bp::register_ptr_to_python<tr1::shared_ptr<const ContentsEntry> >();
bp::implicitly_convertible<tr1::shared_ptr<ContentsEntry>,
tr1::shared_ptr<const ContentsEntry> >();
bp::class_<ContentsEntry, boost::noncopyable>
- ce("ContentsEntry",
- "Base class for a contents entry.",
- bp::no_init
- );
- ce.add_property("name", &ContentsEntry::name,
- "[ro] string\n"
- "Our name."
- );
- ce.def(bp::self_ns::str(bp::self));
+ (
+ "ContentsEntry",
+ "Base class for a contents entry.",
+ bp::no_init
+ )
+ .add_property("name", &ContentsEntry::name,
+ "[ro] string\n"
+ "Our name."
+ )
+ .def(bp::self_ns::str(bp::self))
+ ;
+
+ /**
+ * ContentsFileEntry
+ */
class_contents<ContentsFileEntry>
- cfilee("ContentsFileEntry",
- "A file contents entry.",
- bp::init<const std::string &>("__init__(name_string)")
- );
+ (
+ "ContentsFileEntry",
+ "A file contents entry.",
+ bp::init<const std::string &>("__init__(name_string)")
+ );
+ /**
+ * ContentsDirEntry
+ */
class_contents<ContentsDirEntry>
- cdire("ContentsDirEntry",
- "A directory contents entry.",
- bp::init<const std::string &>("__init__(name_string)")
- );
+ (
+ "ContentsDirEntry",
+ "A directory contents entry.",
+ bp::init<const std::string &>("__init__(name_string)")
+ );
+ /**
+ * ContentsMiscEntry
+ */
class_contents<ContentsMiscEntry>
- cme("ContentsMiscEntry",
- "A misc contents entry.",
- bp::init<const std::string &>("__init__(name_string)")
- );
+ (
+ "ContentsMiscEntry",
+ "A misc contents entry.",
+ bp::init<const std::string &>("__init__(name_string)")
+ );
+ /**
+ * ContentsFifoEntry
+ */
class_contents<ContentsFifoEntry>
- cfifoe("ContentsFifoEntry",
- "A fifo contents entry.",
- bp::init<const std::string &>("__init__(name_string)")
- );
+ (
+ "ContentsFifoEntry",
+ "A fifo contents entry.",
+ bp::init<const std::string &>("__init__(name_string)")
+ );
+ /**
+ * ContentsDevEntry
+ */
class_contents<ContentsDevEntry>
- cdeve("ContentsDevEntry",
- "A dev contents entry.",
- bp::init<const std::string &>("__init__(name_string)")
- );
+ (
+ "ContentsDevEntry",
+ "A dev contents entry.",
+ bp::init<const std::string &>("__init__(name_string)")
+ );
+ /**
+ * ContentsSymEntry
+ */
class_contents<ContentsSymEntry>
- cse("ContentsSymEntry",
- "A sym contents entry.",
- bp::init<const std::string &, const std::string &>("__init__(name_string, target_string)")
- );
- cse.add_property("target", &ContentsSymEntry::target,
- "[ro] string\n"
- "Our target (as per readlink)."
- );
- cse.def(bp::self_ns::str(bp::self));
+ (
+ "ContentsSymEntry",
+ "A sym contents entry.",
+ bp::init<const std::string &, const std::string &>("__init__(name_string, target_string)")
+ )
+ .add_property("target", &ContentsSymEntry::target,
+ "[ro] string\n"
+ "Our target (as per readlink)."
+ )
+
+ .def(bp::self_ns::str(bp::self))
+ ;
+ /**
+ * Contents
+ */
register_shared_ptrs_to_python<Contents>();
bp::class_<Contents, boost::noncopyable>
- c("Contents",
- "Iterable of ContentsEntry.\n"
- "A package's contents.",
- bp::init<>("__init__()")
- );
- c.def("add", &Contents::add,
- "add(ContentsEntry)\n"
- "Add a new entry."
- );
- c.def("__iter__", bp::range(&Contents::begin, &Contents::end));
-}
+ (
+ "Contents",
+ "Iterable of ContentsEntry.\n"
+ "A package's contents.",
+ bp::init<>("__init__()")
+ )
+ .def("add", &Contents::add,
+ "add(ContentsEntry)\n"
+ "Add a new entry."
+ )
+ .def("__iter__", bp::range(&Contents::begin, &Contents::end))
+ ;
+}
diff --git a/python/dep_spec.cc b/python/dep_spec.cc
index 73ba1ce..54539a2 100644
--- a/python/dep_spec.cc
+++ b/python/dep_spec.cc
@@ -1062,6 +1062,9 @@ struct RegisterPackageDepSpecSPFromPython
void PALUDIS_VISIBLE expose_dep_spec()
{
+ /**
+ * Exceptions
+ */
ExceptionRegister::get_instance()->add_exception<PackageDepSpecError>
("PackageDepSpecError", "BaseException",
"Thrown if an invalid package dep spec specification is encountered.");
@@ -1070,6 +1073,9 @@ void PALUDIS_VISIBLE expose_dep_spec()
("NotAllowedInThisHeirarchy", "BaseException",
"Thrown if a spec part not suitable for a particular heirarchy is present.");
+ /**
+ * Enums
+ */
enum_auto("PackageDepSpecParseMode", last_pds_pm);
register_tree_to_python<DependencySpecTree>();
@@ -1084,83 +1090,120 @@ void PALUDIS_VISIBLE expose_dep_spec()
RegisterSpecTreeFromPython<URISpecTree>();
RegisterSpecTreeFromPython<LicenseSpecTree>();
+ /**
+ * DepSpec
+ */
register_shared_ptrs_to_python<PythonDepSpec>();
bp::class_<PythonDepSpec, boost::noncopyable>
- ds("DepSpec",
- "Base class for a dependency spec.",
- bp::no_init
- );
- ds.def("as_use_dep_spec", &PythonDepSpec::as_use_dep_spec,
- bp::return_value_policy<bp::reference_existing_object>(),
- "as_use_dep_spec() -> UseDepSpec\n"
- "Return us as a UseDepSpec, or None if we are not a UseDepSpec."
- );
- ds.def("as_package_dep_spec", &PythonDepSpec::as_package_dep_spec,
- bp::return_value_policy<bp::reference_existing_object>(),
- "as_package_dep_spec() -> PackageDepSpec\n"
- "Return us as a PackageDepSpec, or None if we are not a PackageDepSpec."
- );
-
+ (
+ "DepSpec",
+ "Base class for a dependency spec.",
+ bp::no_init
+ )
+ .def("as_use_dep_spec", &PythonDepSpec::as_use_dep_spec,
+ bp::return_value_policy<bp::reference_existing_object>(),
+ "as_use_dep_spec() -> UseDepSpec\n"
+ "Return us as a UseDepSpec, or None if we are not a UseDepSpec."
+ )
+
+ .def("as_package_dep_spec", &PythonDepSpec::as_package_dep_spec,
+ bp::return_value_policy<bp::reference_existing_object>(),
+ "as_package_dep_spec() -> PackageDepSpec\n"
+ "Return us as a PackageDepSpec, or None if we are not a PackageDepSpec."
+ )
+ ;
+
+ /**
+ * CompositeDepSpec
+ */
register_shared_ptrs_to_python<PythonCompositeDepSpec>();
bp::class_<PythonCompositeDepSpec, bp::bases<PythonDepSpec>, boost::noncopyable>
- cds("CompositeDepSpec",
- "Iterable class for dependency specs that have a number of child dependency specs.",
- bp::no_init
- );
- cds.def("__iter__", bp::range(&PythonCompositeDepSpec::begin, &PythonCompositeDepSpec::end));
-
+ (
+ "CompositeDepSpec",
+ "Iterable class for dependency specs that have a number of child dependency specs.",
+ bp::no_init
+ )
+ .def("__iter__", bp::range(&PythonCompositeDepSpec::begin, &PythonCompositeDepSpec::end))
+ ;
+
+ /**
+ * AnyDepSpec
+ */
bp::class_<PythonAnyDepSpec, bp::bases<PythonCompositeDepSpec>, boost::noncopyable>
- anyds("AnyDepSpec",
- "Represents a \"|| ( )\" dependency block.",
- bp::no_init
- );
-
+ (
+ "AnyDepSpec",
+ "Represents a \"|| ( )\" dependency block.",
+ bp::no_init
+ );
+
+ /**
+ * AllDepSpec
+ */
bp::class_<PythonAllDepSpec, bp::bases<PythonCompositeDepSpec>, boost::noncopyable>
- allds("AllDepSpec",
- "Represents a ( first second third ) or top level group of dependency specs.",
- bp::no_init
- );
-
+ (
+ "AllDepSpec",
+ "Represents a ( first second third ) or top level group of dependency specs.",
+ bp::no_init
+ );
+
+ /**
+ * UseDepSpec
+ */
bp::class_<PythonUseDepSpec, bp::bases<PythonCompositeDepSpec>, boost::noncopyable>
- useds("UseDepSpec",
- "Represents a use? ( ) dependency spec.",
- bp::no_init
- );
- useds.add_property("flag", &UseDepSpec::flag,
- "[ro] UseFlagName\n"
- "Our use flag name."
- );
- useds.add_property("inverse", &UseDepSpec::inverse,
- "[ro] bool\n"
- "Are we a ! flag?"
- );
-
+ (
+ "UseDepSpec",
+ "Represents a use? ( ) dependency spec.",
+ bp::no_init
+ )
+ .add_property("flag", &UseDepSpec::flag,
+ "[ro] UseFlagName\n"
+ "Our use flag name."
+ )
+
+ .add_property("inverse", &UseDepSpec::inverse,
+ "[ro] bool\n"
+ "Are we a ! flag?"
+ )
+ ;
+
+ /**
+ * StringDepSpec
+ */
bp::class_<PythonStringDepSpec, bp::bases<PythonDepSpec>, boost::noncopyable>
- strds("StringDepSpec",
- "A StringDepSpec represents a non-composite dep spec with an associated piece of text.",
- bp::no_init
- );
- strds.add_property("text", &PythonStringDepSpec::text,
- "[ro] string\n"
- "Our text."
- );
-
+ (
+ "StringDepSpec",
+ "A StringDepSpec represents a non-composite dep spec with an associated piece of text.",
+ bp::no_init
+ )
+ .add_property("text", &PythonStringDepSpec::text,
+ "[ro] string\n"
+ "Our text."
+ )
+ ;
+
+ /**
+ * UseRequirements
+ */
bp::to_python_converter<std::pair<const UseFlagName, UseFlagState>,
- pair_to_tuple<const UseFlagName, UseFlagState> >();
-
+ pair_to_tuple<const UseFlagName, UseFlagState> >();
register_shared_ptrs_to_python<UseRequirements>();
bp::class_<UseRequirements>
- ur("UseRequirements",
- "A selection of USE flag requirements.",
- bp::no_init
- );
- ur.def("state", &UseRequirements::state,
- "state(UseFlagName) -> UseFlagState\n"
- "What state is desired for a particular use flag?"
- );
- ur.def("__iter__", bp::range(&UseRequirements::begin, &UseRequirements::end));
-
-
+ (
+ "UseRequirements",
+ "A selection of USE flag requirements.",
+ bp::no_init
+ )
+ .def("state", &UseRequirements::state,
+ "state(UseFlagName) -> UseFlagState\n"
+ "What state is desired for a particular use flag?"
+ )
+
+ .def("__iter__", bp::range(&UseRequirements::begin, &UseRequirements::end))
+ ;
+
+ /**
+ * PackageDepSpec
+ */
RegisterPackageDepSpecFromPython();
RegisterPackageDepSpecSPFromPython();
@@ -1168,84 +1211,113 @@ void PALUDIS_VISIBLE expose_dep_spec()
register_sp_package_dep_spec_to_python();
bp::class_<PythonPackageDepSpec, tr1::shared_ptr<const PythonPackageDepSpec>, bp::bases<PythonStringDepSpec> >
- pkgds("PackageDepSpec",
- "A PackageDepSpec represents a package name (for example, 'app-editors/vim'),"
- " possibly with associated version and SLOT restrictions.",
- bp::no_init
- );
- pkgds.def("__init__", bp::make_constructor(&PythonPackageDepSpec::make_from_string),
- "__init__(string, PackageDepSpecParseMode)"
- );
- pkgds.add_property("package", &PythonPackageDepSpec::package_ptr,
- "[ro] QualifiedPackageName\n"
- "Qualified package name."
- );
- pkgds.add_property("package_name_part", &PythonPackageDepSpec::package_name_part_ptr,
- "[ro] PackageNamePart\n"
- "Package name part (may be None)"
- );
- pkgds.add_property("category_name_part", &PythonPackageDepSpec::category_name_part_ptr,
- "[ro] CategoryNamePart\n"
- "Category name part (may be None)."
- );
- pkgds.add_property("version_requirements", &PythonPackageDepSpec::version_requirements_ptr,
- "[ro] VersionRequirements\n"
- "Version requirements (may be None)."
- );
- pkgds.add_property("version_requirements_mode", &PythonPackageDepSpec::version_requirements_mode,
- "[ro] VersionRequirementsMode\n"
- "Version requirements mode."
- );
- pkgds.add_property("slot", &PythonPackageDepSpec::slot_ptr,
- "[ro] SlotName\n"
- "Slot name (may be None)."
- );
- pkgds.add_property("repository", &PythonPackageDepSpec::repository_ptr,
- "[ro] RepositoryName\n"
- "Repository name (may be None)."
- );
- pkgds.add_property("use_requirements", &PythonPackageDepSpec::use_requirements_ptr,
- "[ro] UseRequirements\n"
- "Use requirements (may be None)."
- );
- pkgds.def("without_use_requirements", &PythonPackageDepSpec::without_use_requirements,
- "without_use_requirements() -> PackageDepSpec\n"
- "Fetch a copy of ourself without the USE requirements."
- );
- pkgds.def("__str__", &PythonPackageDepSpec::py_str);
-
+ (
+ "PackageDepSpec",
+ "A PackageDepSpec represents a package name (for example, 'app-editors/vim'),"
+ " possibly with associated version and SLOT restrictions.",
+ bp::no_init
+ )
+ .def("__init__", bp::make_constructor(&PythonPackageDepSpec::make_from_string),
+ "__init__(string, PackageDepSpecParseMode)"
+ )
+
+ .add_property("package", &PythonPackageDepSpec::package_ptr,
+ "[ro] QualifiedPackageName\n"
+ "Qualified package name."
+ )
+
+ .add_property("package_name_part", &PythonPackageDepSpec::package_name_part_ptr,
+ "[ro] PackageNamePart\n"
+ "Package name part (may be None)"
+ )
+
+ .add_property("category_name_part", &PythonPackageDepSpec::category_name_part_ptr,
+ "[ro] CategoryNamePart\n"
+ "Category name part (may be None)."
+ )
+
+ .add_property("version_requirements", &PythonPackageDepSpec::version_requirements_ptr,
+ "[ro] VersionRequirements\n"
+ "Version requirements (may be None)."
+ )
+
+ .add_property("version_requirements_mode", &PythonPackageDepSpec::version_requirements_mode,
+ "[ro] VersionRequirementsMode\n"
+ "Version requirements mode."
+ )
+
+ .add_property("slot", &PythonPackageDepSpec::slot_ptr,
+ "[ro] SlotName\n"
+ "Slot name (may be None)."
+ )
+
+ .add_property("repository", &PythonPackageDepSpec::repository_ptr,
+ "[ro] RepositoryName\n"
+ "Repository name (may be None)."
+ )
+
+ .add_property("use_requirements", &PythonPackageDepSpec::use_requirements_ptr,
+ "[ro] UseRequirements\n"
+ "Use requirements (may be None)."
+ )
+
+ .def("without_use_requirements", &PythonPackageDepSpec::without_use_requirements,
+ "without_use_requirements() -> PackageDepSpec\n"
+ "Fetch a copy of ourself without the USE requirements."
+ )
+
+ .def("__str__", &PythonPackageDepSpec::py_str)
+ ;
+
+ /**
+ * PlainTextDepSpec
+ */
bp::class_<PythonPlainTextDepSpec, bp::bases<PythonStringDepSpec>, boost::noncopyable>
- ptds("PlainTextDepSpec",
- "A PlainTextDepSpec represents a plain text entry (for example, a URI in SRC_URI).",
- bp::init<const std::string &>("__init__(string)")
- );
- ptds.def("__str__", &PythonPlainTextDepSpec::text);
-
+ (
+ "PlainTextDepSpec",
+ "A PlainTextDepSpec represents a plain text entry (for example, a URI in SRC_URI).",
+ bp::init<const std::string &>("__init__(string)")
+ )
+ .def("__str__", &PythonPlainTextDepSpec::text)
+ ;
+
+ /**
+ * URIDepSpec
+ */
bp::class_<PythonURIDepSpec, bp::bases<PythonStringDepSpec>, boost::noncopyable>
- uds("URIDepSpec",
- "A URIDepSpec represents a URI part.",
- bp::init<const std::string &>("__init__(str)")
- );
- uds.add_property("original_url", &PythonURIDepSpec::original_url,
- "[ro] str"
- );
- uds.add_property("renamed_url_suffix", &PythonURIDepSpec::renamed_url_suffix,
- "[ro] str"
- );
-
+ (
+ "URIDepSpec",
+ "A URIDepSpec represents a URI part.",
+ bp::init<const std::string &>("__init__(str)")
+ )
+ .add_property("original_url", &PythonURIDepSpec::original_url,
+ "[ro] str"
+ )
+
+ .add_property("renamed_url_suffix", &PythonURIDepSpec::renamed_url_suffix,
+ "[ro] str"
+ )
+ ;
+
+ /**
+ * BlockDepSpec
+ */
bp::class_<PythonBlockDepSpec, bp::bases<PythonStringDepSpec>, boost::noncopyable >
- bds("BlockDepSpec",
- "A BlockDepSpec represents a block on a package name (for example, 'app-editors/vim'), \n"
- "possibly with associated version and SLOT restrictions.",
- bp::init<tr1::shared_ptr<const PackageDepSpec> >("__init__(PackageDepSpec)")
- );
- bds.add_property("blocked_spec", &PythonBlockDepSpec::blocked_spec,
- "[ro] PackageDepSpec\n"
- "The spec we're blocking."
- );
- //Work around epydoc bug - http://sf.net/tracker/index.php?func=detail&aid=1738417&group_id=32455&atid=405618
- bds.add_property("text", &PythonBlockDepSpec::text,
- "[ro] string\n"
- "Our text."
- );
+ (
+ "BlockDepSpec",
+ "A BlockDepSpec represents a block on a package name (for example, 'app-editors/vim'), \n"
+ "possibly with associated version and SLOT restrictions.",
+ bp::init<tr1::shared_ptr<const PackageDepSpec> >("__init__(PackageDepSpec)")
+ )
+ .add_property("blocked_spec", &PythonBlockDepSpec::blocked_spec,
+ "[ro] PackageDepSpec\n"
+ "The spec we're blocking."
+ )
+
+ //Work around epydoc bug
+ .add_property("text", &PythonBlockDepSpec::text,
+ "[ro] string\n"
+ "Our text."
+ )
+ ;
}
diff --git a/python/eapi.cc b/python/eapi.cc
index ccb0934..23a714a 100644
--- a/python/eapi.cc
+++ b/python/eapi.cc
@@ -27,56 +27,78 @@ namespace bp = boost::python;
void PALUDIS_VISIBLE expose_eapi()
{
+ /**
+ * SupportedEAPI
+ */
register_shared_ptrs_to_python<SupportedEAPI>();
bp::class_<SupportedEAPI, boost::noncopyable>
- se("SupportedEAPI",
- "Information about a supported EAPI.",
- bp::no_init
- );
- se.def_readonly("package_dep_spec_parse_mode", &SupportedEAPI::package_dep_spec_parse_mode,
- "[ro] PackageDepSpecParseMode"
- );
- se.def_readonly("strict_package_dep_spec_parse_mode", &SupportedEAPI::strict_package_dep_spec_parse_mode,
- "[ro] PackageDepSpecParseMode"
- );
- se.def_readonly("iuse_flag_parse_mode", &SupportedEAPI::iuse_flag_parse_mode,
- "[ro] IUseFlagParseMode"
- );
- se.def_readonly("strict_iuse_flag_parse_mode", &SupportedEAPI::strict_iuse_flag_parse_mode,
- "[ro] IUseFlagParseMode"
- );
- se.def_readonly("breaks_portage", &SupportedEAPI::breaks_portage,
- "[ro] bool"
- );
+ (
+ "SupportedEAPI",
+ "Information about a supported EAPI.",
+ bp::no_init
+ )
+ .def_readonly("package_dep_spec_parse_mode", &SupportedEAPI::package_dep_spec_parse_mode,
+ "[ro] PackageDepSpecParseMode"
+ )
+ .def_readonly("strict_package_dep_spec_parse_mode", &SupportedEAPI::strict_package_dep_spec_parse_mode,
+ "[ro] PackageDepSpecParseMode"
+ )
+
+ .def_readonly("iuse_flag_parse_mode", &SupportedEAPI::iuse_flag_parse_mode,
+ "[ro] IUseFlagParseMode"
+ )
+
+ .def_readonly("strict_iuse_flag_parse_mode", &SupportedEAPI::strict_iuse_flag_parse_mode,
+ "[ro] IUseFlagParseMode"
+ )
+
+ .def_readonly("breaks_portage", &SupportedEAPI::breaks_portage,
+ "[ro] bool"
+ )
+ ;
+
+ /**
+ * EAPI
+ */
register_shared_ptrs_to_python<EAPI>();
bp::class_<EAPI, boost::noncopyable>
- e("EAPI",
- "Information about an EAPI.",
- bp::no_init
- );
- e.def_readonly("name", &EAPI::name,
- "[ro] str"
- );
- e.add_property("supported", bp::make_getter(&EAPI::supported, bp::return_value_policy<bp::return_by_value>()),
- "[ro] SupportedEAPI"
- );
+ ("EAPI",
+ "Information about an EAPI.",
+ bp::no_init
+ )
+ .def_readonly("name", &EAPI::name,
+ "[ro] str"
+ )
+ .add_property("supported", bp::make_getter(&EAPI::supported,
+ bp::return_value_policy<bp::return_by_value>()),
+ "[ro] SupportedEAPI"
+ )
+ ;
+
+ /**
+ * EAPIData
+ */
bp::class_<EAPIData, boost::noncopyable>
- ed("EAPIData",
- "Holds information on recognised EAPIs.",
- bp::no_init
- );
- ed.add_static_property("instance", bp::make_function(&EAPIData::get_instance,
- bp::return_value_policy<bp::reference_existing_object>()),
- "Singleton instance."
- );
- ed.def("eapi_from_string", &EAPIData::eapi_from_string,
- "eapi_from_string(str) -> EAPI\n"
- "Make an EAPI."
- );
- ed.def("unknown_eapi", &EAPIData::unknown_eapi,
- "unknown_eapi() -> EAPI\n"
- "Make the unknown EAPI."
- );
+ (
+ "EAPIData",
+ "Holds information on recognised EAPIs.",
+ bp::no_init
+ )
+ .add_static_property("instance", bp::make_function(&EAPIData::get_instance,
+ bp::return_value_policy<bp::reference_existing_object>()),
+ "Singleton instance."
+ )
+
+ .def("eapi_from_string", &EAPIData::eapi_from_string,
+ "eapi_from_string(str) -> EAPI\n"
+ "Make an EAPI."
+ )
+
+ .def("unknown_eapi", &EAPIData::unknown_eapi,
+ "unknown_eapi() -> EAPI\n"
+ "Make the unknown EAPI."
+ )
+ ;
}
diff --git a/python/environment.cc b/python/environment.cc
index cbac1fa..cb975ad 100644
--- a/python/environment.cc
+++ b/python/environment.cc
@@ -44,6 +44,9 @@ struct NoConfigEnvironmentWrapper :
void PALUDIS_VISIBLE expose_environment()
{
+ /**
+ * Exceptions
+ */
ExceptionRegister::get_instance()->add_exception<NoSuchEnvironmentTypeError>
("NoSuchEnvironmentTypeError", "ConfigurationError",
"Thrown if an environment of the specified type does not exist.");
@@ -60,114 +63,158 @@ void PALUDIS_VISIBLE expose_environment()
("PaludisConfigNoDirectoryError", "PaludisConfigError",
"Thrown if the config directory cannot be found by PaludisConfig.");
- bp::class_<EnvironmentMaker, boost::noncopyable> em("EnvironmentMaker",
- "Virtual constructor for environments.",
- bp::no_init);
- em.def("make_from_spec", &EnvironmentMaker::make_from_spec,
- "make_from_spec(spec_string) -> Environment\n"
- "Make Environment from specification."
- );
- em.add_static_property("instance", bp::make_function(&EnvironmentMaker::get_instance,
- bp::return_value_policy<bp::reference_existing_object>()),
- "Singleton instance."
- );
-
+ /**
+ * Enums
+ */
enum_auto("MaskReasonsOption", last_mro);
+ /**
+ * EnvironmentMaker
+ */
+ bp::class_<EnvironmentMaker, boost::noncopyable>
+ (
+ "EnvironmentMaker",
+ "Virtual constructor for environments.",
+ bp::no_init
+ )
+ .add_static_property("instance", bp::make_function(&EnvironmentMaker::get_instance,
+ bp::return_value_policy<bp::reference_existing_object>()),
+ "Singleton instance."
+ )
+
+ .def("make_from_spec", &EnvironmentMaker::make_from_spec,
+ "make_from_spec(spec_string) -> Environment\n"
+ "Make Environment from specification."
+ )
+ ;
+
+ /**
+ * MaskReasonsOptions
+ */
class_options<MaskReasonsOptions>
- mrs("MaskReasonsOptions", "MaskReasonsOption",
- "Options for Environment.mask_reasons()."
- );
+ (
+ "MaskReasonsOptions", "MaskReasonsOption",
+ "Options for Environment.mask_reasons()."
+ );
- bp::class_<Environment, tr1::shared_ptr<Environment>, boost::noncopyable>
- e("Environment",
- "Represents a working environment, which contains an available packages database\n"
- "and provides various methods for querying package visibility and options.",
- bp::no_init
- );
- e.def("default_destinations", &Environment::default_destinations,
- "default_destinations() -> DestinationsCollection\n"
- "Default destination candidates for installing packages."
- );
+ /**
+ * Environment
+ */
tr1::shared_ptr<PackageDatabase> (Environment::* package_database)() =
&Environment::package_database;
- e.add_property("package_database", bp::make_function(package_database,
- bp::with_custodian_and_ward_postcall<0, 1>()),
- "[ro] PackageDatabase\n"
- "Our package database."
- );
- e.def("set", &Environment::set,
- "set(SetName) -> DepSpec\n"
- "Fetch a named set."
- );
- e.def("query_use", &Environment::query_use,
- "query_use(UseFlagName, PackageDatabaseEntry) -> bool\n"
- "Is a particular use flag enabled for a particular package?"
- );
- e.def("mask_reasons", &Environment::mask_reasons,
- (bp::arg("PackageDatabaseEntry"), bp::arg("MaskReasonOptions")=MaskReasonsOptions()),
- "mask_reasons(PackageDatabaseEntry, MaskReasonsOptions=MaskReasonsOptions())"
- " -> set of MaskReason\n"
- "Return the reasons for a package being masked."
- );
- e.def("root", &Environment::root,
- "root() -> string\n"
- "Our root location for installs."
- );
- e.def("set_names", &Environment::set_names,
- "set_names() -> SetNamesCollection\n"
- "Return all known named sets."
- );
+ bp::class_<Environment, tr1::shared_ptr<Environment>, boost::noncopyable>
+ (
+ "Environment",
+ "Represents a working environment, which contains an available packages database\n"
+ "and provides various methods for querying package visibility and options.",
+ bp::no_init
+ )
+ .def("default_destinations", &Environment::default_destinations,
+ "default_destinations() -> DestinationsCollection\n"
+ "Default destination candidates for installing packages."
+ )
+
+ .add_property("package_database", bp::make_function(package_database,
+ bp::with_custodian_and_ward_postcall<0, 1>()),
+ "[ro] PackageDatabase\n"
+ "Our package databas."
+ )
+
+ .def("set", &Environment::set,
+ "set(SetName) -> DepSpec\n"
+ "Fetch a named set."
+ )
+
+ .def("query_use", &Environment::query_use,
+ "query_use(UseFlagName, PackageDatabaseEntry) -> bool\n"
+ "Is a particular use flag enabled for a particular package?"
+ )
+
+ .def("mask_reasons", &Environment::mask_reasons,
+ (bp::arg("PackageDatabaseEntry"), bp::arg("MaskReasonOptions")=MaskReasonsOptions()),
+ "mask_reasons(PackageDatabaseEntry, MaskReasonsOptions=MaskReasonsOptions())"
+ " -> set of MaskReason\n"
+ "Return the reasons for a package being masked."
+ )
+ .def("root", &Environment::root,
+ "root() -> string\n"
+ "Our root location for installs."
+ )
+
+ .def("set_names", &Environment::set_names,
+ "set_names() -> SetNamesCollection\n"
+ "Return all known named sets."
+ )
+ ;
+
+ /**
+ * AdaptedEnvironment
+ */
bp::class_<AdaptedEnvironment, bp::bases<Environment>, boost::noncopyable>
- ae("AdaptedEnvironment",
- "An Environment that allows you to change aspects of an existing Environment,"
- " e.g. the state of a USE flag for a package.",
- bp::init<tr1::shared_ptr<Environment> >("__init__(Environment)")
- );
- ae.def("adapt_use", &AdaptedEnvironment::adapt_use,
- "adapt_use(PackageDepSpeec, UseFlagName, UseFlagState)\n"
- "Set the state of a USE flag for the given PackageDepSpec."
- );
- ae.def("clear_adaptions", &AdaptedEnvironment::clear_adaptions,
- "clear_adaptions()\n"
- "Clear all adaptions from this Environemnt."
- );
+ (
+ "AdaptedEnvironment",
+ "An Environment that allows you to change aspects of an existing Environment,"
+ " e.g. the state of a USE flag for a package.",
+ bp::init<tr1::shared_ptr<Environment> >("__init__(Environment)")
+ )
+ .def("adapt_use", &AdaptedEnvironment::adapt_use,
+ "adapt_use(PackageDepSpeec, UseFlagName, UseFlagState)\n"
+ "Set the state of a USE flag for the given PackageDepSpec."
+ )
+
+ .def("clear_adaptions", &AdaptedEnvironment::clear_adaptions,
+ "clear_adaptions()\n"
+ "Clear all adaptions from this Environemnt."
+ )
+ ;
+ /**
+ * PaludisEnvironment
+ */
bp::class_<PaludisEnvironment, bp::bases<Environment>, boost::noncopyable>
- pe("PaludisEnvironment",
- "The PaludisEnvironment is an Environment that corresponds to the normal operating evironment.",
- bp::init<const std::string &>("__init__(string)")
- );
- pe.add_property("config_dir", &PaludisEnvironment::config_dir,
- "[ro] string\n"
- "The config directory."
- );
+ (
+ "PaludisEnvironment",
+ "The PaludisEnvironment is an Environment that corresponds to the normal operating evironment.",
+ bp::init<const std::string &>("__init__(string)")
+ )
+ .add_property("config_dir", &PaludisEnvironment::config_dir,
+ "[ro] string\n"
+ "The config directory."
+ )
+ ;
- bp::class_<NoConfigEnvironmentWrapper, bp::bases<Environment>, boost::noncopyable>
- nce("NoConfigEnvironment",
- "An environment that uses a single repository, with no user configuration.",
- bp::init<const FSEntry &, const FSEntry &, const FSEntry &>(
- (bp::arg("environment_dir"), bp::arg("write_cache_dir")="/var/empty",
- bp::arg("master_repository_dir")="/var/empty"),
- "__init__(environment_dir, write_cache_dir=\"/var/empty\", "
- "master_repository_dir=\"/var/empty\")"
- )
- );
+ /**
+ * NoConfigEnvironment
+ */
tr1::shared_ptr<Repository> (NoConfigEnvironment::*main_repository)()
= &NoConfigEnvironment::main_repository;
- nce.add_property("main_repository", main_repository,
- "[ro] Repository\n"
- "Main repository."
- );
tr1::shared_ptr<Repository> (NoConfigEnvironment::*master_repository)()
= &NoConfigEnvironment::master_repository;
- nce.add_property("master_repository", master_repository,
- "[ro] Repository\n"
- "Master repository."
- );
- nce.add_property("accept_unstable", bp::object(), &NoConfigEnvironment::set_accept_unstable,
- "[wo] bool\n"
- "Should we accept unstable keywords?"
- );
+ bp::class_<NoConfigEnvironmentWrapper, bp::bases<Environment>, boost::noncopyable>
+ (
+ "NoConfigEnvironment",
+ "An environment that uses a single repository, with no user configuration.",
+ bp::init<const FSEntry &, const FSEntry &, const FSEntry &>(
+ (bp::arg("environment_dir"), bp::arg("write_cache_dir")="/var/empty",
+ bp::arg("master_repository_dir")="/var/empty"),
+ "__init__(environment_dir, write_cache_dir=\"/var/empty\", "
+ "master_repository_dir=\"/var/empty\")"
+ )
+ )
+ .add_property("main_repository", main_repository,
+ "[ro] Repository\n"
+ "Main repository."
+ )
+
+ .add_property("master_repository", master_repository,
+ "[ro] Repository\n"
+ "Master repository."
+ )
+
+ .add_property("accept_unstable", bp::object(), &NoConfigEnvironment::set_accept_unstable,
+ "[wo] bool\n"
+ "Should we accept unstable keywords?"
+ )
+ ;
}
diff --git a/python/exception.cc b/python/exception.cc
index 83c4857..421ec5c 100644
--- a/python/exception.cc
+++ b/python/exception.cc
@@ -69,6 +69,9 @@ ExceptionRegister::get_py_exception(const std::string & name)
void PALUDIS_VISIBLE expose_exception()
{
+ /**
+ * Exceptions
+ */
ExceptionRegister::get_instance()->add_exception<Exception>("BaseException",
"Base exception class.");
ExceptionRegister::get_instance()->add_exception<InternalError>("InternalError", "BaseException",
diff --git a/python/fs_entry.cc b/python/fs_entry.cc
index 4c98269..20af921 100644
--- a/python/fs_entry.cc
+++ b/python/fs_entry.cc
@@ -27,10 +27,16 @@ namespace bp = boost::python;
void PALUDIS_VISIBLE expose_fs_entry()
{
+ /**
+ * Exceptions
+ */
ExceptionRegister::get_instance()->add_exception<FSError>
("FSError", "BaseException",
"Generic filesystem error class.");
+ /**
+ * FSEntry
+ */
bp::implicitly_convertible<std::string, FSEntry>();
bp::to_python_converter<FSEntry, to_string<FSEntry> >();
}
diff --git a/python/log.cc b/python/log.cc
index 06c577b..7d7cb0a 100644
--- a/python/log.cc
+++ b/python/log.cc
@@ -27,31 +27,42 @@ namespace bp = boost::python;
void PALUDIS_VISIBLE expose_log()
{
+ /**
+ * Enums
+ */
enum_auto("LogLevel", last_ll);
enum_auto("LogContext", last_lc);
+ /**
+ * Log
+ */
+ void (Log::*message_ptr)(const LogLevel l, const LogContext c, const std::string & s) =
+ &Log::message;
bp::class_<Log, boost::noncopyable>
- l("Log",
+ (
+ "Log",
"Singleton class that handles log messages.",
bp::no_init
- );
- l.add_static_property("instance", bp::make_function(&Log::get_instance,
- bp::return_value_policy<bp::reference_existing_object>()),
- "[ro] Log\n"
- "Singleton instance."
- );
- void (Log::*message_ptr)(const LogLevel l, const LogContext c, const std::string & s) =
- &Log::message;
- l.def("message", message_ptr,
- "message(LogLevel, LogContext, string) -> None\n"
- "Log a message at the specified level."
- );
- l.add_property("log_level", &Log::log_level, &Log::set_log_level,
- "[rw] LogLevel\n"
- "Log level - only display messages of at least this level."
- );
- l.add_property("program_name", bp::object(), &Log::set_program_name,
- "[wo] string\n"
- "Program name"
- );
+ )
+ .add_static_property("instance", bp::make_function(&Log::get_instance,
+ bp::return_value_policy<bp::reference_existing_object>()),
+ "[ro] Log\n"
+ "Singleton instance."
+ )
+
+ .def("message", message_ptr,
+ "message(LogLevel, LogContext, string) -> None\n"
+ "Log a message at the specified leve."
+ )
+
+ .add_property("log_level", &Log::log_level, &Log::set_log_level,
+ "[rw] LogLevel\n"
+ "Log level - only display messages of at least this leve."
+ )
+
+ .add_property("program_name", bp::object(), &Log::set_program_name,
+ "[wo] string\n"
+ "Program name"
+ )
+ ;
}
diff --git a/python/mask_reasons.cc b/python/mask_reasons.cc
index eb2e85b..a3e0821 100644
--- a/python/mask_reasons.cc
+++ b/python/mask_reasons.cc
@@ -27,10 +27,17 @@ namespace bp = boost::python;
void PALUDIS_VISIBLE expose_mask_reasons()
{
+ /**
+ * Enums
+ */
enum_auto("MaskReason", last_mr);
+ /**
+ * MaskReasons
+ */
class_options<MaskReasons>
- mrs("MaskReasons", "MaskReason",
- "A collection of reasons for why a package is masked."
- );
+ (
+ "MaskReasons", "MaskReason",
+ "A collection of reasons for why a package is masked."
+ );
}
diff --git a/python/name.cc b/python/name.cc
index 037227c..b999224 100644
--- a/python/name.cc
+++ b/python/name.cc
@@ -27,6 +27,9 @@ namespace bp = boost::python;
void PALUDIS_VISIBLE expose_name()
{
+ /**
+ * Exceptions
+ */
ExceptionRegister::get_instance()->add_exception<PackageNamePartError>
("PackageNamePartError", "NameError",
"Thrown if an invalid value is assigned to a PackageNamePart.");
@@ -56,129 +59,216 @@ void PALUDIS_VISIBLE expose_name()
("SetNameError", "NameError",
"Thrown if an invalid value is assigned to a SetName.");
- class_validated<PackageNamePart>
- pnp("PackageNamePart",
- "Holds a string that is a valid name for the package part of a QualifiedPackageName."
- );
+ /**
+ * Enums
+ */
+ enum_auto("UseFlagState", last_use);
+ enum_auto("IUseFlagParseMode", last_iuse_pm);
+
+ /**
+ * PackageNamePart
+ */
register_shared_ptrs_to_python<PackageNamePart>();
+ class_validated<PackageNamePart>
+ (
+ "PackageNamePart",
+ "Holds a string that is a valid name for the package part of a QualifiedPackageName."
+ );
+ /**
+ * PackageNamePartCollection
+ */
class_collection<PackageNamePartCollection>
- pnpc("PackageNamePartCollection",
- "Iterable of PackageNamePart.\n"
- "A collection of PackageNamePart instances."
- );
+ (
+ "PackageNamePartCollection",
+ "Iterable of PackageNamePart.\n"
+ "A collection of PackageNamePart instances."
+ );
- class_validated<CategoryNamePart>
- cnp("CategoryNamePart",
- "Holds a string that is a valid name for the category part of a QualifiedPackageName."
- );
- // CategoryNamePart + PackageNamePart = QualifiedPackageName
- cnp.def(bp::self + bp::other<PackageNamePart>());
+ /**
+ * CategoryNamePart
+ */
register_shared_ptrs_to_python<CategoryNamePart>();
+ class_validated<CategoryNamePart>
+ (
+ "CategoryNamePart",
+ "Holds a string that is a valid name for the category part of a QualifiedPackageName."
+ )
+ // CategoryNamePart + PackageNamePart = QualifiedPackageName
+ .def(bp::self + bp::other<PackageNamePart>())
+ ;
+ /**
+ * CategoryNamePartCollection
+ */
class_collection<CategoryNamePartCollection>
- cnpc("CategoryNamePartCollection",
- "Iterable of CategoryNamePart.\n"
- "A collection of CategoryNamePart instances."
- );
+ (
+ "CategoryNamePartCollection",
+ "Iterable of CategoryNamePart.\n"
+ "A collection of CategoryNamePart instances."
+ );
+ /**
+ * UseFlagName
+ */
class_validated<UseFlagName>
- ufn("UseFlagName",
- "Holds a string that is a valid name for a USE flag."
- );
+ (
+ "UseFlagName",
+ "Holds a string that is a valid name for a USE flag."
+ );
+ /**
+ * UseFlagNameCollection
+ */
class_collection<UseFlagNameCollection>
- ufnc("UseFlagNameCollection",
- "Iterable of UseFlagName.\n"
- "A collection of UseFlagName instances."
- );
+ (
+ "UseFlagNameCollection",
+ "Iterable of UseFlagName.\n"
+ "A collection of UseFlagName instances."
+ );
- class_validated<SlotName>
- sln("SlotName",
- "Holds a string that is a valid name for a SLOT."
- );
+ /**
+ * SlotName
+ */
register_shared_ptrs_to_python<SlotName>();
+ class_validated<SlotName>
+ (
+ "SlotName",
+ "Holds a string that is a valid name for a SLOT."
+ );
- class_validated<RepositoryName>
- rn("RepositoryName",
- "Holds a string that is a valid name for a Repository."
- );
+ /**
+ * RepositoryName
+ */
register_shared_ptrs_to_python<RepositoryName>();
+ class_validated<RepositoryName>
+ (
+ "RepositoryName",
+ "Holds a string that is a valid name for a Repository."
+ );
+ /**
+ * RepositoryNameCollection
+ */
class_collection<RepositoryNameCollection>
- rnc("RepositoryNameCollection",
- "Iterable of RepositoryName\n"
- "A collection of RepositoryName instances."
- );
+ (
+ "RepositoryNameCollection",
+ "Iterable of RepositoryName\n"
+ "A collection of RepositoryName instances."
+ );
+ /**
+ * KeywordName
+ */
class_validated<KeywordName>
- kn("KeywordName",
- "Holds a string that is a valid name for a KEYWORD."
- );
+ (
+ "KeywordName",
+ "Holds a string that is a valid name for a KEYWORD."
+ );
+ /**
+ * KeywordNameCollect
+ */
class_collection<KeywordNameCollection>
- knc("KeywordNameCollection",
- "Iterable of KeywordName\n"
- "A collection of KeywordName instances."
- );
+ (
+ "KeywordNameCollection",
+ "Iterable of KeywordName\n"
+ "A collection of KeywordName instances."
+ );
+ /**
+ * SetName
+ */
class_validated<SetName>
- stn("SetName",
- "Holds a string that is a valid name for a set."
- );
+ (
+ "SetName",
+ "Holds a string that is a valid name for a set."
+ );
+ /**
+ * SetNameCollection
+ */
class_collection<SetNameCollection>
- sc("SetNameCollection",
- "Iterable of SetName\n"
- "A collection of set names."
- );
+ (
+ "SetNameCollection",
+ "Iterable of SetName\n"
+ "A collection of set names."
+ );
+ /**
+ * InheritedCollection
+ */
class_collection<InheritedCollection>
- ic("InheritedCollection",
- "Iterable of string\n"
- "A collection of inherited packages."
- );
+ (
+ "InheritedCollection",
+ "Iterable of string\n"
+ "A collection of inherited packages."
+ );
+ /**
+ * QualifiedPackageName
+ */
register_shared_ptrs_to_python<QualifiedPackageName>();
- bp::class_<QualifiedPackageName>
- qpn("QualifiedPackageName",
- "Represents a category plus package name.",
- bp::init<const std::string &>("__init__(string)")
- );
- qpn.def(bp::init<const CategoryNamePart &, const PackageNamePart &>());
- qpn.def_readwrite("category", &QualifiedPackageName::category);
- qpn.def_readwrite("package", &QualifiedPackageName::package);
- qpn.def("__cmp__", &py_cmp<QualifiedPackageName>);
- qpn.def(bp::self_ns::str(bp::self));
bp::implicitly_convertible<std::string, QualifiedPackageName>();
+ bp::class_<QualifiedPackageName>
+ (
+ "QualifiedPackageName",
+ "Represents a category plus package name.",
+ bp::init<const std::string &>("__init__(string)")
+ )
+ .def(bp::init<const CategoryNamePart &, const PackageNamePart &>())
+ .def_readwrite("category", &QualifiedPackageName::category)
+
+ .def_readwrite("package", &QualifiedPackageName::package)
+
+ .def("__cmp__", &py_cmp<QualifiedPackageName>)
+
+ .def(bp::self_ns::str(bp::self))
+ ;
+
+ /**
+ * QualifiedPackageNameCollection
+ */
class_collection<QualifiedPackageNameCollection>
- qpnc("QualifiedPackageNameCollection",
- "Iterable of QualifiedPackageName\n"
- "A collection of QualifiedPackageName instances."
- );
+ (
+ "QualifiedPackageNameCollection",
+ "Iterable of QualifiedPackageName\n"
+ "A collection of QualifiedPackageName instances."
+ );
+ /**
+ * IUseFlag
+ */
bp::class_<IUseFlag>
- iuf("IUseFlag",
- "Represents an IUse flag.",
- bp::init<const std::string &, IUseFlagParseMode>("__init__(string, IUseFlagParseMode")
- );
- iuf.def(bp::init<const UseFlagName &, const UseFlagState &>("__init__(UseFlagName, UseFlagState)"));
- iuf.def("__cmp__", &py_cmp<IUseFlag>);
- iuf.def(bp::self_ns::str(bp::self));
- iuf.def_readwrite("flag", &IUseFlag::flag,
- "[rw] UseFlagName"
- );
- iuf.def_readwrite("state", &IUseFlag::state,
- "[rw] UseFlagState"
- );
+ (
+ "IUseFlag",
+ "Represents an IUse flag.",
+ bp::init<const std::string &, IUseFlagParseMode>("__init__(string, IUseFlagParseMode")
+ )
+ .def(bp::init<const UseFlagName &, const UseFlagState &>("__init__(UseFlagName, UseFlagState)"))
- class_collection<IUseFlagCollection>
- iufc("IUseFlagCollection",
- "Iterable of IUseFlag\n"
- "A collection of use flags."
- );
+ .def_readwrite("flag", &IUseFlag::flag,
+ "[rw] UseFlagName"
+ )
- enum_auto("UseFlagState", last_use);
- enum_auto("IUseFlagParseMode", last_iuse_pm);
+ .def_readwrite("state", &IUseFlag::state,
+ "[rw] UseFlagState"
+ )
+
+ .def("__cmp__", &py_cmp<IUseFlag>)
+
+ .def(bp::self_ns::str(bp::self))
+
+ ;
+
+ /**
+ * IUseFlagNameCollection
+ */
+ class_collection<IUseFlagCollection>
+ (
+ "IUseFlagCollection",
+ "Iterable of IUseFlag\n"
+ "A collection of use flags."
+ );
}
diff --git a/python/package_database.cc b/python/package_database.cc
index 1583825..e3d662d 100644
--- a/python/package_database.cc
+++ b/python/package_database.cc
@@ -33,6 +33,9 @@ namespace bp = boost::python;
void PALUDIS_VISIBLE expose_package_database()
{
+ /**
+ * Exceptions
+ */
ExceptionRegister::get_instance()->add_exception<PackageDatabaseError>
("PackageDatabaseError", "BaseException",
"A PackageDatabaseError is an error that occurs when performing some operation upon a PackageDatabase.");
@@ -53,60 +56,83 @@ void PALUDIS_VISIBLE expose_package_database()
("NoSuchRepositoryError", "PackageDatabaseLookupError",
"Thrown if there is no Repository in a RepositoryDatabase with the given name.");
+ /**
+ * Enums
+ */
enum_auto("QueryOrder", last_qo);
+ /**
+ * PackageDatabase
+ */
register_shared_ptrs_to_python<PackageDatabase>();
- bp::class_<PackageDatabase, boost::noncopyable>
- pd("PackageDatabase",
- "A PackageDatabase can be queried for Package instances.\n",
- bp::no_init
- );
tr1::shared_ptr<PackageDatabaseEntryCollection>
- (PackageDatabase::*query)(const Query &, const QueryOrder) const = &PackageDatabase::query;
- pd.def("query", query,
- "query(Query, QueryOrder) -> PackageDatabaseEntryCollection\n"
- "Query the repository."
- );
- pd.add_property("favourite_repository", &PackageDatabase::favourite_repository,
- "[ro] RepositoryName\n"
- "Name of our 'favourite' repository"
- );
+ (PackageDatabase::* query)(const Query &, const QueryOrder) const = &PackageDatabase::query;
tr1::shared_ptr<const Repository>
- (PackageDatabase::* fetch_repository)(const RepositoryName &) const =
- &PackageDatabase::fetch_repository;
- pd.def("fetch_repository", fetch_repository,
- "fetch_repository(RepositoryName) -> Repository\n"
- "Fetch a named repository."
- );
- pd.def("fetch_unique_qualified_package_name", &PackageDatabase::fetch_unique_qualified_package_name,
- "fetch_unique_qualified_package_name(PackageNamePart) -> QualifiedPackageName\n"
- "Disambiguate a package name."
- );
- pd.def("more_important_than", &PackageDatabase::more_important_than,
- "more_important_than(RepositoryName, RepositoryName) -> bool\n"
- "Return true if the first repository is more important than the second."
- );
- pd.add_property("repositories",
- bp::range(&PackageDatabase::begin_repositories, &PackageDatabase::end_repositories),
- "[ro] Iterable of Repository\n"
- "Our repositories"
- );
+ (PackageDatabase::* fetch_repository)(const RepositoryName &) const = &PackageDatabase::fetch_repository;
+ bp::class_<PackageDatabase, boost::noncopyable>
+ (
+ "PackageDatabase",
+ "A PackageDatabase can be queried for Package instances.\n",
+ bp::no_init
+ )
+ .def("query", query,
+ "query(Query, QueryOrder) -> PackageDatabaseEntryCollection\n"
+ "Query the repository."
+ )
+
+ .add_property("favourite_repository", &PackageDatabase::favourite_repository,
+ "[ro] RepositoryName\n"
+ "Name of our 'favourite' repository"
+ )
+
+ .def("fetch_repository", fetch_repository,
+ "fetch_repository(RepositoryName) -> Repository\n"
+ "Fetch a named repository."
+ )
+
+ .def("fetch_unique_qualified_package_name", &PackageDatabase::fetch_unique_qualified_package_name,
+ "fetch_unique_qualified_package_name(PackageNamePart) -> QualifiedPackageName\n"
+ "Disambiguate a package name."
+ )
+ .def("more_important_than", &PackageDatabase::more_important_than,
+ "more_important_than(RepositoryName, RepositoryName) -> bool\n"
+ "Return true if the first repository is more important than the second."
+ )
+
+ .add_property("repositories",
+ bp::range(&PackageDatabase::begin_repositories, &PackageDatabase::end_repositories),
+ "[ro] Iterable of Repository\n"
+ "Our repositories"
+ )
+ ;
+
+ /**
+ * PackageDatabaseEntry
+ */
bp::register_ptr_to_python<tr1::shared_ptr<PackageDatabaseEntry> >();
bp::class_<PackageDatabaseEntry>
- pde("PackageDatabaseEntry",
- "Holds an entry in a PackageDatabase, and used to identify"
- " a specific version of a package in a particular repository.",
- bp::init<const QualifiedPackageName &, const VersionSpec &, const RepositoryName &>(
- "__init__(QualifiedPackageName, VersionSpec, RepositoryName)"
- )
- );
- pde.def(bp::self_ns::str(bp::self));
- pde.def("__eq__", &PackageDatabaseEntry::operator==);
- pde.def("__ne__", &py_ne<PackageDatabaseEntry>);
+ (
+ "PackageDatabaseEntry",
+ "Holds an entry in a PackageDatabase, and used to identify"
+ " a specific version of a package in a particular repository.",
+ bp::init<const QualifiedPackageName &, const VersionSpec &, const RepositoryName &>(
+ "__init__(QualifiedPackageName, VersionSpec, RepositoryName)"
+ )
+ )
+ .def(bp::self_ns::str(bp::self))
+
+ .def("__eq__", &PackageDatabaseEntry::operator==)
+
+ .def("__ne__", &py_ne<PackageDatabaseEntry>)
+ ;
+ /**
+ * PackageDatabaseEntryCollection
+ */
class_collection<PackageDatabaseEntryCollection>
- pdec("PackageDatabaseEntryCollection",
- "An iterable collection of PackageDatabaseEntry instances."
- );
+ (
+ "PackageDatabaseEntryCollection",
+ "An iterable collection of PackageDatabaseEntry instances."
+ );
}
diff --git a/python/portage_dep_parser.cc b/python/portage_dep_parser.cc
index 9ddc4d3..5ab274c 100644
--- a/python/portage_dep_parser.cc
+++ b/python/portage_dep_parser.cc
@@ -18,7 +18,6 @@
*/
#include <paludis_python.hh>
-#include <dep_spec.hh>
#include <paludis/portage_dep_parser.hh>
#include <paludis/eapi.hh>
@@ -29,6 +28,9 @@ namespace bp = boost::python;
void PALUDIS_VISIBLE expose_portage_dep_parser()
{
+ /**
+ * Exceptions
+ */
ExceptionRegister::get_instance()->add_exception<DepStringError>
("DepStringError", "BaseException",
"A DepStringError descendent is thrown if an invalid depend string is encountered.");
@@ -42,35 +44,44 @@ void PALUDIS_VISIBLE expose_portage_dep_parser()
("DepStringNestingError", "DepStringParseError",
"Thrown if a dependency string does not have properly balanced parentheses.");
+ /**
+ * PortageDepParser
+ */
bp::class_<PortageDepParser, boost::noncopyable>
- pdp("PortageDepParser",
- "The PortageDepParser converts string representations "
- "of a dependency specification into a DepSpec instance.",
- bp::no_init
- );
- pdp.def("parse_depend", &PortageDepParser::parse_depend,
- "parse_depend(string, EAPI) -> CompositeDepSpec\n"
- "Parse a dependency heirarchy."
- );
- pdp.staticmethod("parse_depend");
- pdp.def("parse_provide", &PortageDepParser::parse_provide,
- "parse_provide(string, EAPI) -> CompositeDepSpec\n"
- "Parse a provide heirarchy."
- );
- pdp.staticmethod("parse_provide");
- pdp.def("parse_restrict", &PortageDepParser::parse_restrict,
- "parse_restrict(string, EAPI) -> CompositeDepSpec\n"
- "Parse a restrict."
- );
- pdp.staticmethod("parse_restrict");
- pdp.def("parse_uri", &PortageDepParser::parse_uri,
- "parse_uri(string, EAPI) -> CompositeDepSpec\n"
- "Parse a uri heirarchy."
- );
- pdp.staticmethod("parse_uri");
- pdp.def("parse_license", &PortageDepParser::parse_license,
- "parse_license(string, EAPI) -> CompositeDepSpec\n"
- "Parse a license heirarchy."
- );
- pdp.staticmethod("parse_license");
+ (
+ "PortageDepParser",
+ "The PortageDepParser converts string representations "
+ "of a dependency specification into a DepSpec instance.",
+ bp::no_init
+ )
+ .def("parse_depend", &PortageDepParser::parse_depend,
+ "parse_depend(string, EAPI) -> CompositeDepSpec\n"
+ "Parse a dependency heirarchy."
+ )
+ .staticmethod("parse_depend")
+
+ .def("parse_provide", &PortageDepParser::parse_provide,
+ "parse_provide(string, EAPI) -> CompositeDepSpec\n"
+ "Parse a provide heirarchy."
+ )
+ .staticmethod("parse_provide")
+
+ .def("parse_restrict", &PortageDepParser::parse_restrict,
+ "parse_restrict(string, EAPI) -> CompositeDepSpec\n"
+ "Parse a restrict."
+ )
+ .staticmethod("parse_restrict")
+
+ .def("parse_uri", &PortageDepParser::parse_uri,
+ "parse_uri(string, EAPI) -> CompositeDepSpec\n"
+ "Parse a uri heirarchy."
+ )
+ .staticmethod("parse_uri")
+
+ .def("parse_license", &PortageDepParser::parse_license,
+ "parse_license(string, EAPI) -> CompositeDepSpec\n"
+ "Parse a license heirarchy."
+ )
+ .staticmethod("parse_license")
+ ;
}
diff --git a/python/query.cc b/python/query.cc
index 7da4373..27c119a 100644
--- a/python/query.cc
+++ b/python/query.cc
@@ -29,73 +29,117 @@ namespace bp = boost::python;
void PALUDIS_VISIBLE expose_query()
{
+ /**
+ * Query
+ */
bp::class_<Query>
- q("Query",
- "Parameter for a PackageDatabase query.",
- bp::no_init
- );
- q.def("__and__", operator&);
+ q(
+ "Query",
+ "Parameter for a PackageDatabase query.",
+ bp::no_init
+ );
+ q.def("__and__", operator&);
/* I need to think about it yet... */
bp::scope query = q;
+ /**
+ * Matches
+ */
bp::class_<query::Matches, bp::bases<Query> >
- qm("Matches",
- "Fetch packages matching a given PackageDepSpec.",
- bp::init<const PackageDepSpec &>("__init__(PackageDepSpec)")
- );
-
+ (
+ "Matches",
+ "Fetch packages matching a given PackageDepSpec.",
+ bp::init<const PackageDepSpec &>("__init__(PackageDepSpec)")
+ );
+
+ /**
+ * Package
+ */
bp::class_<query::Package, bp::bases<Query> >
- qp("Package",
- "Fetch packages with a given package name.",
- bp::init<const QualifiedPackageName &>("__init__(QualifiedPackageName)")
- );
-
+ (
+ "Package",
+ "Fetch packages with a given package name.",
+ bp::init<const QualifiedPackageName &>("__init__(QualifiedPackageName)")
+ );
+
+ /**
+ * Repository
+ */
bp::class_<query::Repository, bp::bases<Query> >
- qr("Repository",
- "Fetch packages in a given repository.",
- bp::init<const RepositoryName &>("__init__(RepositoryName)")
- );
-
+ (
+ "Repository",
+ "Fetch packages in a given repository.",
+ bp::init<const RepositoryName &>("__init__(RepositoryName)")
+ );
+
+ /**
+ * Category
+ */
bp::class_<query::Category, bp::bases<Query> >
- qc("Category",
- "Fetch packages in a given Category.",
- bp::init<const CategoryNamePart &>("__init__(CategoryNamePart)")
- );
-
+ (
+ "Category",
+ "Fetch packages in a given Category.",
+ bp::init<const CategoryNamePart &>("__init__(CategoryNamePart)")
+ );
+
+ /**
+ * NotMasked
+ */
bp::class_<query::NotMasked, bp::bases<Query> >
- qnm("NotMasked",
- "Fetch packages that are not masked.",
- bp::init<>("__init__()")
- );
-
+ (
+ "NotMasked",
+ "Fetch packages that are not masked.",
+ bp::init<>("__init__()")
+ );
+
+ /**
+ * RepositoryHasInstalledInterface
+ */
bp::class_<query::RepositoryHasInstalledInterface, bp::bases<Query> >
- qrhii1("RepositoryHasInstalledInterface",
- "Fetch packages from a repository that has RepositoryInstalledInterface.",
- bp::init<>("__init__()")
- );
-
+ (
+ "RepositoryHasInstalledInterface",
+ "Fetch packages from a repository that has RepositoryInstalledInterface.",
+ bp::init<>("__init__()")
+ );
+
+ /**
+ * RepositoryHasInstallableInterface
+ */
bp::class_<query::RepositoryHasInstallableInterface, bp::bases<Query> >
- qrhii2("RepositoryHasInstallableInterface",
- "Fetch packages from a repository that has RepositoryInstallableInterface.",
- bp::init<>("__init__()")
- );
-
+ (
+ "RepositoryHasInstallableInterface",
+ "Fetch packages from a repository that has RepositoryInstallableInterface.",
+ bp::init<>("__init__()")
+ );
+
+ /**
+ * RepositoryHasUninstallableInterface
+ */
bp::class_<query::RepositoryHasUninstallableInterface, bp::bases<Query> >
- qrhui("RepositoryHasUninstallableInterface",
- "Fetch packages from a repository that has RepositoryUninstallableInterface.",
- bp::init<>("__init__()")
- );
-
+ (
+ "RepositoryHasUninstallableInterface",
+ "Fetch packages from a repository that has RepositoryUninstallableInterface.",
+ bp::init<>("__init__()")
+ );
+
+ /**
+ * InstalledAtRoot
+ */
bp::class_<query::InstalledAtRoot, bp::bases<Query> >
- qiar("InstalledAtRoot",
- "Fetch packages that are installed at a particular root.",
- bp::init<const FSEntry &>("__init__(path)")
- );
-
+ (
+ "InstalledAtRoot",
+ "Fetch packages that are installed at a particular root.",
+ bp::init<const FSEntry &>("__init__(path)")
+ );
+
+ /**
+ * All
+ */
bp::class_<query::All, bp::bases<Query> >
- qa("All",
- "Fetch all packages.",
- bp::init<>("__init__()")
- );
+ (
+ "All",
+ "Fetch all packages.",
+ bp::init<>("__init__()")
+ );
}
diff --git a/python/repository.cc b/python/repository.cc
index 437e226..4e689d7 100644
--- a/python/repository.cc
+++ b/python/repository.cc
@@ -200,6 +200,9 @@ struct RepositoryPortageInterfaceWrapper :
void PALUDIS_VISIBLE expose_repository()
{
+ /**
+ * Exceptions
+ */
ExceptionRegister::get_instance()->add_exception<PackageActionError>
("PackageActionError", "BaseException",
"Parent class for install, uninstall errors.");
@@ -219,341 +222,475 @@ void PALUDIS_VISIBLE expose_repository()
("EnvironmentVariableActionError", "PackageActionError",
"Thrown if an environment variable query fails.");
+ /**
+ * DestinationCollection
+ */
class_collection<DestinationsCollection>
- dc("DestinationsCollection",
- "Iterable of Repository.\n"
- "A set of Destinations."
- );
-
+ (
+ "DestinationsCollection",
+ "Iterable of Repository.\n"
+ "A set of Destinations."
+ );
+
+ /**
+ * RepositoryInfoSection
+ */
bp::to_python_converter<std::pair<const std::string, std::string>,
pair_to_tuple<const std::string, std::string> >();
register_shared_ptrs_to_python<RepositoryInfoSection>();
bp::class_<RepositoryInfoSection, boost::noncopyable>
- ris("RepositoryInfoSection",
- "A section of information about a Repository.",
- bp::init<const std::string &>()
- );
- ris.add_property("heading", &RepositoryInfoSection::heading,
- "[ro] string\n"
- "Heading."
- );
- ris.add_property("kvs", bp::range(&RepositoryInfoSection::begin_kvs, &RepositoryInfoSection::end_kvs),
- "[ro] Iterable of tuples\n"
- "Key-value pairs."
- );
-
+ (
+ "RepositoryInfoSection",
+ "A section of information about a Repository.",
+ bp::init<const std::string &>()
+ )
+ .add_property("heading", &RepositoryInfoSection::heading,
+ "[ro] string\n"
+ "Heading."
+ )
+
+ .add_property("kvs", bp::range(&RepositoryInfoSection::begin_kvs, &RepositoryInfoSection::end_kvs),
+ "[ro] Iterable of tuples\n"
+ "Key-value pairs."
+ )
+ ;
+
+ /**
+ * RepositoryInfo
+ */
register_shared_ptrs_to_python<RepositoryInfo>();
bp::class_<RepositoryInfo, boost::noncopyable>
- ri("RepositoryInfo",
- "Information about a Repository, for the end user.",
- bp::no_init
- );
- ri.add_property("sections", bp::range(&RepositoryInfo::begin_sections, &RepositoryInfo::end_sections),
- "[ro] Iterable of RepositoryInfoSection."
- );
-
+ (
+ "RepositoryInfo",
+ "Information about a Repository, for the end user.",
+ bp::no_init
+ )
+ .add_property("sections", bp::range(&RepositoryInfo::begin_sections, &RepositoryInfo::end_sections),
+ "[ro] Iterable of RepositoryInfoSection."
+ )
+ ;
+
+ /**
+ * Repository
+ */
register_shared_ptrs_to_python<Repository>();
bp::class_<RepositoryWrapper, boost::noncopyable>
- r("Repository",
- "A Repository provides a representation of a physical repository to a PackageDatabase.",
- bp::no_init
- );
- r.def("info", &Repository::info, &RepositoryWrapper::default_info,
- "info() -> RepositoryInfo"
- "Fetch information about the repository."
- );
- r.add_property("name", bp::make_function(&Repository::name,
- bp::return_value_policy<bp::copy_const_reference>()),
- "[ro] RepositoryName\n"
- "Our name."
- );
- r.add_property("format", &Repository::format,
- "[ro] string\n"
- "Our format."
- );
- r.def("has_category_named", &Repository::has_category_named,
- "has_category_named(CategoryNamePart) -> bool\n"
- "Do we have a category with the given name?"
- );
- r.def("has_package_named", &Repository::has_package_named,
- "Do we have a package in the given category with the given name?"
- );
- r.add_property("category_names", &Repository::category_names,
- "[ro] CategoryNamePartCollection\n"
- "Our category names."
- );
- r.def("category_names_containing_package", &Repository::category_names_containing_package,
- "category_names_containing_package(PackageNamePart) -> CategoryNamePartCollection\n"
- "Fetch categories that contain a named package."
- );
- r.def("package_names", &Repository::package_names,
- "package_names(CategoryNamePart) -> QualifiedPackageNameCollection\n"
- "Fetch our package names."
- );
- r.def("version_specs", &Repository::version_specs,
- "version_specs(QualifiedPackageName) -> VersionSpecCollection\n"
- "Fetch our versions."
- );
- r.def("has_version", &Repository::has_version,
- "has_version(QualifiedPackageName, VersionSpec) -> bool\n"
- "Do we have a version spec?"
- );
- r.def("version_metadata", &Repository::version_metadata,
- "version_metadata(QualifiedPackageName, VersionSpec) -> VersionMetadata\n"
- "Fetch metadata."
- );
- r.add_property("mask_interface", bp::make_function(&RepositoryWrapper::get_mask_interface,
- bp::return_internal_reference<>()),
- "[ro] RepositoryMaskInterface"
- );
- r.add_property("use_interface", bp::make_function(&RepositoryWrapper::get_use_interface,
- bp::return_internal_reference<>()),
- "[ro] RepositoryUseInterface"
- );
- r.add_property("installed_interface", bp::make_function(&RepositoryWrapper::get_installed_interface,
- bp::return_internal_reference<>()),
- "[ro] RepositoryInstalledInterface"
- );
- r.add_property("installable_interface", bp::make_function(&RepositoryWrapper::get_installable_interface,
- bp::return_internal_reference<>()),
- "[ro] RepositoryInstallableInterface"
- );
- r.add_property("uninstallable_interface", bp::make_function(&RepositoryWrapper::get_uninstallable_interface,
- bp::return_internal_reference<>()),
- "[ro] RepositoryUninstallableInterface"
- );
- r.add_property("sets_interface", bp::make_function(&RepositoryWrapper::get_sets_interface,
- bp::return_internal_reference<>()),
- "[ro] RepositorySetsInterface"
- );
- r.add_property("syncable_interface", bp::make_function(&RepositoryWrapper::get_syncable_interface,
- bp::return_internal_reference<>()),
- "[ro] RepositorySyncableInterface"
- );
- r.add_property("world_interface", bp::make_function(&RepositoryWrapper::get_world_interface,
- bp::return_internal_reference<>()),
- "[ro] RepositoryWorldInterface"
- );
- r.add_property("environment_variable_interface", bp::make_function(&RepositoryWrapper::get_environment_variable_interface,
- bp::return_internal_reference<>()),
- "[ro] RepositoryEnvironmentInterface"
- );
- r.add_property("mirrors_interface", bp::make_function(&RepositoryWrapper::get_mirrors_interface,
- bp::return_internal_reference<>()),
- "[ro] RepositoryMirrorsInterface"
- );
- r.add_property("virtuals_interface", bp::make_function(&RepositoryWrapper::get_virtuals_interface,
- bp::return_internal_reference<>()),
- "[ro] RepositoryVirtualsInterface"
- );
- r.add_property("provides_interface", bp::make_function(&RepositoryWrapper::get_provides_interface,
- bp::return_internal_reference<>()),
- "[ro] RepositoryProvidesInterface"
- );
- r.add_property("destination_interface", bp::make_function(&RepositoryWrapper::get_destination_interface,
- bp::return_internal_reference<>()),
- "[ro] RepositoryDestinationInterface"
- );
- r.add_property("contents_interface", bp::make_function(&RepositoryWrapper::get_contents_interface,
- bp::return_internal_reference<>()),
- "[ro] RepositoryContentsInterface"
- );
- r.add_property("config_interface", bp::make_function(&RepositoryWrapper::get_config_interface,
- bp::return_internal_reference<>()),
- "[ro] RepositoryConfigInterface"
- );
- r.add_property("licenses_interface", bp::make_function(&RepositoryWrapper::get_licenses_interface,
- bp::return_internal_reference<>()),
- "[ro] RepositoryLicensesInterface"
- );
- r.add_property("portage_interface", bp::make_function(&RepositoryWrapper::get_portage_interface,
- bp::return_internal_reference<>()),
- "[ro] RepositoryPortageInterface"
- );
-
-
+ (
+ "Repository",
+ "A Repository provides a representation of a physical repository to a PackageDatabase.",
+ bp::no_init
+ )
+ .def("info", &Repository::info, &RepositoryWrapper::default_info,
+ "info() -> RepositoryInfo"
+ "Fetch information about the repository."
+ )
+
+ .add_property("name", bp::make_function(&Repository::name,
+ bp::return_value_policy<bp::copy_const_reference>()),
+ "[ro] RepositoryName\n"
+ "Our name."
+ )
+
+ .add_property("format", &Repository::format,
+ "[ro] string\n"
+ "Our format."
+ )
+
+ .def("has_category_named", &Repository::has_category_named,
+ "has_category_named(CategoryNamePart) -> bool\n"
+ "Do we have a category with the given name?"
+ )
+
+ .def("has_package_named", &Repository::has_package_named,
+ "Do we have a package in the given category with the given name?"
+ )
+
+ .add_property("category_names", &Repository::category_names,
+ "[ro] CategoryNamePartCollection\n"
+ "Our category names."
+ )
+
+ .def("category_names_containing_package", &Repository::category_names_containing_package,
+ "category_names_containing_package(PackageNamePart) -> CategoryNamePartCollection\n"
+ "Fetch categories that contain a named package."
+ )
+
+ .def("package_names", &Repository::package_names,
+ "package_names(CategoryNamePart) -> QualifiedPackageNameCollection\n"
+ "Fetch our package names."
+ )
+
+ .def("version_specs", &Repository::version_specs,
+ "version_specs(QualifiedPackageName) -> VersionSpecCollection\n"
+ "Fetch our versions."
+ )
+
+ .def("has_version", &Repository::has_version,
+ "has_version(QualifiedPackageName, VersionSpec) -> bool\n"
+ "Do we have a version spec?"
+ )
+
+ .def("version_metadata", &Repository::version_metadata,
+ "version_metadata(QualifiedPackageName, VersionSpec) -> VersionMetadata\n"
+ "Fetch metadata."
+ )
+
+ .add_property("mask_interface", bp::make_function(&RepositoryWrapper::get_mask_interface,
+ bp::return_internal_reference<>()),
+ "[ro] RepositoryMaskInterface"
+ )
+
+ .add_property("use_interface", bp::make_function(&RepositoryWrapper::get_use_interface,
+ bp::return_internal_reference<>()),
+ "[ro] RepositoryUseInterface"
+ )
+
+ .add_property("installed_interface", bp::make_function(&RepositoryWrapper::get_installed_interface,
+ bp::return_internal_reference<>()),
+ "[ro] RepositoryInstalledInterface"
+ )
+
+ .add_property("installable_interface", bp::make_function(&RepositoryWrapper::get_installable_interface,
+ bp::return_internal_reference<>()),
+ "[ro] RepositoryInstallableInterface"
+ )
+
+ .add_property("uninstallable_interface", bp::make_function(&RepositoryWrapper::get_uninstallable_interface,
+ bp::return_internal_reference<>()),
+ "[ro] RepositoryUninstallableInterface"
+ )
+
+ .add_property("sets_interface", bp::make_function(&RepositoryWrapper::get_sets_interface,
+ bp::return_internal_reference<>()),
+ "[ro] RepositorySetsInterface"
+ )
+
+ .add_property("syncable_interface", bp::make_function(&RepositoryWrapper::get_syncable_interface,
+ bp::return_internal_reference<>()),
+ "[ro] RepositorySyncableInterface"
+ )
+
+ .add_property("world_interface", bp::make_function(&RepositoryWrapper::get_world_interface,
+ bp::return_internal_reference<>()),
+ "[ro] RepositoryWorldInterface"
+ )
+
+ .add_property("environment_variable_interface",
+ bp::make_function(&RepositoryWrapper::get_environment_variable_interface,
+ bp::return_internal_reference<>()),
+ "[ro] RepositoryEnvironmentInterface"
+ )
+
+ .add_property("mirrors_interface", bp::make_function(&RepositoryWrapper::get_mirrors_interface,
+ bp::return_internal_reference<>()),
+ "[ro] RepositoryMirrorsInterface"
+ )
+
+ .add_property("virtuals_interface", bp::make_function(&RepositoryWrapper::get_virtuals_interface,
+ bp::return_internal_reference<>()),
+ "[ro] RepositoryVirtualsInterface"
+ )
+
+ .add_property("provides_interface", bp::make_function(&RepositoryWrapper::get_provides_interface,
+ bp::return_internal_reference<>()),
+ "[ro] RepositoryProvidesInterface"
+ )
+
+ .add_property("destination_interface", bp::make_function(&RepositoryWrapper::get_destination_interface,
+ bp::return_internal_reference<>()),
+ "[ro] RepositoryDestinationInterface"
+ )
+
+ .add_property("contents_interface", bp::make_function(&RepositoryWrapper::get_contents_interface,
+ bp::return_internal_reference<>()),
+ "[ro] RepositoryContentsInterface"
+ )
+
+ .add_property("config_interface", bp::make_function(&RepositoryWrapper::get_config_interface,
+ bp::return_internal_reference<>()),
+ "[ro] RepositoryConfigInterface"
+ )
+
+ .add_property("licenses_interface", bp::make_function(&RepositoryWrapper::get_licenses_interface,
+ bp::return_internal_reference<>()),
+ "[ro] RepositoryLicensesInterface"
+ )
+
+ .add_property("portage_interface", bp::make_function(&RepositoryWrapper::get_portage_interface,
+ bp::return_internal_reference<>()),
+ "[ro] RepositoryPortageInterface"
+ )
+ ;
+
+ /**
+ * RepositoryPortageInterfaceProfilesDescLine
+ */
bp::class_<RepositoryPortageInterfaceProfilesDescLine>
- rpipd("RepositoryPortageInterfaceProfilesDescLine",
- "A profiles.desc line in a Repository implementing RepositoryPortageInterface.",
- bp::no_init
- );
- rpipd.add_property("path", bp::make_getter(&RepositoryPortageInterfaceProfilesDescLine::path,
- bp::return_value_policy<bp::return_by_value>())
- );
- rpipd.def_readonly("arch", &RepositoryPortageInterfaceProfilesDescLine::arch);
- rpipd.def_readonly("status", &RepositoryPortageInterfaceProfilesDescLine::status);
-
- // Interfaces
+ (
+ "RepositoryPortageInterfaceProfilesDescLine",
+ "A profiles.desc line in a Repository implementing RepositoryPortageInterface.",
+ bp::no_init
+ )
+ .add_property("path", bp::make_getter(&RepositoryPortageInterfaceProfilesDescLine::path,
+ bp::return_value_policy<bp::return_by_value>())
+ )
+
+ .def_readonly("arch", &RepositoryPortageInterfaceProfilesDescLine::arch)
+
+ .def_readonly("status", &RepositoryPortageInterfaceProfilesDescLine::status)
+ ;
+
+ /**
+ * RepositoryMaskInterface
+ */
bp::register_ptr_to_python<RepositoryMaskInterface *>();
bp::class_<RepositoryMaskInterface, boost::noncopyable>
- rmaski("RepositoryMaskInterface",
- "Interface for handling masks for the Repository class.",
- bp::no_init
- );
- rmaski.def("query_repository_masks", &RepositoryMaskInterface::query_repository_masks,
- "query_repository_masks(QualifiedPackageName, VersionSpec) -> bool\n"
- "Query repository masks."
- );
- rmaski.def("query_profile_masks", &RepositoryMaskInterface::query_profile_masks,
- "query_profile_masks(QualifiedPackageName, VersionSpec) -> bool\n"
- "Query profile masks."
- );
-
+ (
+ "RepositoryMaskInterface",
+ "Interface for handling masks for the Repository class.",
+ bp::no_init
+ )
+ .def("query_repository_masks", &RepositoryMaskInterface::query_repository_masks,
+ "query_repository_masks(QualifiedPackageName, VersionSpec) -> bool\n"
+ "Query repository masks."
+ )
+
+ .def("query_profile_masks", &RepositoryMaskInterface::query_profile_masks,
+ "query_profile_masks(QualifiedPackageName, VersionSpec) -> bool\n"
+ "Query profile masks."
+ )
+ ;
+
+ /**
+ * RepositoryUseInterface
+ */
bp::register_ptr_to_python<RepositoryUseInterface *>();
bp::class_<RepositoryUseInterface, boost::noncopyable>
- rusei("RepositoryUseInterface",
- "Interface for handling USE flags for the Repository class.",
- bp::no_init
- );
- rusei.def("query_use", &RepositoryUseInterface::query_use,
- ("ufn", bp::arg("pde")),
- "query_use(UseFlagName, PackageDatabaseEntry) -> UseFlagState\n"
- "Query the state of the specified use flag."
- );
- rusei.def("query_use_mask", &RepositoryUseInterface::query_use_mask,
- ("ufn", bp::arg("pde")),
- "query_use_mask(UseFlagName, PackageDatabaseEntry) -> bool\n"
- "Query whether the specified use flag is masked."
- );
- rusei.def("query_use_force", &RepositoryUseInterface::query_use_force,
- ("ufn", bp::arg("pde")),
- "query_use_force(UseFlagName, PackageDatabaseEntry) -> bool\n"
- "Query whether the specified use flag is forceed."
- );
- rusei.def("describe_use_flag", &RepositoryUseInterface::describe_use_flag,
- ("ufn", bp::arg("pde")),
- "describe_use_flag(UseFlagName, PackageDatabaseEntry) -> string\n"
- "Describe a use flag."
- );
-
+ (
+ "RepositoryUseInterface",
+ "Interface for handling USE flags for the Repository class.",
+ bp::no_init
+ )
+ .def("query_use", &RepositoryUseInterface::query_use,
+ ("ufn", bp::arg("pde")),
+ "query_use(UseFlagName, PackageDatabaseEntry) -> UseFlagState\n"
+ "Query the state of the specified use flag."
+ )
+
+ .def("query_use_mask", &RepositoryUseInterface::query_use_mask,
+ ("ufn", bp::arg("pde")),
+ "query_use_mask(UseFlagName, PackageDatabaseEntry) -> bool\n"
+ "Query whether the specified use flag is masked."
+ )
+
+ .def("query_use_force", &RepositoryUseInterface::query_use_force,
+ ("ufn", bp::arg("pde")),
+ "query_use_force(UseFlagName, PackageDatabaseEntry) -> bool\n"
+ "Query whether the specified use flag is forceed."
+ )
+
+ .def("describe_use_flag", &RepositoryUseInterface::describe_use_flag,
+ ("ufn", bp::arg("pde")),
+ "describe_use_flag(UseFlagName, PackageDatabaseEntry) -> string\n"
+ "Describe a use flag."
+ )
+ ;
+
+ /**
+ * RepositoryInstalledInterface
+ */
bp::register_ptr_to_python<RepositoryInstalledInterface *>();
bp::class_<RepositoryInstalledInterface, boost::noncopyable>
- rinstalledi("RepositoryInstalledInterface",
- "Interface for handling actions for installed repositories.",
- bp::no_init
- );
- rinstalledi.def("installed_time", &RepositoryInstalledInterfaceWrapper::installed_time,
- "installed_time(QualifiedPackageName, VersionSpec) -> datetime\n"
- "When was a package installed."
- );
- rinstalledi.def("root", bp::pure_virtual(&RepositoryInstalledInterface::root),
+ (
+ "RepositoryInstalledInterface",
+ "Interface for handling actions for installed repositories.",
+ bp::no_init
+ )
+ .def("installed_time", &RepositoryInstalledInterfaceWrapper::installed_time,
+ "installed_time(QualifiedPackageName, VersionSpec) -> datetime\n"
+ "When was a package installed."
+ )
+ .def("root", bp::pure_virtual(&RepositoryInstalledInterface::root),
"What is our filesystem root?"
- );
+ )
+ ;
+ /**
+ * RepositoryInstallableInterface
+ */
bp::register_ptr_to_python<RepositoryInstallableInterface *>();
bp::class_<RepositoryInstallableInterface, boost::noncopyable>
- rinstallablei("RepositoryInstallableInterface",
- "Interface for handling installs for repositories.",
- bp::no_init
- );
-
+ (
+ "RepositoryInstallableInterface",
+ "Interface for handling installs for repositories.",
+ bp::no_init
+ );
+
+ /**
+ * RepositoryUninstallableInterface
+ */
bp::register_ptr_to_python<RepositoryUninstallableInterface *>();
bp::class_<RepositoryUninstallableInterface, boost::noncopyable>
- runinstallablei("RepositoryUninstallableInterface",
- "Interface for handling uninstalls for repositories.",
- bp::no_init
- );
-
+ (
+ "RepositoryUninstallableInterface",
+ "Interface for handling uninstalls for repositories.",
+ bp::no_init
+ );
+
+ /**
+ * RepositorySetsInterface
+ */
bp::register_ptr_to_python<RepositorySetsInterface *>();
bp::class_<RepositorySetsInterface, boost::noncopyable>
- rsetsi("RepositorySetsInterface",
- "Interface for package sets for repositories.",
- bp::no_init
- );
-
+ (
+ "RepositorySetsInterface",
+ "Interface for package sets for repositories.",
+ bp::no_init
+ );
+
+ /**
+ * RepositorySyncableInterface
+ */
bp::register_ptr_to_python<RepositorySyncableInterface *>();
bp::class_<RepositorySyncableInterface, boost::noncopyable>
- rsynci("RepositorySyncableInterface",
- "Interface for syncing for repositories.",
- bp::no_init
- );
-
+ (
+ "RepositorySyncableInterface",
+ "Interface for syncing for repositories.",
+ bp::no_init
+ );
+
+ /**
+ * RepositoryWorldInterface
+ */
bp::register_ptr_to_python<RepositoryWorldInterface *>();
bp::class_<RepositoryWorldInterface, boost::noncopyable>
- rworldi("RepositoryWorldInterface",
- "Interface for world handling for repositories.",
- bp::no_init
- );
-
+ (
+ "RepositoryWorldInterface",
+ "Interface for world handling for repositories.",
+ bp::no_init
+ );
+
+ /**
+ * RepositoryEnvironmentVariableInterface
+ */
bp::register_ptr_to_python<RepositoryEnvironmentVariableInterface *>();
bp::class_<RepositoryEnvironmentVariableInterface, boost::noncopyable>
- renvvari("RepositoryEnvironmentVariableInterface",
- "Interface for environment variable querying for repositories.",
- bp::no_init
- );
-
+ (
+ "RepositoryEnvironmentVariableInterface",
+ "Interface for environment variable querying for repositories.",
+ bp::no_init
+ );
+
+ /**
+ * RepositoryMirrorsInterface
+ */
bp::register_ptr_to_python<RepositoryMirrorsInterface *>();
bp::class_<RepositoryMirrorsInterface, boost::noncopyable>
- rmirrorsi("RepositoryMirrorsInterface",
- "Interface for mirror querying for repositories.",
- bp::no_init
- );
-
+ (
+ "RepositoryMirrorsInterface",
+ "Interface for mirror querying for repositories.",
+ bp::no_init
+ );
+
+ /**
+ * RepositoryVirtualsInterface
+ */
bp::register_ptr_to_python<RepositoryVirtualsInterface *>();
bp::class_<RepositoryVirtualsInterface, boost::noncopyable>
- rvirtualsi("RepositoryVirtualsInterface",
- "Interface for repositories that define virtuals.",
- bp::no_init
- );
-
+ (
+ "RepositoryVirtualsInterface",
+ "Interface for repositories that define virtuals.",
+ bp::no_init
+ );
+
+ /**
+ * RepositoryProvidesInterface
+ */
bp::register_ptr_to_python<RepositoryProvidesInterface *>();
bp::class_<RepositoryProvidesInterface, boost::noncopyable>
- rprovidesi("RepositoryProvidesInterface",
- "Interface for repositories that provide packages.",
- bp::no_init
- );
-
+ (
+ "RepositoryProvidesInterface",
+ "Interface for repositories that provide packages.",
+ bp::no_init
+ );
+
+ /**
+ * RepositoryDestinationInterface
+ */
bp::register_ptr_to_python<RepositoryDestinationInterface *>();
bp::class_<RepositoryDestinationInterface, boost::noncopyable>
- rdesti("RepositoryDestinationInterface",
- "Interface for repositories that can be used as an install destination.",
- bp::no_init
- );
-
+ (
+ "RepositoryDestinationInterface",
+ "Interface for repositories that can be used as an install destination.",
+ bp::no_init
+ );
+
+ /**
+ * RepositoryContentsInterface
+ */
bp::register_ptr_to_python<RepositoryContentsInterface *>();
bp::class_<RepositoryContentsInterface, boost::noncopyable>
- rcontentsi("RepositoryContentsInterface",
- "Interface for handling actions for repositories supporting contents queries.",
- bp::no_init
- );
- rcontentsi.def("contents", &RepositoryContentsInterface::contents,
- "contents(QualifiedPackageName, VersionSpec) -> Contents\n"
- "Fetch contents."
- );
-
+ (
+ "RepositoryContentsInterface",
+ "Interface for handling actions for repositories supporting contents queries.",
+ bp::no_init
+ )
+ .def("contents", &RepositoryContentsInterface::contents,
+ "contents(QualifiedPackageName, VersionSpec) -> Contents\n"
+ "Fetch contents."
+ )
+ ;
+
+ /**
+ * RepositoryConfigInterface
+ */
bp::register_ptr_to_python<RepositoryConfigInterface *>();
bp::class_<RepositoryConfigInterface, boost::noncopyable>
- rconfigi("RepositoryConfigInterface",
- "Interface for handling actions for repositories supporting package configuration.",
- bp::no_init
- );
-
+ (
+ "RepositoryConfigInterface",
+ "Interface for handling actions for repositories supporting package configuration.",
+ bp::no_init
+ );
+
+ /**
+ * RepositoryLicensesInterface
+ */
bp::register_ptr_to_python<RepositoryLicensesInterface *>();
bp::class_<RepositoryLicensesInterface, boost::noncopyable>
- rlici("RepositoryLicensesInterface",
- "Interface for handling actions relating to licenses.",
- bp::no_init
- );
- rlici.def("license_exists", &RepositoryLicensesInterfaceWrapper::license_exists,
- "license_exists(string) -> path_string or None\n"
- "Check if a license exists."
- );
-
+ (
+ "RepositoryLicensesInterface",
+ "Interface for handling actions relating to licenses.",
+ bp::no_init
+ )
+ .def("license_exists", &RepositoryLicensesInterfaceWrapper::license_exists,
+ "license_exists(string) -> path_string or None\n"
+ "Check if a license exists."
+ )
+ ;
+
+ /**
+ * RepositoryPortageInterface
+ */
bp::register_ptr_to_python<RepositoryPortageInterface *>();
bp::class_<RepositoryPortageInterface, boost::noncopyable>
- rporti("RepositoryPortageInterface",
- "Interface for handling PortageRepository specific functionality.",
- bp::no_init
- );
- rporti.add_property("profiles", bp::range(&RepositoryPortageInterface::begin_profiles,
- &RepositoryPortageInterface::end_profiles),
- "[ro] Iterable of Profiles"
- );
- rporti.def("profile_variable", &RepositoryPortageInterface::profile_variable);
- rporti.def("find_profile", &RepositoryPortageInterfaceWrapper::my_find_profile,
- "find_profile(path_string) -> RepositoryPortageInterfaceProfilesDescLine"
- );
- rporti.add_property("profile", bp::object(), &RepositoryPortageInterfaceWrapper::my_set_profile,
- "[wo] RepositoryPortageInterfaceProfilesDescLine"
- );
+ (
+ "RepositoryPortageInterface",
+ "Interface for handling PortageRepository specific functionality.",
+ bp::no_init
+ )
+ .add_property("profiles", bp::range(&RepositoryPortageInterface::begin_profiles,
+ &RepositoryPortageInterface::end_profiles),
+ "[ro] Iterable of Profiles"
+ )
+
+ .def("profile_variable", &RepositoryPortageInterface::profile_variable)
+
+ .def("find_profile", &RepositoryPortageInterfaceWrapper::my_find_profile,
+ "find_profile(path_string) -> RepositoryPortageInterfaceProfilesDescLine"
+ )
+
+ .add_property("profile", bp::object(), &RepositoryPortageInterfaceWrapper::my_set_profile,
+ "[wo] RepositoryPortageInterfaceProfilesDescLine"
+ )
+ ;
}
diff --git a/python/version_metadata.cc b/python/version_metadata.cc
index 0ea94d6..5adb8cd 100644
--- a/python/version_metadata.cc
+++ b/python/version_metadata.cc
@@ -72,160 +72,221 @@ struct VersionMetadataWrapper
void PALUDIS_VISIBLE expose_version_metadata()
{
+ /**
+ * VersionMetadata
+ */
bp::register_ptr_to_python<tr1::shared_ptr<const VersionMetadata> >();
bp::class_<VersionMetadata, boost::noncopyable>
- vm("VersionMetadata",
- "Version metadata.",
- bp::no_init
- );
- vm.def_readonly("slot", &VersionMetadata::slot,
- "[ro] SlotName"
- );
- vm.def_readonly("homepage", &VersionMetadata::homepage,
- "[ro] DepSpec"
- );
- vm.def_readonly("description", &VersionMetadata::description,
- "[ro] string"
- );
- vm.def_readonly("eapi", &VersionMetadata::eapi,
- "[ro] EAPI"
- );
- vm.add_property("ebuild_interface", bp::make_function(&VersionMetadataWrapper::get_ebuild_interface,
- bp::return_internal_reference<>()),
- "[ro] EbuildInterface"
- );
- vm.add_property("ebin_interface", bp::make_function(&VersionMetadataWrapper::get_ebin_interface,
- bp::return_internal_reference<>()),
- "[ro] EbinInterface"
- );
- vm.add_property("cran_interface", bp::make_function(&VersionMetadataWrapper::get_cran_interface,
- bp::return_internal_reference<>()),
- "[ro] CRANInterface"
- );
- vm.add_property("deps_interface", bp::make_function(&VersionMetadataWrapper::get_deps_interface,
- bp::return_internal_reference<>()),
- "[ro] DepsInterface"
- );
- vm.add_property("origins_interface", bp::make_function(&VersionMetadataWrapper::get_origins_interface,
- bp::return_internal_reference<>()),
- "[ro] OriginsInterface"
- );
- vm.add_property("virtual_interface", bp::make_function(&VersionMetadataWrapper::get_virtual_interface,
- bp::return_internal_reference<>()),
- "[ro] VirtualInterface"
- );
- vm.add_property("license_interface", bp::make_function(&VersionMetadataWrapper::get_license_interface,
- bp::return_internal_reference<>()),
- "[ro] LicenseInterface"
- );
+ (
+ "VersionMetadata",
+ "Version metadata.",
+ bp::no_init
+ )
+ .def_readonly("slot", &VersionMetadata::slot,
+ "[ro] SlotName"
+ )
+ .def_readonly("homepage", &VersionMetadata::homepage,
+ "[ro] DepSpec"
+ )
+
+ .def_readonly("description", &VersionMetadata::description,
+ "[ro] string"
+ )
+
+ .def_readonly("eapi", &VersionMetadata::eapi,
+ "[ro] EAPI"
+ )
+
+ .add_property("ebuild_interface", bp::make_function(&VersionMetadataWrapper::get_ebuild_interface,
+ bp::return_internal_reference<>()),
+ "[ro] EbuildInterface"
+ )
+
+ .add_property("ebin_interface", bp::make_function(&VersionMetadataWrapper::get_ebin_interface,
+ bp::return_internal_reference<>()),
+ "[ro] EbinInterface"
+ )
+
+ .add_property("cran_interface", bp::make_function(&VersionMetadataWrapper::get_cran_interface,
+ bp::return_internal_reference<>()),
+ "[ro] CRANInterface"
+ )
+
+ .add_property("deps_interface", bp::make_function(&VersionMetadataWrapper::get_deps_interface,
+ bp::return_internal_reference<>()),
+ "[ro] DepsInterface"
+ )
+
+ .add_property("origins_interface", bp::make_function(&VersionMetadataWrapper::get_origins_interface,
+ bp::return_internal_reference<>()),
+ "[ro] OriginsInterface"
+ )
+
+ .add_property("virtual_interface", bp::make_function(&VersionMetadataWrapper::get_virtual_interface,
+ bp::return_internal_reference<>()),
+ "[ro] VirtualInterface"
+ )
+
+ .add_property("license_interface", bp::make_function(&VersionMetadataWrapper::get_license_interface,
+ bp::return_internal_reference<>()),
+ "[ro] LicenseInterface"
+ )
+ ;
+
+ /**
+ * VersionMetadataEbuildInterface
+ */
bp::register_ptr_to_python<VersionMetadataEbuildInterface *>();
bp::class_<VersionMetadataEbuildInterface, boost::noncopyable>
- ebuild_i("VersionMetadataEbuildInterface",
- "Version metadata for ebuilds.",
- bp::no_init
- );
-
- ebuild_i.def_readonly("provide", &VersionMetadataEbuildInterface::provide,
- "[ro] DepSpec"
- );
- ebuild_i.def_readonly("src_uri", &VersionMetadataEbuildInterface::src_uri,
- "[ro] DepSpec"
- );
- ebuild_i.def_readonly("restrictions", &VersionMetadataEbuildInterface::restrictions,
- "[ro] DepSpec"
- );
- ebuild_i.def_readonly("keywords", &VersionMetadataEbuildInterface::keywords,
- "[ro] KeywordNameCollection"
- );
- ebuild_i.def_readonly("eclass_keywords", &VersionMetadataEbuildInterface::eclass_keywords,
- "[ro] string"
- );
- ebuild_i.def_readonly("iuse", &VersionMetadataEbuildInterface::iuse,
- "[ro] IUseFlagCollection"
- );
- ebuild_i.def_readonly("inherited", &VersionMetadataEbuildInterface::inherited,
- "[ro] InheritedCollection"
- );
+ (
+ "VersionMetadataEbuildInterface",
+ "Version metadata for ebuilds.",
+ bp::no_init
+ )
+ .def_readonly("provide", &VersionMetadataEbuildInterface::provide,
+ "[ro] DepSpec"
+ )
+
+ .def_readonly("src_uri", &VersionMetadataEbuildInterface::src_uri,
+ "[ro] DepSpec"
+ )
+ .def_readonly("restrictions", &VersionMetadataEbuildInterface::restrictions,
+ "[ro] DepSpec"
+ )
+
+ .def_readonly("keywords", &VersionMetadataEbuildInterface::keywords,
+ "[ro] KeywordNameCollection"
+ )
+
+ .def_readonly("eclass_keywords", &VersionMetadataEbuildInterface::eclass_keywords,
+ "[ro] string"
+ )
+
+ .def_readonly("iuse", &VersionMetadataEbuildInterface::iuse,
+ "[ro] IUseFlagCollection"
+ )
+
+ .def_readonly("inherited", &VersionMetadataEbuildInterface::inherited,
+ "[ro] InheritedCollection"
+ )
+ ;
+
+ /**
+ * VersionMetadataEbinInterface
+ */
bp::register_ptr_to_python<VersionMetadataEbinInterface *>();
bp::class_<VersionMetadataEbinInterface, boost::noncopyable>
- ebin_i("VersionMetadataEbinInterface",
- "Version metadata for Ebins.",
- bp::no_init
- );
- ebin_i.def_readonly("bin_uri", &VersionMetadataEbinInterface::bin_uri,
- "[ro] DepSpec"
- );
+ (
+ "VersionMetadataEbinInterface",
+ "Version metadata for Ebins.",
+ bp::no_init
+ )
+ .def_readonly("bin_uri", &VersionMetadataEbinInterface::bin_uri,
+ "[ro] DepSpec"
+ )
+ ;
+ /**
+ * VersionMetadataCRANInterface
+ */
bp::register_ptr_to_python<VersionMetadataCRANInterface *>();
bp::class_<VersionMetadataCRANInterface, boost::noncopyable>
- cran_i("VersionMetadataCRANInterface",
- "Version metadata for CRAN packages.",
- bp::no_init
- );
- cran_i.def_readonly("keywords", &VersionMetadataCRANInterface::keywords,
- "[ro] string"
- );
- cran_i.def_readonly("package", &VersionMetadataCRANInterface::package,
- "[ro] string"
- );
- cran_i.def_readonly("version", &VersionMetadataCRANInterface::version,
- "[ro] string"
- );
+ (
+ "VersionMetadataCRANInterface",
+ "Version metadata for CRAN packages.",
+ bp::no_init
+ )
+ .def_readonly("keywords", &VersionMetadataCRANInterface::keywords,
+ "[ro] string"
+ )
+
+ .def_readonly("package", &VersionMetadataCRANInterface::package,
+ "[ro] string"
+ )
+ .def_readonly("version", &VersionMetadataCRANInterface::version,
+ "[ro] string"
+ )
+ ;
+
+ /**
+ * VersionMetadataDepsInterface
+ */
bp::register_ptr_to_python<VersionMetadataDepsInterface *>();
bp::class_<VersionMetadataDepsInterface, boost::noncopyable>
- deps_i("VersionMetadataDepsInterface",
- "Dependency data for VersionMetadata.",
- bp::no_init
- );
- deps_i.add_property("build_depend", &VersionMetadataDepsInterface::build_depend,
- "[ro] DepSpec"
- );
- deps_i.add_property("run_depend", &VersionMetadataDepsInterface::run_depend,
- "[ro] DepSpec"
- );
- deps_i.add_property("post_depend", &VersionMetadataDepsInterface::post_depend,
- "[ro] DepSpec"
- );
- deps_i.add_property("suggested_depend", &VersionMetadataDepsInterface::suggested_depend,
- "[ro] DepSpec"
- );
+ (
+ "VersionMetadataDepsInterface",
+ "Dependency data for VersionMetadata.",
+ bp::no_init
+ )
+ .add_property("build_depend", &VersionMetadataDepsInterface::build_depend,
+ "[ro] DepSpec"
+ )
+
+ .add_property("run_depend", &VersionMetadataDepsInterface::run_depend,
+ "[ro] DepSpec"
+ )
+
+ .add_property("post_depend", &VersionMetadataDepsInterface::post_depend,
+ "[ro] DepSpec"
+ )
+ .add_property("suggested_depend", &VersionMetadataDepsInterface::suggested_depend,
+ "[ro] DepSpec"
+ )
+ ;
+
+ /**
+ * VersionMetadataOriginsInterface
+ */
bp::register_ptr_to_python<VersionMetadataOriginsInterface *>();
bp::class_<VersionMetadataOriginsInterface, boost::noncopyable>
- origins_i("VersionMetadataOriginsInterface",
- "Origins data for VersionMetadata.",
- bp::no_init
- );
- origins_i.add_property("source", bp::make_getter(&VersionMetadataOriginsInterface::source,
- bp::return_value_policy<bp::return_by_value>()),
- "[ro] PackageDatabaseEntry"
- );
- origins_i.add_property("binary", bp::make_getter(&VersionMetadataOriginsInterface::binary,
- bp::return_value_policy<bp::return_by_value>()),
- "[ro] PackageDatabaseEntry"
- );
+ (
+ "VersionMetadataOriginsInterface",
+ "Origins data for VersionMetadata.",
+ bp::no_init
+ )
+ .add_property("source", bp::make_getter(&VersionMetadataOriginsInterface::source,
+ bp::return_value_policy<bp::return_by_value>()),
+ "[ro] PackageDatabaseEntry"
+ )
+
+ .add_property("binary", bp::make_getter(&VersionMetadataOriginsInterface::binary,
+ bp::return_value_policy<bp::return_by_value>()),
+ "[ro] PackageDatabaseEntry"
+ )
+ ;
+ /**
+ * VersionMetadataCRANInterface
+ */
bp::register_ptr_to_python<VersionMetadataVirtualInterface *>();
bp::class_<VersionMetadataVirtualInterface, boost::noncopyable>
- virtual_i("VersionMetadataVirtualInterface",
- "Version metadata for virtual packages.",
- bp::no_init
- );
- virtual_i.def_readonly("virtual_for", &VersionMetadataVirtualInterface::virtual_for,
- "[ro] PackageDatabaseEntry"
- );
+ (
+ "VersionMetadataVirtualInterface",
+ "Version metadata for virtual packages.",
+ bp::no_init
+ )
+ .def_readonly("virtual_for", &VersionMetadataVirtualInterface::virtual_for,
+ "[ro] PackageDatabaseEntry"
+ )
+ ;
+ /**
+ * VersionMetadataCRANInterface
+ */
bp::register_ptr_to_python<VersionMetadataLicenseInterface *>();
bp::class_<VersionMetadataLicenseInterface, boost::noncopyable>
- license_i("VersionMetadataLicenseInterface",
- "License data for VersionMetadata.",
- bp::no_init
- );
- license_i.def_readonly("license", &VersionMetadataLicenseInterface::license,
- "[ro] DepSpec"
- );
+ (
+ "VersionMetadataLicenseInterface",
+ "License data for VersionMetadata.",
+ bp::no_init
+ )
+ .def_readonly("license", &VersionMetadataLicenseInterface::license,
+ "[ro] DepSpec"
+ )
+ ;
}
diff --git a/python/version_operator.cc b/python/version_operator.cc
index e6d1076..102d1ff 100644
--- a/python/version_operator.cc
+++ b/python/version_operator.cc
@@ -26,35 +26,52 @@ using namespace paludis;
using namespace paludis::python;
namespace bp = boost::python;
-bool
-vo_compare(const VersionOperator & self, const VersionSpec & v1, const VersionSpec & v2)
+struct VersionOperatorWrapper
{
- return self.as_version_spec_comparator()(v1, v2);
-}
+ // Compare two VersionSpecs
+ static bool
+ compare_vs(const VersionOperator & self, const VersionSpec & v1, const VersionSpec & v2)
+ {
+ return self.as_version_spec_comparator()(v1, v2);
+ }
+};
void PALUDIS_VISIBLE expose_version_operator()
{
+ /**
+ * Exceptions
+ */
ExceptionRegister::get_instance()->add_exception<BadVersionOperatorError>
("BadVersionOperatorError", "BaseException",
"Thrown if a bad version operator is encountered.");
+ /**
+ * Enums
+ */
enum_auto("VersionOperatorValue", last_vo);
- bp::class_<VersionOperator>
- vo("VersionOperator",
- "An operator attached to a VersionSpec, validated.",
- bp::init<const VersionOperatorValue>("__init__(VersionOperatorValue)")
- );
- vo.def(bp::init<const std::string &>("__init__(string)"));
- vo.add_property("value", &VersionOperator::value,
- "[ro] VersionOperatorValue"
- );
- vo.def("compare", &vo_compare,
- "compare(VersionSpec, VersionSpec) -> bool\n"
- "Compare two VersionSpecs with this operator."
- );
- vo.def(bp::self_ns::str(bp::self));
-
+ /**
+ * VersionOperator
+ */
bp::implicitly_convertible<std::string, VersionOperator>();
bp::implicitly_convertible<VersionOperatorValue, VersionOperator>();
+ bp::class_<VersionOperator>
+ (
+ "VersionOperator",
+ "An operator attached to a VersionSpec, validated.",
+ bp::init<const VersionOperatorValue>("__init__(VersionOperatorValue)")
+ )
+ .def(bp::init<const std::string &>("__init__(string)"))
+
+ .add_property("value", &VersionOperator::value,
+ "[ro] VersionOperatorValue"
+ )
+
+ .def("compare", &VersionOperatorWrapper::compare_vs,
+ "compare(VersionSpec, VersionSpec) -> bool\n"
+ "Compare two VersionSpecs with this operator."
+ )
+
+ .def(bp::self_ns::str(bp::self))
+ ;
}
diff --git a/python/version_requirements.cc b/python/version_requirements.cc
index 79bb881..09fa1ac 100644
--- a/python/version_requirements.cc
+++ b/python/version_requirements.cc
@@ -27,25 +27,40 @@ namespace bp = boost::python;
void PALUDIS_VISIBLE expose_version_requirements()
{
+ /**
+ * Enums
+ */
+ enum_auto("VersionRequirementsMode", last_vr);
+
+ /**
+ * VersionRequirement
+ */
bp::class_<VersionRequirement>
- vr("VersionRequirement",
- bp::init<const VersionOperator &, const VersionSpec &>(
- "__init__(VersionOperator, VersionSpec)"
- )
- );
- vr.def_readwrite("version_operator", &VersionRequirement::version_operator,
- "[rw] VersionOperator"
- );
- vr.def_readwrite("version_spec", &VersionRequirement::version_spec,
- "[rw] VersionSpec"
- );
- vr.def("__eq__", &VersionRequirement::operator==);
- vr.def("__ne__", &py_ne<VersionRequirement>);
+ (
+ "VersionRequirement",
+ bp::init<const VersionOperator &, const VersionSpec &>(
+ "__init__(VersionOperator, VersionSpec)"
+ )
+ )
+ .def_readwrite("version_operator", &VersionRequirement::version_operator,
+ "[rw] VersionOperator"
+ )
- enum_auto("VersionRequirementsMode", last_vr);
+ .def_readwrite("version_spec", &VersionRequirement::version_spec,
+ "[rw] VersionSpec"
+ )
+
+ .def("__eq__", &VersionRequirement::operator==)
+
+ .def("__ne__", &py_ne<VersionRequirement>)
+ ;
+ /**
+ * VersionRequirements
+ */
class_collection<VersionRequirements>
- vrc("VersionRequirements",
- "Iterable collection of VersionRequirement instances, usually for a PackageDepSpec."
- );
+ (
+ "VersionRequirements",
+ "Iterable collection of VersionRequirement instances, usually for a PackageDepSpec."
+ );
}
diff --git a/python/version_spec.cc b/python/version_spec.cc
index cc0e0dd..86b23f7 100644
--- a/python/version_spec.cc
+++ b/python/version_spec.cc
@@ -27,41 +27,57 @@ namespace bp = boost::python;
void PALUDIS_VISIBLE expose_version_spec()
{
+ /**
+ * Exceptions
+ */
ExceptionRegister::get_instance()->add_exception<BadVersionSpecError>
("BadVersionSpecError", "BaseException",
"Thrown if a VersionSpec is created from an invalid version string.");
+ /**
+ * VersionSpec
+ */
+ bp::implicitly_convertible<std::string, VersionSpec>();
bp::class_<VersionSpec>
- vs("VersionSpec",
- "A VersionSpec represents a version number (for example, 1.2.3b-r1).",
- bp::init<const std::string &>("__init__(string)")
- );
- vs.def("bump", &VersionSpec::bump,
- "bump() -> VersionSpec\n"
- "This is used by the ~> operator. It returns a VersionSpec where the next to last number "
- "is one greater (e.g. 5.3.1 => 5.4).\n"
- "Any non number parts are stripped (e.g. 1.2.3_alpha4-r5 => 1.3)."
- );
- vs.add_property("is_scm", &VersionSpec::is_scm,
- "[ro] bool\n"
- "Are we an -scm package, or something pretending to be one?"
- );
- vs.def("remove_revision", &VersionSpec::remove_revision,
- "remove_revision() -> VersionSpec\n"
- "Remove the revision part."
- );
- vs.def("revision_only", &VersionSpec::revision_only,
- "revision_only() -> string\n"
- "Revision part only (or \"r0\")."
- );
- vs.def("__cmp__", &VersionSpec::compare);
- vs.def(bp::self_ns::str(bp::self));
+ (
+ "VersionSpec",
+ "A VersionSpec represents a version number (for example, 1.2.3b-r1).",
+ bp::init<const std::string &>("__init__(string)")
+ )
+ .def("bump", &VersionSpec::bump,
+ "bump() -> VersionSpec\n"
+ "This is used by the ~> operator. It returns a VersionSpec where the next to last number "
+ "is one greater (e.g. 5.3.1 => 5.4).\n"
+ "Any non number parts are stripped (e.g. 1.2.3_alpha4-r5 => 1.3)."
+ )
- bp::implicitly_convertible<std::string, VersionSpec>();
+ .add_property("is_scm", &VersionSpec::is_scm,
+ "[ro] bool\n"
+ "Are we an -scm package, or something pretending to be one?"
+ )
+
+ .def("remove_revision", &VersionSpec::remove_revision,
+ "remove_revision() -> VersionSpec\n"
+ "Remove the revision part."
+ )
+
+ .def("revision_only", &VersionSpec::revision_only,
+ "revision_only() -> string\n"
+ "Revision part only (or \"r0\")."
+ )
+
+ .def("__cmp__", &VersionSpec::compare)
+
+ .def(bp::self_ns::str(bp::self))
+ ;
+ /**
+ * VersionSpecCollection
+ */
class_collection<VersionSpecCollection>
- vsc("VersionSpecCollection",
- "Iterable of VersionSpec.\n"
- "Collection of VersionSpec instances."
- );
+ (
+ "VersionSpecCollection",
+ "Iterable of VersionSpec.\n"
+ "Collection of VersionSpec instances."
+ );
}