aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-26 18:58:38 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-26 19:00:38 +0000
commit5c2a332b70243cb583a29bb74f712bfca2c1fb76 (patch)
tree0a01f8e624caa2c6639181df45fa80bc20adba84 /python
parent79d9f02fb355d81c472f3d94b8b85d5a7639210c (diff)
downloadpaludis-5c2a332b70243cb583a29bb74f712bfca2c1fb76.tar.gz
paludis-5c2a332b70243cb583a29bb74f712bfca2c1fb76.tar.xz
Use Environment rather than PackageDatabase
Diffstat (limited to 'python')
-rw-r--r--python/Makefile.am3
-rw-r--r--python/additional_tests.cc5
-rw-r--r--python/choices_TEST.py6
-rw-r--r--python/environment.cc112
-rwxr-xr-xpython/environment_TEST.py25
-rwxr-xr-xpython/metadata_key_TEST.py6
-rw-r--r--python/package_database.cc99
-rwxr-xr-xpython/package_database_TEST.py62
-rwxr-xr-xpython/package_database_TEST_cleanup.sh8
-rwxr-xr-xpython/package_database_TEST_setup.sh89
-rwxr-xr-xpython/package_id_TEST.py8
-rw-r--r--python/paludis_python.hh1
-rw-r--r--python/paludis_python_so.cc1
-rw-r--r--python/repository.cc4
-rwxr-xr-xpython/repository_TEST.py14
15 files changed, 124 insertions, 319 deletions
diff --git a/python/Makefile.am b/python/Makefile.am
index 4164596f0..4a275959e 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -38,7 +38,6 @@ IF_PYTHON_TESTS = \
mask_TEST.py \
metadata_key_TEST.py \
name_TEST.py \
- package_database_TEST.py \
package_id_TEST.py \
repository_TEST.py \
selection_TEST.py \
@@ -70,7 +69,6 @@ IF_PYTHON_SOURCES = \
name.cc \
nice_names-nn.hh nice_names-nn.cc \
log.cc \
- package_database.cc \
package_id.cc \
repository.cc \
selection.cc \
@@ -89,7 +87,6 @@ EXTRA_DIST = $(IF_PYTHON_TESTS) $(IF_PYTHON_SOURCES) \
mask_TEST_setup.sh mask_TEST_cleanup.sh \
metadata_key_TEST_setup.sh metadata_key_TEST_cleanup.sh \
nice_names.nn \
- package_database_TEST_setup.sh package_database_TEST_cleanup.sh \
package_id_TEST_setup.sh package_id_TEST_cleanup.sh \
repository_TEST_setup.sh repository_TEST_cleanup.sh \
paludis_output_wrapper.py
diff --git a/python/additional_tests.cc b/python/additional_tests.cc
index ee0b13e5d..68e08bf0b 100644
--- a/python/additional_tests.cc
+++ b/python/additional_tests.cc
@@ -28,7 +28,6 @@
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/environment.hh>
#include <paludis/environments/test/test_environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repositories/fake/fake_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/mask.hh>
@@ -50,7 +49,7 @@ namespace environment
n::environment() = &e,
n::name() = RepositoryName("fakerepo"))));
std::shared_ptr<PackageID> pid(repo->add_version("cat", "pkg", "1.0"));
- e.package_database()->add_repository(0, repo);
+ e.add_repository(0, repo);
bool PALUDIS_ATTRIBUTE((unused)) b2(e.accept_license("l", pid));
@@ -64,8 +63,6 @@ namespace environment
bool PALUDIS_ATTRIBUTE((unused)) b4(e.unmasked_by_user(pid, ""));
- e.package_database();
-
e.bashrc_files();
e.syncers_dirs();
diff --git a/python/choices_TEST.py b/python/choices_TEST.py
index b824d3240..ad69d1f64 100644
--- a/python/choices_TEST.py
+++ b/python/choices_TEST.py
@@ -32,7 +32,7 @@ Log.instance.log_level = LogLevel.WARNING
class TestCase_01_Choices(unittest.TestCase):
def setUp(self):
self.e = NoConfigEnvironment(repo_path, "/var/empty")
- self.pid = iter(self.e.package_database.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
+ self.pid = iter(self.e.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
self.choices = self.pid.find_metadata("PALUDIS_CHOICES").value()
def test_01_choices(self):
@@ -58,7 +58,7 @@ class TestCase_01_Choices(unittest.TestCase):
class TestCase_02_Choice(unittest.TestCase):
def setUp(self):
self.e = NoConfigEnvironment(repo_path, "/var/empty")
- self.pid = iter(self.e.package_database.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
+ self.pid = iter(self.e.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
self.choices = self.pid.find_metadata("PALUDIS_CHOICES").value()
self.use = None
self.linguas = None
@@ -107,7 +107,7 @@ class TestCase_02_Choice(unittest.TestCase):
class TestCase_03_ChoiceValue(unittest.TestCase):
def setUp(self):
self.e = NoConfigEnvironment(repo_path, "/var/empty")
- self.pid = iter(self.e.package_database.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
+ self.pid = iter(self.e.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
self.choices = self.pid.find_metadata("PALUDIS_CHOICES").value()
self.use_testflag = self.choices.find_by_name_with_prefix("testflag")
self.linguas_en = self.choices.find_by_name_with_prefix("linguas_en")
diff --git a/python/environment.cc b/python/environment.cc
index 71dca0f36..d208bb2f2 100644
--- a/python/environment.cc
+++ b/python/environment.cc
@@ -21,21 +21,26 @@
#include <python/exception.hh>
#include <python/iterable.hh>
-#include <paludis/environment.hh>
-#include <paludis/environment_factory.hh>
#include <paludis/environments/paludis/paludis_environment.hh>
#include <paludis/environments/paludis/paludis_config.hh>
+
#include <paludis/environments/no_config/no_config_environment.hh>
+
#include <paludis/environments/test/test_environment.hh>
+
#include <paludis/hook.hh>
#include <paludis/package_id.hh>
#include <paludis/selection.hh>
#include <paludis/spec_tree.hh>
+#include <paludis/filter.hh>
+#include <paludis/standard_output_manager.hh>
+#include <paludis/environment.hh>
+#include <paludis/environment_factory.hh>
+
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/tribool.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/make_null_shared_ptr.hh>
-#include <paludis/standard_output_manager.hh>
using namespace paludis;
using namespace paludis::python;
@@ -45,12 +50,8 @@ class EnvironmentImplementationWrapper :
public EnvironmentImplementation,
public bp::wrapper<EnvironmentImplementation>
{
- private:
- std::shared_ptr<PackageDatabase> _db;
-
public:
- EnvironmentImplementationWrapper() :
- _db(std::make_shared<PackageDatabase>(this))
+ EnvironmentImplementationWrapper()
{
}
@@ -119,18 +120,6 @@ class EnvironmentImplementationWrapper :
throw PythonMethodNotImplemented("EnvironmentImplementation", "unmasked_by_user");
}
- virtual std::shared_ptr<PackageDatabase> package_database()
- PALUDIS_ATTRIBUTE((warn_unused_result))
- {
- return _db;
- }
-
- virtual std::shared_ptr<const PackageDatabase> package_database() const
- PALUDIS_ATTRIBUTE((warn_unused_result))
- {
- return _db;
- }
-
virtual std::shared_ptr<const FSPathSequence> bashrc_files() const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
@@ -429,8 +418,16 @@ class EnvironmentImplementationWrapper :
{
throw PythonMethodNotImplemented("EnvironmentImplementation", "update_config_files_for_package_move");
}
+
+ virtual QualifiedPackageName fetch_unique_qualified_package_name(
+ const PackageNamePart &, const Filter & = all_filter(), const bool disambiguate = true) const
+ {
+ throw PythonMethodNotImplemented("EnvironmentImplementation", "fetch_unique_qualified_package_name");
+ }
};
+BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(fetch_unique_qualified_package_name_overloads, fetch_unique_qualified_package_name, 1, 3)
+
struct NoConfigEnvironmentWrapper :
NoConfigEnvironment
{
@@ -495,11 +492,11 @@ void expose_environment()
)
;
+ const std::shared_ptr<Repository> (Environment::* fetch_repository_ptr)(const RepositoryName &) = &Environment::fetch_repository;
+
/**
* Environment
*/
- std::shared_ptr<PackageDatabase> (Environment::* package_database)() =
- &Environment::package_database;
bp::class_<Environment, std::shared_ptr<Environment>, boost::noncopyable>
(
"Environment",
@@ -507,11 +504,6 @@ void expose_environment()
"and provides various methods for querying package visibility and options.",
bp::no_init
)
- .add_property("package_database", bp::make_function(package_database,
- bp::with_custodian_and_ward_postcall<0, 1>()),
- "[ro] PackageDatabase\n"
- "Our package database."
- )
.def("set", &Environment::set,
"set(SetName) -> DepSpec\n"
@@ -527,6 +519,30 @@ void expose_environment()
"[selection] -> list of PackageID\n"
"Return PackageID instances matching a given selection."
)
+
+ .def("fetch_repository", fetch_repository_ptr, bp::with_custodian_and_ward_postcall<0, 1>(),
+ "fetch_repository(RepositoryName) -> Repository\n"
+ "Fetch a named repository."
+ )
+
+ .def("fetch_unique_qualified_package_name", &Environment::fetch_unique_qualified_package_name,
+ fetch_unique_qualified_package_name_overloads(
+ "fetch_unique_qualified_package_name(PackageNamePart[, Filter[, bool]]) -> QualifiedPackageName\n"
+ "Disambiguate a package name. If a filter is specified, "
+ "limit the potential results to packages that match."
+ )
+ )
+
+ .def("more_important_than", &Environment::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(&Environment::begin_repositories, &Environment::end_repositories),
+ "[ro] Iterable of Repository\n"
+ "Our repositories"
+ )
;
/**
@@ -534,6 +550,7 @@ void expose_environment()
*/
typedef EnvironmentImplementation EnvImp;
typedef EnvironmentImplementationWrapper EnvImpW;
+
bp::class_<EnvironmentImplementationWrapper, std::shared_ptr<EnvironmentImplementationWrapper>,
bp::bases<Environment>, boost::noncopyable>
(
@@ -631,6 +648,31 @@ void expose_environment()
"[selection] -> list of PackageID\n"
"Return PackageID instances matching a given selection."
)
+
+ .def("fetch_repository", fetch_repository_ptr, bp::with_custodian_and_ward_postcall<0, 1>(),
+ "fetch_repository(RepositoryName) -> Repository\n"
+ "Fetch a named repository."
+ )
+
+ .def("fetch_unique_qualified_package_name", &EnvImpW::fetch_unique_qualified_package_name,
+ fetch_unique_qualified_package_name_overloads(
+ "fetch_unique_qualified_package_name(PackageNamePart[, Filter[, bool]]) -> QualifiedPackageName\n"
+ "Disambiguate a package name. If a filter is specified, "
+ "limit the potential results to packages that match."
+ )
+ )
+
+ .def("more_important_than", &EnvImpW::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(&EnvImpW::begin_repositories, &EnvImpW::end_repositories),
+ "[ro] Iterable of Repository\n"
+ "Our repositories"
+ )
+ ;
;
/**
@@ -688,5 +730,21 @@ void expose_environment()
"control all the options rather than reading them from configuration files.",
bp::init<>("__init__()")
);
+
+ ExceptionRegister::get_instance()->add_exception<DuplicateRepositoryError>
+ ("DuplicateRepositoryError", "BaseException",
+ "Thrown if a Repository with the same name as an existing member is added to an Environment.");
+
+ ExceptionRegister::get_instance()->add_exception<AmbiguousPackageNameError>
+ ("AmbiguousPackageNameError", "BaseException",
+ "Thrown if an Environment query results in more than one matching Package.");
+
+ ExceptionRegister::get_instance()->add_exception<NoSuchPackageError>
+ ("NoSuchPackageError", "BaseException",
+ "Thrown if there is no Package in an Environment with the given name.");
+
+ ExceptionRegister::get_instance()->add_exception<NoSuchRepositoryError>
+ ("NoSuchRepositoryError", "BaseException",
+ "Thrown if there is no Repository in a RepositoryDatabase with the given name.");
}
diff --git a/python/environment_TEST.py b/python/environment_TEST.py
index 0e580eda1..a9e62d697 100755
--- a/python/environment_TEST.py
+++ b/python/environment_TEST.py
@@ -51,10 +51,6 @@ class TestCase_01_Environments(unittest.TestCase):
def test_03_subclass(self):
self.assert_(isinstance(NoConfigEnvironment(repo), Environment))
- def test_06_package_database(self):
- self.assert_(isinstance(self.e.package_database, PackageDatabase))
- self.assert_(isinstance(self.nce.package_database, PackageDatabase))
-
def test_07_sets(self):
self.assert_(isinstance(self.e.set("everything"), AllDepSpec))
self.assert_(isinstance(self.nce.set("everything"), AllDepSpec))
@@ -73,9 +69,28 @@ class TestCase_01_Environments(unittest.TestCase):
def test_12_config_dir(self):
self.assert_(isinstance(self.e.config_dir, str))
+ def test_23_fech_unique_qpn(self):
+ self.assertEqual(str(QualifiedPackageName("foo/bar")), str(self.e.fetch_unique_qualified_package_name("bar")))
+ self.assertEqual(str(QualifiedPackageName("foo/bar")), str(self.e.fetch_unique_qualified_package_name("bar",
+ Filter.SupportsInstallAction())))
+
+ def test_24_exceptions(self):
+ self.assertRaises(NoSuchPackageError, self.e.fetch_unique_qualified_package_name, "baz")
+ self.assertRaises(NoSuchPackageError, self.e.fetch_unique_qualified_package_name, "foobarbaz")
+ self.assertRaises(NoSuchPackageError, self.e.fetch_unique_qualified_package_name, "bar",
+ Filter.SupportsUninstallAction())
+
+ def test_26_repositories(self):
+ if os.environ.get("PALUDIS_ENABLE_VIRTUALS_REPOSITORY") == "yes":
+ self.assert_(self.e.more_important_than("testrepo", "virtuals"))
+ self.assert_(not self.e.more_important_than("virtuals", "testrepo"))
+ self.assertRaises(NoSuchRepositoryError, self.e.fetch_repository, "blah")
+
+ self.assertEqual(len(list(self.e.repositories)), 3)
+
class TestCase_03_TestEnvironment(unittest.TestCase):
def test_01_create(self):
- env = TestEnvironment()
+ e = TestEnvironment()
class TestCase_04_Environment_subclassingd(unittest.TestCase):
class SubEnv(EnvironmentImplementation):
diff --git a/python/metadata_key_TEST.py b/python/metadata_key_TEST.py
index 9d6a74a2e..b428a3081 100755
--- a/python/metadata_key_TEST.py
+++ b/python/metadata_key_TEST.py
@@ -34,8 +34,8 @@ class TestCase_01_MetadataKeys(unittest.TestCase):
def setUp(self):
self.e = NoConfigEnvironment(repo_path, "/var/empty")
self.ie = NoConfigEnvironment(irepo_path)
- self.pid = iter(self.e.package_database.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
- self.ipid = iter(self.ie.package_database.fetch_repository("installed").package_ids("cat-one/pkg-one", [])).next()
+ self.pid = iter(self.e.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
+ self.ipid = iter(self.ie.fetch_repository("installed").package_ids("cat-one/pkg-one", [])).next()
def test_01_contents(self):
self.assertEquals(self.pid.find_metadata("CONTENTS"), None)
@@ -73,7 +73,7 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase):
def value(self):
e = NoConfigEnvironment(repo_path, "/var/empty")
- pid = iter(e.package_database.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
+ pid = iter(e.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
return pid
def raw_name(self):
diff --git a/python/package_database.cc b/python/package_database.cc
deleted file mode 100644
index f14b412fc..000000000
--- a/python/package_database.cc
+++ /dev/null
@@ -1,99 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 Piotr Jaroszyński
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <python/paludis_python.hh>
-#include <python/exception.hh>
-
-#include <paludis/dep_spec.hh>
-#include <paludis/environment.hh>
-#include <paludis/filter.hh>
-#include <paludis/package_id.hh>
-#include <paludis/package_database.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-
-using namespace paludis;
-using namespace paludis::python;
-namespace bp = boost::python;
-
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(
- fetch_unique_qualified_package_name_overloads, fetch_unique_qualified_package_name, 1, 2)
-
-void 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.");
- ExceptionRegister::get_instance()->add_exception<DuplicateRepositoryError>
- ("DuplicateRepositoryError", "PackageDatabaseError",
- "Thrown if a Repository with the same name as an existing member is added to a PackageDatabase.");
- ExceptionRegister::get_instance()->add_exception<PackageDatabaseLookupError>
- ("PackageDatabaseLookupError", "PackageDatabaseError",
- "A PackageDatabaseLookupError descendent is thrown if an error occurs "
- "when looking for something in a PackageDatabase.");
- ExceptionRegister::get_instance()->add_exception<AmbiguousPackageNameError>
- ("AmbiguousPackageNameError", "PackageDatabaseLookupError",
- "Thrown if a PackageDatabase query results in more than one matching Package.");
- ExceptionRegister::get_instance()->add_exception<NoSuchPackageError>
- ("NoSuchPackageError", "PackageDatabaseLookupError",
- "Thrown if there is no Package in a PackageDatabase with the given name.");
- ExceptionRegister::get_instance()->add_exception<NoSuchRepositoryError>
- ("NoSuchRepositoryError", "PackageDatabaseLookupError",
- "Thrown if there is no Repository in a RepositoryDatabase with the given name.");
-
- /**
- * PackageDatabase
- */
- register_shared_ptrs_to_python<PackageDatabase>();
- std::shared_ptr<Repository>
- (PackageDatabase::* fetch_repository_ptr)(const RepositoryName &) = &PackageDatabase::fetch_repository;
- bp::class_<PackageDatabase, boost::noncopyable>
- (
- "PackageDatabase",
- "A PackageDatabase can be queried for Package instances.\n",
- bp::no_init
- )
-
- .def("fetch_repository", fetch_repository_ptr, bp::with_custodian_and_ward_postcall<0, 1>(),
- "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_overloads(
- "fetch_unique_qualified_package_name(PackageNamePart[, Filter]) -> QualifiedPackageName\n"
- "Disambiguate a package name. If a filter is specified, "
- "limit the potential results to packages that match."
- )
- )
-
- .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"
- )
- ;
-}
diff --git a/python/package_database_TEST.py b/python/package_database_TEST.py
deleted file mode 100755
index d5598f9c3..000000000
--- a/python/package_database_TEST.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env python
-# vim: set fileencoding=utf-8 sw=4 sts=4 et :
-
-#
-# Copyright (c) 2007 Piotr Jaroszyński
-#
-# This file is part of the Paludis package manager. Paludis is free software;
-# you can redistribute it and/or modify it under the terms of the GNU General
-# Public License version 2, as published by the Free Software Foundation.
-#
-# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-# details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-# Place, Suite 330, Boston, MA 02111-1307 USA
-#
-
-import os
-
-os.environ["PALUDIS_HOME"] = os.path.join(os.getcwd(), "package_database_TEST_dir/home")
-
-from paludis import *
-import unittest
-
-Log.instance.log_level = LogLevel.WARNING
-
-class TestCase_PackageDatabase(unittest.TestCase):
- def get_db(self):
- self.env = EnvironmentFactory.instance.create("")
- self.db = self.env.package_database
-
- def test_01_create_error(self):
- self.assertRaises(Exception, PackageDatabase)
-
- def test_03_fech_unique_qpn(self):
- self.get_db()
- self.assertEqual(str(QualifiedPackageName("foo/bar")), str(self.db.fetch_unique_qualified_package_name("bar")))
- self.assertEqual(str(QualifiedPackageName("foo/bar")), str(self.db.fetch_unique_qualified_package_name("bar",
- Filter.SupportsInstallAction())))
-
- def test_04_exceptions(self):
- self.get_db()
- self.assertRaises(AmbiguousPackageNameError, self.db.fetch_unique_qualified_package_name, "baz")
- self.assertRaises(NoSuchPackageError, self.db.fetch_unique_qualified_package_name, "foobarbaz")
- self.assertRaises(NoSuchPackageError, self.db.fetch_unique_qualified_package_name, "bar",
- Filter.SupportsUninstallAction())
-
- def test_6_repositories(self):
- if os.environ.get("PALUDIS_ENABLE_VIRTUALS_REPOSITORY") == "yes":
- self.get_db()
- self.assert_(self.db.more_important_than("testrepo", "virtuals"))
- self.assert_(not self.db.more_important_than("virtuals", "testrepo"))
- self.assertRaises(NoSuchRepositoryError, self.db.fetch_repository, "blah")
-
- self.assertEqual(len(list(self.db.repositories)), 3)
-
-if __name__ == "__main__":
- unittest.main()
-
diff --git a/python/package_database_TEST_cleanup.sh b/python/package_database_TEST_cleanup.sh
deleted file mode 100755
index 761b88531..000000000
--- a/python/package_database_TEST_cleanup.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-if [ -d package_database_TEST_dir ] ; then
- rm -fr package_database_TEST_dir
-else
- true
-fi
diff --git a/python/package_database_TEST_setup.sh b/python/package_database_TEST_setup.sh
deleted file mode 100755
index 6603e549a..000000000
--- a/python/package_database_TEST_setup.sh
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/env bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-mkdir package_database_TEST_dir || exit 1
-cd package_database_TEST_dir || exit 1
-
-mkdir -p home/.paludis/repositories
-
-cat <<END > home/.paludis/repositories/testrepo.conf
-location = `pwd`/testrepo
-format = e
-names_cache = /var/empty
-cache = /var/empty
-profiles = \${location}/profiles/testprofile
-builddir = `pwd`
-END
-
-cat <<END > home/.paludis/keywords.conf
-*/* test
-~foo/bar-1 ~test
-END
-
-cat <<END > home/.paludis/use.conf
-*/* enabled
-~foo/bar-1 sometimes_enabled
-END
-
-cat <<END > home/.paludis/licenses.conf
-*/* *
-END
-
-cat <<END > home/.paludis/general.conf
-world = /dev/null
-END
-
-mkdir -p testrepo/{eclass,distfiles,profiles/testprofile,foo/bar/files,foo/baz/files,quux/baz/files} || exit 1
-cd testrepo || exit 1
-echo "testrepo" > profiles/repo_name || exit 1
-cat <<END > profiles/categories || exit 1
-foo
-quux
-END
-cat <<END > profiles/testprofile/make.defaults
-ARCH=test
-USERLAND=test
-KERNEL=test
-END
-
-cat <<"END" > foo/bar/bar-1.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="test"
-END
-
-cat <<"END" > foo/bar/bar-2.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="~test"
-END
-
-cat <<"END" > foo/baz/baz-1.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="test"
-END
-
-cat <<"END" > quux/baz/baz-2.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="test"
-END
-
-cd ..
diff --git a/python/package_id_TEST.py b/python/package_id_TEST.py
index 123387ee5..4982b5ee3 100755
--- a/python/package_id_TEST.py
+++ b/python/package_id_TEST.py
@@ -32,11 +32,11 @@ class TestCase_01_PackageID(unittest.TestCase):
def setUp(self):
self.e = NoConfigEnvironment(repo_path, "/var/empty")
self.ie = NoConfigEnvironment(irepo_path)
- self.pid = iter(self.e.package_database.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
+ self.pid = iter(self.e.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
if os.environ.get("PALUDIS_ENABLE_VIRTUALS_REPOSITORY") == "yes":
- self.vpid = iter(self.e.package_database.fetch_repository("virtuals").package_ids("virtual/bar", [])).next()
- self.ipid = iter(self.ie.package_database.fetch_repository("installed").package_ids("cat-one/pkg-one", [])).next()
- self.mpid = iter(self.e.package_database.fetch_repository("testrepo").package_ids("cat/masked", [])).next()
+ self.vpid = iter(self.e.fetch_repository("virtuals").package_ids("virtual/bar", [])).next()
+ self.ipid = iter(self.ie.fetch_repository("installed").package_ids("cat-one/pkg-one", [])).next()
+ self.mpid = iter(self.e.fetch_repository("testrepo").package_ids("cat/masked", [])).next()
def test_01_get(self):
pass
diff --git a/python/paludis_python.hh b/python/paludis_python.hh
index 496ecc6e1..aacf7beac 100644
--- a/python/paludis_python.hh
+++ b/python/paludis_python.hh
@@ -188,7 +188,6 @@ void expose_mask() PALUDIS_VISIBLE;
void expose_match_package() PALUDIS_VISIBLE;
void expose_metadata_key() PALUDIS_VISIBLE;
void expose_name() PALUDIS_VISIBLE;
-void expose_package_database() PALUDIS_VISIBLE;
void expose_package_id() PALUDIS_VISIBLE;
void expose_repository() PALUDIS_VISIBLE;
void expose_selection() PALUDIS_VISIBLE;
diff --git a/python/paludis_python_so.cc b/python/paludis_python_so.cc
index 938043536..f8b4e3eca 100644
--- a/python/paludis_python_so.cc
+++ b/python/paludis_python_so.cc
@@ -47,7 +47,6 @@ BOOST_PYTHON_MODULE(paludis)
expose_match_package();
expose_package_id();
expose_action();
- expose_package_database();
expose_repository();
expose_filtered_generator();
expose_generator();
diff --git a/python/repository.cc b/python/repository.cc
index 6cc475675..e1cc5e027 100644
--- a/python/repository.cc
+++ b/python/repository.cc
@@ -124,7 +124,7 @@ void expose_repository()
bp::class_<RepositoryWrapper, std::shared_ptr<Repository>, boost::noncopyable>
(
"Repository",
- "A Repository provides a representation of a physical repository to a PackageDatabase.",
+ "A Repository provides a representation of a physical repository to an Environment.",
bp::no_init
)
@@ -167,7 +167,7 @@ void expose_repository()
"some_ids_might_support_action(SupportsActionTestBase) -> bool\n"
"Might some of our IDs support a particular action?\n\n"
- "Used to optimise PackageDatabase::query. If a repository doesn't\n"
+ "Used to optimise Environment::[]. If a repository doesn't\n"
"support, say, InstallAction, a query can skip searching it\n"
"entirely when looking for installable packages."
)
diff --git a/python/repository_TEST.py b/python/repository_TEST.py
index 711efbed4..7c9ebfc81 100755
--- a/python/repository_TEST.py
+++ b/python/repository_TEST.py
@@ -34,12 +34,11 @@ Log.instance.log_level = LogLevel.WARNING
class TestCase_01_Repository(unittest.TestCase):
def setUp(self):
- global e, nce, db, repo, irepo
+ global e, nce, repo, irepo
e = EnvironmentFactory.instance.create("")
nce = NoConfigEnvironment(repo_path)
- db = e.package_database
- repo = db.fetch_repository("testrepo")
- irepo = db.fetch_repository("installed")
+ repo = e.fetch_repository("testrepo")
+ irepo = e.fetch_repository("installed")
def test_01_fetch(self):
self.assert_(isinstance(repo, Repository))
@@ -101,12 +100,11 @@ class TestCase_01_Repository(unittest.TestCase):
class TestCase_02_RepositoryInterfaces(unittest.TestCase):
def setUp(self):
- global e, nce, db, repo, irepo
+ global e, nce, repo, irepo
e = EnvironmentFactory.instance.create("")
nce = NoConfigEnvironment(repo_path)
- db = e.package_database
- repo = db.fetch_repository("testrepo")
- irepo = db.fetch_repository("installed")
+ repo = e.fetch_repository("testrepo")
+ irepo = e.fetch_repository("installed")
def test_06_environment_variable_interface(self):
evi = repo.environment_variable_interface