aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-07-12 16:27:15 +0000
committerAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-07-12 16:27:15 +0000
commit553d2ca2add27e6c09e085b5a5e5d2767a6b26ab (patch)
tree5588e0fb40e4a879f97aab45cfccd759f8332d46
parent9d56f054c5c4c66c38d6c1d0a59328516c4834e5 (diff)
downloadpaludis-553d2ca2add27e6c09e085b5a5e5d2767a6b26ab.tar.gz
paludis-553d2ca2add27e6c09e085b5a5e5d2767a6b26ab.tar.xz
(python) Remove things that've been replaced by actions.
-rw-r--r--python/Makefile.am9
-rwxr-xr-xpython/metadata_key_TEST.py32
-rw-r--r--python/package_id.cc12
-rwxr-xr-xpython/package_id_TEST.py4
-rw-r--r--python/query.cc49
-rwxr-xr-xpython/query_TEST.py8
-rw-r--r--python/repository.cc74
-rwxr-xr-xpython/repository_TEST.py40
8 files changed, 69 insertions, 159 deletions
diff --git a/python/Makefile.am b/python/Makefile.am
index 415bcfb..3e74b53 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -111,7 +111,7 @@ if ENABLE_PYTHON
lib_LTLIBRARIES = libpaludispython.la
libpaludispython_la_CXXFLAGS = $(AM_CXXFLAGS) -I. -I@PYTHON_INCLUDE_DIR@
-libpaludispython_la_LDFLAGS = @BOOST_PYTHON_LIB@
+libpaludispython_la_LDFLAGS = @BOOST_PYTHON_LIB@ $(PTHREAD_LIBS)
paludis_python_so.o : paludis_python_so.cc
if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) \
@@ -133,7 +133,8 @@ libpaludispython_la_LIBADD = \
$(top_builddir)/paludis/environments/no_config/libpaludisnoconfigenvironment.la \
$(top_builddir)/paludis/environments/adapted/libpaludisadaptedenvironment.la \
$(top_builddir)/paludis/environments/test/libpaludistestenvironment.la \
- $(top_builddir)/paludis/environments/libpaludisenvironments.la
+ $(top_builddir)/paludis/environments/libpaludisenvironments.la \
+ $(PTHREAD_LIBS)
# $(top_builddir)/paludis/qa/libpaludisqa.la
TESTS = $(IF_PYTHON_QA_TESTS) $(IF_PYTHON_TESTS)
@@ -152,7 +153,9 @@ libpaludispython_la_LIBADD = \
$(top_builddir)/paludis/environments/paludis/libpaludispaludisenvironment.la \
$(top_builddir)/paludis/environments/no_config/libpaludisnoconfigenvironment.la \
$(top_builddir)/paludis/environments/adapted/libpaludisadaptedenvironment.la \
- $(top_builddir)/paludis/environments/libpaludisenvironments.la
+ $(top_builddir)/paludis/environments/test/libpaludistestenvironment.la \
+ $(top_builddir)/paludis/environments/libpaludisenvironments.la \
+ $(PTHREAD_LIBS)
TESTS = $(IF_PYTHON_TESTS)
diff --git a/python/metadata_key_TEST.py b/python/metadata_key_TEST.py
index 09ceefd..b9f0ebf 100755
--- a/python/metadata_key_TEST.py
+++ b/python/metadata_key_TEST.py
@@ -37,36 +37,36 @@ class TestCase_01_MetadataKeys(unittest.TestCase):
ipid = iter(ie.package_database.fetch_repository("installed").package_ids("cat-one/pkg-one")).next()
def test_01_contents(self):
- self.assertEquals(pid.find("CONTENTS"), None)
- self.assert_(isinstance(ipid.find("CONTENTS"), MetadataContentsKey))
+ self.assertEquals(pid.find_metadata("CONTENTS"), None)
+ self.assert_(isinstance(ipid.find_metadata("CONTENTS"), MetadataContentsKey))
def test_02_installed_time(self):
- self.assertEquals(pid.find("INSTALLED_TIME"), None)
- self.assert_(isinstance(ipid.find("INSTALLED_TIME"), MetadataTimeKey))
+ self.assertEquals(pid.find_metadata("INSTALLED_TIME"), None)
+ self.assert_(isinstance(ipid.find_metadata("INSTALLED_TIME"), MetadataTimeKey))
def test_03_repository(self):
- self.assertEquals(pid.find("REPOSITORY"), None)
- self.assert_(isinstance(ipid.find("REPOSITORY"), MetadataStringKey))
+ self.assertEquals(pid.find_metadata("REPOSITORY"), None)
+ self.assert_(isinstance(ipid.find_metadata("REPOSITORY"), MetadataStringKey))
def test_04_keywords(self):
- self.assert_(isinstance(pid.find("KEYWORDS"), MetadataKeywordNameIterableKey))
- self.assertEquals(ipid.find("KEYWORDS"), None)
+ self.assert_(isinstance(pid.find_metadata("KEYWORDS"), MetadataKeywordNameIterableKey))
+ self.assertEquals(ipid.find_metadata("KEYWORDS"), None)
def test_05_use(self):
- self.assertEquals(pid.find("USE"), None)
- self.assert_(isinstance(ipid.find("USE"), MetadataUseFlagNameIterableKey))
+ self.assertEquals(pid.find_metadata("USE"), None)
+ self.assert_(isinstance(ipid.find_metadata("USE"), MetadataUseFlagNameIterableKey))
def test_06_iuse(self):
- self.assert_(isinstance(pid.find("IUSE"), MetadataIUseFlagIterableKey))
- self.assert_(isinstance(ipid.find("IUSE"), MetadataIUseFlagIterableKey))
+ self.assert_(isinstance(pid.find_metadata("IUSE"), MetadataIUseFlagIterableKey))
+ self.assert_(isinstance(ipid.find_metadata("IUSE"), MetadataIUseFlagIterableKey))
def test_07_inherited(self):
- self.assert_(isinstance(pid.find("INHERITED"), MetadataInheritedIterableKey))
- self.assert_(isinstance(ipid.find("INHERITED"), MetadataInheritedIterableKey))
+ self.assert_(isinstance(pid.find_metadata("INHERITED"), MetadataInheritedIterableKey))
+ self.assert_(isinstance(ipid.find_metadata("INHERITED"), MetadataInheritedIterableKey))
def test_08_depend(self):
- self.assert_(isinstance(pid.find("DEPEND"), MetadataDependencySpecTreeKey))
- self.assertEquals(ipid.find("DEPEND"), None)
+ self.assert_(isinstance(pid.find_metadata("DEPEND"), MetadataDependencySpecTreeKey))
+ self.assertEquals(ipid.find_metadata("DEPEND"), None)
if __name__ == "__main__":
unittest.main()
diff --git a/python/package_id.cc b/python/package_id.cc
index 01e96cf..1222b2c 100644
--- a/python/package_id.cc
+++ b/python/package_id.cc
@@ -34,10 +34,10 @@ namespace bp = boost::python;
struct PackageIDWrapper
{
static PyObject *
- find(const PackageID & self, const std::string & key)
+ find_metadata(const PackageID & self, const std::string & key)
{
- PackageID::Iterator i(self.find(key));
- if (i != self.end())
+ PackageID::MetadataIterator i(self.find_metadata(key));
+ if (i != self.end_metadata())
return bp::incref(bp::object(*i).ptr());
else
return Py_None;
@@ -85,10 +85,10 @@ void PALUDIS_VISIBLE expose_package_id()
"[ro] EAPI\n"
)
- .def("__iter__", bp::range(&PackageID::begin, &PackageID::end))
+ .def("__iter__", bp::range(&PackageID::begin_metadata, &PackageID::end_metadata))
- .def("find", &PackageIDWrapper::find,
- "find(string) -> MetadataKey\n"
+ .def("find_metadata", &PackageIDWrapper::find_metadata,
+ "find_metadata(string) -> MetadataKey\n"
)
.def("__eq__", &py_eq<PackageID>)
diff --git a/python/package_id_TEST.py b/python/package_id_TEST.py
index adcf44d..4032200 100755
--- a/python/package_id_TEST.py
+++ b/python/package_id_TEST.py
@@ -68,8 +68,8 @@ class TestCase_01_PackageID(unittest.TestCase):
self.assertEquals(ipid.canonical_form(PackageIDCanonicalForm.VERSION), "1")
self.assertEquals(ipid.canonical_form(PackageIDCanonicalForm.NO_VERSION), "cat-one/pkg-one::installed")
- def test_08_find(self):
- self.assert_(isinstance(pid.find("DEPEND"), MetadataDependencySpecTreeKey))
+ def test_08_find_metadata(self):
+ self.assert_(isinstance(pid.find_metadata("DEPEND"), MetadataDependencySpecTreeKey))
if __name__ == "__main__":
unittest.main()
diff --git a/python/query.cc b/python/query.cc
index 27c119a..84d7450 100644
--- a/python/query.cc
+++ b/python/query.cc
@@ -27,6 +27,22 @@ using namespace paludis;
using namespace paludis::python;
namespace bp = boost::python;
+template <typename A_>
+class class_supports_action :
+ public bp::class_<query::SupportsAction<A_>, bp::bases<Query> >
+{
+ public:
+ class_supports_action(const std::string & action) :
+ bp::class_<query::SupportsAction<A_>, bp::bases<Query> >(
+ ("Supports" + action + "Action").c_str(),
+ ("Fetch packages that support " + action + "Action.").c_str(),
+ bp::init<>("__init__()")
+ )
+ {
+ }
+};
+
+
void PALUDIS_VISIBLE expose_query()
{
/**
@@ -94,34 +110,13 @@ void PALUDIS_VISIBLE expose_query()
);
/**
- * RepositoryHasInstalledInterface
- */
- bp::class_<query::RepositoryHasInstalledInterface, bp::bases<Query> >
- (
- "RepositoryHasInstalledInterface",
- "Fetch packages from a repository that has RepositoryInstalledInterface.",
- bp::init<>("__init__()")
- );
-
- /**
- * RepositoryHasInstallableInterface
+ * SupportsAction
*/
- bp::class_<query::RepositoryHasInstallableInterface, bp::bases<Query> >
- (
- "RepositoryHasInstallableInterface",
- "Fetch packages from a repository that has RepositoryInstallableInterface.",
- bp::init<>("__init__()")
- );
-
- /**
- * RepositoryHasUninstallableInterface
- */
- bp::class_<query::RepositoryHasUninstallableInterface, bp::bases<Query> >
- (
- "RepositoryHasUninstallableInterface",
- "Fetch packages from a repository that has RepositoryUninstallableInterface.",
- bp::init<>("__init__()")
- );
+ class_supports_action<InstallAction>("Install");
+ class_supports_action<UninstallAction>("Uninstall");
+ class_supports_action<InstalledAction>("Installed");
+ class_supports_action<PretendAction>("Pretend");
+ class_supports_action<ConfigAction>("Config");
/**
* InstalledAtRoot
diff --git a/python/query_TEST.py b/python/query_TEST.py
index d4aa4b5..85826c8 100755
--- a/python/query_TEST.py
+++ b/python/query_TEST.py
@@ -24,9 +24,11 @@ import unittest
class TestCase_Queries(unittest.TestCase):
def test_1_create(self):
self.queries = []
- self.queries.append(Query.RepositoryHasInstallableInterface())
- self.queries.append(Query.RepositoryHasInstalledInterface())
- self.queries.append(Query.RepositoryHasUninstallableInterface())
+ self.queries.append(Query.SupportsInstallAction())
+ self.queries.append(Query.SupportsUninstallAction())
+ self.queries.append(Query.SupportsInstalledAction())
+ self.queries.append(Query.SupportsPretendAction())
+ self.queries.append(Query.SupportsConfigAction())
self.queries.append(Query.InstalledAtRoot("/bar"))
self.queries.append(Query.NotMasked())
self.queries.append(Query.Package("foo/bar"))
diff --git a/python/repository.cc b/python/repository.cc
index 5ccafcb..1b6c873 100644
--- a/python/repository.cc
+++ b/python/repository.cc
@@ -51,18 +51,6 @@ struct RepositoryWrapper :
return Repository::info(verbose);
}
- static RepositoryInstallableInterface *
- get_installable_interface(const Repository & self)
- {
- return self.installable_interface;
- }
-
- static RepositoryInstalledInterface *
- get_installed_interface(const Repository & self)
- {
- return self.installed_interface;
- }
-
static RepositoryMaskInterface *
get_mask_interface(const Repository & self)
{
@@ -81,12 +69,6 @@ struct RepositoryWrapper :
return self.syncable_interface;
}
- static RepositoryUninstallableInterface *
- get_uninstallable_interface(const Repository & self)
- {
- return self.uninstallable_interface;
- }
-
static RepositoryUseInterface *
get_use_interface(const Repository & self)
{
@@ -129,12 +111,6 @@ struct RepositoryWrapper :
return self.destination_interface;
}
- static RepositoryConfigInterface *
- get_config_interface(const Repository & self)
- {
- return self.config_interface;
- }
-
static RepositoryLicensesInterface *
get_licenses_interface(const Repository & self)
{
@@ -350,21 +326,6 @@ void PALUDIS_VISIBLE expose_repository()
"[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"
@@ -406,11 +367,6 @@ void PALUDIS_VISIBLE expose_repository()
"[ro] RepositoryDestinationInterface"
)
- .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"
@@ -509,26 +465,6 @@ void PALUDIS_VISIBLE expose_repository()
;
/**
- * RepositoryInstallableInterface
- */
- bp::class_<RepositoryInstallableInterface, boost::noncopyable>
- (
- "RepositoryInstallableInterface",
- "Interface for handling installs for repositories.",
- bp::no_init
- );
-
- /**
- * RepositoryUninstallableInterface
- */
- bp::class_<RepositoryUninstallableInterface, boost::noncopyable>
- (
- "RepositoryUninstallableInterface",
- "Interface for handling uninstalls for repositories.",
- bp::no_init
- );
-
- /**
* RepositorySetsInterface
*/
bp::class_<RepositorySetsInterface, boost::noncopyable>
@@ -609,16 +545,6 @@ void PALUDIS_VISIBLE expose_repository()
);
/**
- * RepositoryConfigInterface
- */
- bp::class_<RepositoryConfigInterface, boost::noncopyable>
- (
- "RepositoryConfigInterface",
- "Interface for handling actions for repositories supporting package configuration.",
- bp::no_init
- );
-
- /**
* RepositoryLicensesInterface
*/
bp::class_<RepositoryLicensesInterface, boost::noncopyable>
diff --git a/python/repository_TEST.py b/python/repository_TEST.py
index 820e51c..e2007ee 100755
--- a/python/repository_TEST.py
+++ b/python/repository_TEST.py
@@ -108,15 +108,7 @@ class TestCase_02_RepositoryInterfaces(unittest.TestCase):
repo = db.fetch_repository("testrepo")
irepo = db.fetch_repository("installed")
- def test_01_installable_interface(self):
- ii = repo.installable_interface
- self.assert_(isinstance(ii, RepositoryInstallableInterface))
-
- def test_02_installed_interface(self):
- ii = irepo.installed_interface
- self.assert_(isinstance(ii, RepositoryInstalledInterface))
-
- def test_03_mask_interface(self):
+ def test_01_mask_interface(self):
mi = repo.mask_interface
self.assert_(isinstance(mi, RepositoryMaskInterface))
@@ -129,19 +121,15 @@ class TestCase_02_RepositoryInterfaces(unittest.TestCase):
self.assert_(mi.query_profile_masks(foo[2]))
self.assert_(not mi.query_profile_masks(foo[3]))
- def test_04_sets_interface(self):
+ def test_02_sets_interface(self):
si = repo.sets_interface
self.assert_(isinstance(si, RepositorySetsInterface))
- def test_05_syncable_interface(self):
+ def test_03_syncable_interface(self):
si = repo.syncable_interface
self.assert_(isinstance(si, RepositorySyncableInterface))
- def test_06_uninstallable_interface(self):
- ui = irepo.uninstallable_interface
- self.assert_(isinstance(ui, RepositoryUninstallableInterface))
-
- def test_07_use_interface(self):
+ def test_04_use_interface(self):
ui = repo.use_interface
self.assert_(isinstance(ui, RepositoryUseInterface))
@@ -173,42 +161,38 @@ class TestCase_02_RepositoryInterfaces(unittest.TestCase):
self.assert_(ui.describe_use_flag("test1", pid), "A test use flag")
- def test_08_world_interface(self):
+ def test_05_world_interface(self):
wi = irepo.world_interface
self.assert_(isinstance(wi, RepositoryWorldInterface))
- def test_09_environment_variable_interface(self):
+ def test_06_environment_variable_interface(self):
evi = repo.environment_variable_interface
self.assert_(isinstance(evi, RepositoryEnvironmentVariableInterface))
- def test_10_mirrors_interface(self):
+ def test_07_mirrors_interface(self):
mi = repo.mirrors_interface
self.assert_(isinstance(mi, RepositoryMirrorsInterface))
- def test_11_provides_interface(self):
+ def test_08_provides_interface(self):
pi = irepo.provides_interface
self.assert_(isinstance(pi, RepositoryProvidesInterface))
- def test_12_virtuals_interface(self):
+ def test_09_virtuals_interface(self):
vi = repo.virtuals_interface
self.assert_(isinstance(vi, RepositoryVirtualsInterface))
- def test_13_destination_interface(self):
+ def test_10_destination_interface(self):
di = irepo.destination_interface
self.assert_(isinstance(di, RepositoryDestinationInterface))
- def test_14_config_interface(self):
- ci = irepo.config_interface
- self.assert_(isinstance(ci, RepositoryConfigInterface))
-
- def test_15_licenses_interface(self):
+ def test_11_licenses_interface(self):
li = repo.licenses_interface
self.assert_(isinstance(li, RepositoryLicensesInterface))
self.assertEquals(os.path.realpath(li.license_exists("foo")), os.path.join(repo_path, "licenses/foo"))
self.assertEquals(li.license_exists("bad"), None)
- def test_16_e_interface(self):
+ def test_12_e_interface(self):
ei = nce.main_repository
ei = nce.main_repository.e_interface