aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-07-08 19:04:06 +0000
committerAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-07-08 19:04:06 +0000
commitabad99b363c8d9d70bec5a41db6373f59b87838e (patch)
tree245d8b637231ce5970976cb15af602c1c63c17ff
parentb5c28748235c4e02d42dfc0e30816cbd95de7a6a (diff)
downloadpaludis-abad99b363c8d9d70bec5a41db6373f59b87838e.tar.gz
paludis-abad99b363c8d9d70bec5a41db6373f59b87838e.tar.xz
(python) Add DepList and a few minor changes.
-rw-r--r--python/Makefile.am5
-rw-r--r--python/dep_list.cc286
-rwxr-xr-xpython/dep_list_TEST.py192
-rwxr-xr-xpython/dep_list_TEST_cleanup.sh8
-rwxr-xr-xpython/dep_list_TEST_setup.sh95
-rw-r--r--python/dep_spec.cc23
-rw-r--r--python/dep_tag.cc11
-rw-r--r--python/environment.cc14
-rwxr-xr-xpython/environment_TEST.py12
-rw-r--r--python/paludis_python_so.cc2
-rwxr-xr-xpython/repository_TEST_setup.sh2
11 files changed, 623 insertions, 27 deletions
diff --git a/python/Makefile.am b/python/Makefile.am
index 44f67d4..adee193 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -38,12 +38,14 @@ IF_PYTHON_TESTS = \
package_database_TEST.py \
repository_TEST.py \
package_id_TEST.py \
- metadata_key_TEST.py
+ metadata_key_TEST.py \
+ dep_list_TEST.py
IF_PYTHON_QA_TESTS =
IF_PYTHON_SOURCES = \
contents.cc \
+ dep_list.cc \
dep_spec.hh dep_spec.cc \
dep_tag.cc \
eapi.cc \
@@ -69,6 +71,7 @@ EXTRA_DIST = $(IF_PYTHON_TESTS) $(IF_PYTHON_SOURCES) \
$(IF_PYTHON_QA_TESTS) $(IF_PYTHON_QA_SOURCES) \
paludis_python.hh \
paludis_python_so.cc \
+ dep_tag_TEST_setup.sh dep_tag_TEST_cleanup.sh \
environment_TEST_setup.sh environment_TEST_cleanup.sh \
metadata_key_TEST_setup.sh metadata_key_TEST_cleanup.sh \
package_database_TEST_setup.sh package_database_TEST_cleanup.sh \
diff --git a/python/dep_list.cc b/python/dep_list.cc
new file mode 100644
index 0000000..f86054e
--- /dev/null
+++ b/python/dep_list.cc
@@ -0,0 +1,286 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Piotr Jaroszyński <peper@gentoo.org>
+ *
+ * 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 <paludis_python.hh>
+
+#include <paludis/dep_list/dep_list.hh>
+#include <paludis/dep_list/exceptions.hh>
+#include <libwrapiter/libwrapiter_forward_iterator.hh>
+
+
+using namespace paludis;
+using namespace paludis::python;
+namespace bp = boost::python;
+
+struct DepListWrapper
+{
+ static void
+ add(DepList & self, tr1::shared_ptr<SetSpecTree::ConstItem> st,
+ tr1::shared_ptr<const DestinationsSet> & d)
+ {
+ self.add(*st, d);
+ }
+
+ static bool
+ already_installed(const DepList & self, tr1::shared_ptr<DependencySpecTree::ConstItem> st,
+ tr1::shared_ptr<const DestinationsSet> & d)
+ {
+ return self.already_installed(*st, d);
+ }
+};
+
+void PALUDIS_VISIBLE expose_dep_list()
+{
+ /**
+ * Exceptions
+ */
+ ExceptionRegister::get_instance()->add_exception<DepListError>
+ ("DepListError", "BaseException",
+ "Thrown if an error occurs whilst building a DepList.");
+ ExceptionRegister::get_instance()->add_exception<AllMaskedError>
+ ("AllMaskedError", "DepListError",
+ "Thrown if all versions of a particular spec are masked.");
+ ExceptionRegister::get_instance()->add_exception<UseRequirementsNotMetError>
+ ("UseRequirementsNotMetError", "DepListError",
+ "Thrown if all versions of a particular spec are masked, "
+ "but would not be if use requirements were not in effect.");
+ ExceptionRegister::get_instance()->add_exception<DowngradeNotAllowedError>
+ ("DowngradeNotAllowedError", "DepListError",
+ "Thrown if a downgrade is forced and we're not allowed to downgrade.");
+ ExceptionRegister::get_instance()->add_exception<BlockError>
+ ("BlockError", "DepListError",
+ "Thrown if a block is encountered.");
+ ExceptionRegister::get_instance()->add_exception<CircularDependencyError>
+ ("CircularDependencyError", "DepListError",
+ "Thrown if a circular dependency is encountered.");
+ ExceptionRegister::get_instance()->add_exception<NoDestinationError>
+ ("NoDestinationError", "DepListError",
+ "Thrown if no destination can be found.");
+
+ /**
+ * Enums
+ */
+ enum_auto("DepListTargetType", last_dl_target,
+ "Type of target being handled at the top level.");
+ enum_auto("DepListReinstallOption", last_dl_reinstall,
+ "When we should reinstall.");
+ enum_auto("DepListFallBackOption", last_dl_fall_back,
+ "When we should fall back to an installed package.");
+ enum_auto("DepListReinstallScmOption", last_dl_reinstall_scm,
+ "When we should reinstall SCM packages.");
+ enum_auto("DepListUpgradeOption", last_dl_upgrade,
+ "When we should upgrade.");
+ enum_auto("DepListDowngradeOption", last_dl_downgrade,
+ "What to do when we downgrade.");
+ enum_auto("DepListNewSlotsOption", last_dl_new_slots,
+ "When we should pull in a new slot.");
+ enum_auto("DepListDepsOption", last_dl_deps,
+ "How we should handle a dep class.");
+ enum_auto("DepListSuggestedOption", last_dl_suggested,
+ "How we should handle suggested deps.");
+ enum_auto("DepListCircularOption", last_dl_circular,
+ "How we should handle circular deps.");
+ enum_auto("DepListBlocksOption", last_dl_blocks,
+ "How we handle blocks.");
+ enum_auto("DepListUseOption", last_dl_use_deps,
+ "How we handle use deps.");
+ enum_auto("DepListEntryState", last_dle,
+ "State of a DepListEntry.");
+ enum_auto("DepListEntryKind", last_dlk,
+ "Kind of a DepListEntry.");
+ enum_auto("DepListOverrideMask", last_dl_override,
+ "Masks that can be overridden.");
+
+ /**
+ * Options
+ */
+ class_options<DepListOverrideMasks>
+ (
+ "DepListOverrideMasks", "DepListOverrideMask",
+ "Set of masks that can be overridden."
+ );
+
+ /**
+ * DepListOptions
+ */
+ register_shared_ptrs_to_python<DepListOptions>(rsp_non_const);
+ bp::class_<DepListOptions, boost::noncopyable>
+ (
+ "DepListOptions",
+ "Parameters for a DepList.",
+ bp::init<>("__init__()")
+ )
+ .def_readwrite("reinstall", &DepListOptions::reinstall,
+ "[rw] DepListReinstallOption"
+ )
+
+ .def_readwrite("reinstall_scm", &DepListOptions::reinstall_scm,
+ "[rw] DepListReinstallScmOption"
+ )
+
+ .def_readwrite("target_type", &DepListOptions::target_type,
+ "[rw] DepListTargetType"
+ )
+
+ .def_readwrite("upgrade", &DepListOptions::upgrade,
+ "[rw] DepListUpgradeOption"
+ )
+
+ .def_readwrite("downgrade", &DepListOptions::downgrade,
+ "[rw] DepListDowngradeOption"
+ )
+
+ .def_readwrite("new_slots", &DepListOptions::new_slots,
+ "[rw] DepListNewSlotsOption"
+ )
+
+ .def_readwrite("fall_back", &DepListOptions::fall_back,
+ "[rw] DepListFallBackOption"
+ )
+
+ .def_readwrite("installed_deps_pre", &DepListOptions::installed_deps_pre,
+ "[rw] DepListDepsOption"
+ )
+
+ .def_readwrite("installed_deps_runtime", &DepListOptions::installed_deps_runtime,
+ "[rw] DepListDepsOption"
+ )
+
+ .def_readwrite("installed_deps_post", &DepListOptions::installed_deps_post,
+ "[rw] DepListDepsOption"
+ )
+
+ .def_readwrite("uninstalled_deps_pre", &DepListOptions::uninstalled_deps_pre,
+ "[rw] DepListDepsOption"
+ )
+
+ .def_readwrite("uninstalled_deps_runtime", &DepListOptions::uninstalled_deps_runtime,
+ "[rw] DepListDepsOption"
+ )
+
+ .def_readwrite("uninstalled_deps_post", &DepListOptions::uninstalled_deps_post,
+ "[rw] DepListDepsOption"
+ )
+
+ .def_readwrite("uninstalled_deps_suggested", &DepListOptions::uninstalled_deps_suggested,
+ "[rw] DepListDepsOption"
+ )
+
+ .def_readwrite("suggested", &DepListOptions::suggested,
+ "[rw] DepListSuggestedOption"
+ )
+
+ .def_readwrite("circular", &DepListOptions::circular,
+ "[rw] DepListCircularOption"
+ )
+
+ .def_readwrite("use", &DepListOptions::use,
+ "[rw] DepListUseOption"
+ )
+
+ .def_readwrite("blocks", &DepListOptions::blocks,
+ "[rw] DepListBlocksOption"
+ )
+
+ .def_readwrite("override_masks", &DepListOptions::override_masks,
+ "[rw] DepListOverrideMasks"
+ )
+
+ .def_readwrite("dependency_tags", &DepListOptions::dependency_tags,
+ "[rw] bool"
+ )
+ ;
+
+ /**
+ * DepListEntry
+ */
+ bp::register_ptr_to_python<DepListEntry *>();
+ bp::class_<DepListEntry, boost::noncopyable>
+ (
+ "DepListEntry",
+ "An entry in a DepList.",
+ bp::no_init
+ )
+ .def_readonly("kind", &DepListEntry::kind,
+ "[ro] DepListEntryKind"
+ )
+
+ .add_property("package_id", bp::make_getter(&DepListEntry::package_id,
+ bp::return_value_policy<bp::return_by_value>()),
+ "[ro] PackageID"
+ )
+
+ .add_property("associated_entry", bp::make_getter(&DepListEntry::associated_entry,
+ bp::return_value_policy<bp::reference_existing_object>()),
+ "[ro] DepListEntry"
+ )
+
+ .add_property("tags", bp::make_getter(&DepListEntry::tags,
+ bp::return_value_policy<bp::return_by_value>()),
+ "[ro] DepListEntryTags"
+ )
+
+ .add_property("destination", bp::make_getter(&DepListEntry::destination,
+ bp::return_value_policy<bp::return_by_value>()),
+ "[ro] tr1::shared_ptr<Repository>"
+ )
+
+ .def_readonly("state", &DepListEntry::state,
+ "[ro] DepListEntryState"
+ )
+ ;
+
+ /**
+ * DepList
+ */
+ tr1::shared_ptr<DepListOptions> (DepList::* options_ptr)() = &DepList::options;
+ bp::class_<DepList, boost::noncopyable>
+ (
+ "DepList",
+ "Holds a list of dependencies in merge order.",
+ bp::init<const Environment * const, const DepListOptions &>("__init__(Environment, DepListOptions)")
+ )
+ .add_property("options", options_ptr,
+ "[ro] DepListOptions\n"
+ "Our options."
+ )
+
+ .def("add", &DepListWrapper::add,
+ "add(DepSpec, DestinationsIterable)\n"
+ "Add the packages required to resolve an additional dependency spec."
+ )
+
+ .def("clear", &DepList::clear,
+ "clear()\n"
+ "Clear the list."
+ )
+
+ .def("already_installed", &DepListWrapper::already_installed,
+ "already_installed(DepSpec, DestinationsIterable) -> bool\n"
+ "Return whether a spec structure is already installed."
+ )
+
+ .def("match_on_list", &DepList::match_on_list,
+ "match_on_list(PackageDepSpec) -> bool\n"
+ "Return whether a spec matches an item in the list."
+ )
+
+ .def("__iter__", bp::range<bp::return_internal_reference<> >(&DepList::begin, &DepList::end))
+ ;
+}
diff --git a/python/dep_list_TEST.py b/python/dep_list_TEST.py
new file mode 100755
index 0000000..abaae3a
--- /dev/null
+++ b/python/dep_list_TEST.py
@@ -0,0 +1,192 @@
+#!/usr/bin/env python
+# vim: set fileencoding=utf-8 sw=4 sts=4 et :
+
+#
+# Copyright (c) 2007 Piotr Jaroszyński <peper@gentoo.org>
+#
+# 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(), "dep_list_TEST_dir/home")
+repo_path = os.path.join(os.getcwd(), "package_id_TEST_dir/testrepo")
+irepo_path = os.path.join(os.getcwd(), "package_id_TEST_dir/installed")
+
+from paludis import *
+import unittest
+
+Log.instance.log_level = LogLevel.WARNING
+
+class TestCase_01_DepListOptions(unittest.TestCase):
+ def setUp(self):
+ global dlo
+ dlo = DepListOptions()
+
+ def test_01_create(self):
+ pass
+
+ def test_02_data_members_types(self):
+ self.assert_(isinstance(dlo.reinstall, DepListReinstallOption))
+ self.assert_(isinstance(dlo.reinstall_scm, DepListReinstallScmOption))
+ self.assert_(isinstance(dlo.target_type, DepListTargetType))
+ self.assert_(isinstance(dlo.upgrade, DepListUpgradeOption))
+ self.assert_(isinstance(dlo.downgrade, DepListDowngradeOption))
+ self.assert_(isinstance(dlo.new_slots, DepListNewSlotsOption))
+ self.assert_(isinstance(dlo.fall_back, DepListFallBackOption))
+ self.assert_(isinstance(dlo.installed_deps_pre, DepListDepsOption))
+ self.assert_(isinstance(dlo.installed_deps_runtime, DepListDepsOption))
+ self.assert_(isinstance(dlo.installed_deps_post, DepListDepsOption))
+ self.assert_(isinstance(dlo.uninstalled_deps_pre, DepListDepsOption))
+ self.assert_(isinstance(dlo.uninstalled_deps_runtime, DepListDepsOption))
+ self.assert_(isinstance(dlo.uninstalled_deps_post, DepListDepsOption))
+ self.assert_(isinstance(dlo.uninstalled_deps_suggested, DepListDepsOption))
+ self.assert_(isinstance(dlo.suggested, DepListSuggestedOption))
+ self.assert_(isinstance(dlo.circular, DepListCircularOption))
+ self.assert_(isinstance(dlo.use, DepListUseOption))
+ self.assert_(isinstance(dlo.blocks, DepListBlocksOption))
+ self.assert_(isinstance(dlo.override_masks, DepListOverrideMasks))
+ self.assert_(isinstance(dlo.dependency_tags, bool))
+
+ def test_03_data_members_set(self):
+ dlo.reinstall = DepListReinstallOption.values[0]
+ self.assertEquals(dlo.reinstall, DepListReinstallOption.values[0])
+
+ dlo.reinstall_scm = DepListReinstallScmOption.values[0]
+ self.assertEquals(dlo.reinstall_scm, DepListReinstallScmOption.values[0])
+
+ dlo.target_type = DepListTargetType.values[0]
+ self.assertEquals(dlo.target_type, DepListTargetType.values[0])
+
+ dlo.upgrade = DepListUpgradeOption.values[0]
+ self.assertEquals(dlo.upgrade, DepListUpgradeOption.values[0])
+
+ dlo.downgrade = DepListDowngradeOption.values[0]
+ self.assertEquals(dlo.downgrade, DepListDowngradeOption.values[0])
+
+ dlo.new_slots = DepListNewSlotsOption.values[0]
+ self.assertEquals(dlo.new_slots, DepListNewSlotsOption.values[0])
+
+ dlo.fall_back = DepListFallBackOption.values[0]
+ self.assertEquals(dlo.fall_back, DepListFallBackOption.values[0])
+
+ dlo.installed_deps_pre = DepListDepsOption.values[0]
+ self.assertEquals(dlo.installed_deps_pre, DepListDepsOption.values[0])
+
+ dlo.installed_deps_runtime = DepListDepsOption.values[0]
+ self.assertEquals(dlo.installed_deps_runtime, DepListDepsOption.values[0])
+
+ dlo.installed_deps_post = DepListDepsOption.values[0]
+ self.assertEquals(dlo.installed_deps_post, DepListDepsOption.values[0])
+
+ dlo.uninstalled_deps_pre = DepListDepsOption.values[0]
+ self.assertEquals(dlo.uninstalled_deps_pre, DepListDepsOption.values[0])
+
+ dlo.uninstalled_deps_runtime = DepListDepsOption.values[0]
+ self.assertEquals(dlo.uninstalled_deps_runtime, DepListDepsOption.values[0])
+
+ dlo.uninstalled_deps_post = DepListDepsOption.values[0]
+ self.assertEquals(dlo.uninstalled_deps_post, DepListDepsOption.values[0])
+
+ dlo.uninstalled_deps_suggested = DepListDepsOption.values[0]
+ self.assertEquals(dlo.uninstalled_deps_suggested, DepListDepsOption.values[0])
+
+ dlo.suggested = DepListSuggestedOption.values[0]
+ self.assertEquals(dlo.suggested, DepListSuggestedOption.values[0])
+
+ dlo.circular = DepListCircularOption.values[0]
+ self.assertEquals(dlo.circular, DepListCircularOption.values[0])
+
+ dlo.use = DepListUseOption.values[0]
+ self.assertEquals(dlo.use, DepListUseOption.values[0])
+
+ dlo.blocks = DepListBlocksOption.values[0]
+ self.assertEquals(dlo.blocks, DepListBlocksOption.values[0])
+
+ dlo.dependency_tags = False
+ self.assertEquals(dlo.dependency_tags, False)
+
+class TestCase_02_DepList(unittest.TestCase):
+ def setUp(self):
+ global env, dl, dd, pds, cds
+ env = EnvironmentMaker.instance.make_from_spec("")
+ dl = DepList(env, DepListOptions())
+ dd = env.default_destinations
+ pds = PackageDepSpec("foo/bar", PackageDepSpecParseMode.PERMISSIVE)
+ cds = PortageDepParser.parse_depend("foo/bar", EAPIData.instance.eapi_from_string("0"))
+
+ def test_01_create(self):
+ pass
+
+ def test_02_options(self):
+ self.assert_(isinstance(dl.options, DepListOptions))
+
+ def test_03_match_on_list(self):
+ self.assert_(not dl.match_on_list(pds))
+
+ def test_04_clear(self):
+ dl.add(pds, dd)
+ self.assert_(dl.match_on_list(pds))
+ dl.clear()
+ self.assert_(not dl.match_on_list(pds))
+
+ def test_05_add(self):
+ self.assert_(not dl.match_on_list(pds))
+ dl.add(pds, dd)
+ self.assert_(dl.match_on_list(pds))
+
+ dl.clear()
+
+ self.assert_(not dl.match_on_list(pds))
+ dl.add(cds, dd)
+ self.assert_(dl.match_on_list(pds))
+
+ def test_06_already_installed(self):
+ self.assert_(not dl.already_installed(pds, dd))
+ dl.add(cds, dd)
+ self.assert_(dl.already_installed(pds, dd))
+
+ def test_07_entries(self):
+ dl.add(pds, dd)
+
+ entries = list(dl)
+ self.assert_(isinstance(entries[0], DepListEntry))
+
+
+class TestCase_03_DepListEntry(unittest.TestCase):
+ def setUp(self):
+ global env, dl, dd, pds, cds
+ env = EnvironmentMaker.instance.make_from_spec("")
+ dl = DepList(env, DepListOptions())
+ dd = env.default_destinations
+
+ def test_01_no_create(self):
+ self.assertRaises(Exception, DepListEntry)
+
+ def test_02_data_members(self):
+ dl.add(pds, dd)
+
+ dle = list(dl)[0]
+
+ self.assertEquals(dle.kind, DepListEntryKind.PACKAGE)
+ self.assertEquals(dle.package_id.name, "foo/bar")
+ self.assertEquals(dle.associated_entry, None)
+ self.assertEquals(list(dle.tags), [])
+ self.assertEquals(str(dle.destination.name), "installed")
+ self.assertEquals(dle.state, DepListEntryState.HAS_ALL_DEPS)
+
+
+if __name__ == "__main__":
+ unittest.main()
+
diff --git a/python/dep_list_TEST_cleanup.sh b/python/dep_list_TEST_cleanup.sh
new file mode 100755
index 0000000..4896ed4
--- /dev/null
+++ b/python/dep_list_TEST_cleanup.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d dep_list_TEST_dir ] ; then
+ rm -fr dep_list_TEST_dir
+else
+ true
+fi
diff --git a/python/dep_list_TEST_setup.sh b/python/dep_list_TEST_setup.sh
new file mode 100755
index 0000000..d04d8fb
--- /dev/null
+++ b/python/dep_list_TEST_setup.sh
@@ -0,0 +1,95 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir dep_list_TEST_dir || exit 1
+cd dep_list_TEST_dir || exit 1
+
+mkdir -p home/.paludis/repositories
+
+cat <<END > home/.paludis/repositories/testrepo.conf
+location = `pwd`/testrepo
+format = ebuild
+names_cache = /var/empty
+cache = /var/empty
+profiles = \${location}/profiles/testprofile
+END
+
+cat <<END > home/.paludis/repositories/installed.conf
+location = `pwd`/installed
+format = vdb
+names_cache = /var/empty
+provides_cache = /var/empty
+END
+
+cat <<END > home/.paludis/keywords.conf
+*/* test
+~foo/bar-1.0 ~test
+END
+
+cat <<END > home/.paludis/use.conf
+*/* enabled
+~foo/bar-1.0 sometimes_enabled
+END
+
+cat <<END > home/.paludis/package_mask.conf
+=foo/bar-3*
+END
+
+cat <<END > home/.paludis/licenses.conf
+*/* *
+END
+
+mkdir -p testrepo/{eclass,distfiles,profiles/testprofile,foo/bar/files} || exit 1
+cd testrepo || exit 1
+echo "testrepo" > profiles/repo_name || exit 1
+cat <<END > profiles/categories || exit 1
+foo
+END
+cat <<END > profiles/testprofile/make.defaults
+ARCH=test
+USERLAND=test
+KERNEL=test
+END
+cat <<END > profiles/profiles.desc
+test testprofile stable
+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
+cd ..
+
+mkdir -p installed/cat-one/pkg-one-1 || exit 1
+
+for i in SLOT EAPI; do
+ echo "0" >installed/cat-one/pkg-one-1/${i}
+done
+
+for i in DEPEND RDEPEND LICENSE INHERITED IUSE PDEPEND PROVIDE; do
+ touch installed/cat-one/pkg-one-1/${i}
+done
+
+echo "flag1 flag2" >>installed/cat-one/pkg-one-1/USE
+
+cat <<END >installed/cat-one/pkg-one-1/CONTENTS
+dir //test
+obj /test/test_file de54c26b0678df67aca147575523b3c2 1165250496
+sym /test/test_link -> /test/test_file 1165250496
+END
+
diff --git a/python/dep_spec.cc b/python/dep_spec.cc
index 4ebfe2b..d8c3ab6 100644
--- a/python/dep_spec.cc
+++ b/python/dep_spec.cc
@@ -947,12 +947,12 @@ void register_sp_package_dep_spec_to_python()
template <typename H_>
-struct RegisterSpecTreeFromPython
+struct RegisterSpecTreeSPTRFromPython
{
- RegisterSpecTreeFromPython()
+ RegisterSpecTreeSPTRFromPython()
{
bp::converter::registry::push_back(&convertible, &construct,
- boost::python::type_id<tr1::shared_ptr<typename H_::ConstItem> >());
+ boost::python::type_id<tr1::shared_ptr<const typename H_::ConstItem> >());
}
static void *
@@ -1023,9 +1023,9 @@ struct RegisterPackageDepSpecFromPython
}
};
-struct RegisterPackageDepSpecSPFromPython
+struct RegisterPackageDepSpecSPTRFromPython
{
- RegisterPackageDepSpecSPFromPython()
+ RegisterPackageDepSpecSPTRFromPython()
{
bp::converter::registry::push_back(&convertible, &construct,
boost::python::type_id<tr1::shared_ptr<const PackageDepSpec> >());
@@ -1094,11 +1094,12 @@ void PALUDIS_VISIBLE expose_dep_spec()
register_tree_to_python<LicenseSpecTree>();
register_tree_to_python<SetSpecTree>();
- RegisterSpecTreeFromPython<DependencySpecTree>();
- RegisterSpecTreeFromPython<ProvideSpecTree>();
- RegisterSpecTreeFromPython<RestrictSpecTree>();
- RegisterSpecTreeFromPython<URISpecTree>();
- RegisterSpecTreeFromPython<LicenseSpecTree>();
+ RegisterSpecTreeSPTRFromPython<DependencySpecTree>();
+ RegisterSpecTreeSPTRFromPython<ProvideSpecTree>();
+ RegisterSpecTreeSPTRFromPython<RestrictSpecTree>();
+ RegisterSpecTreeSPTRFromPython<URISpecTree>();
+ RegisterSpecTreeSPTRFromPython<LicenseSpecTree>();
+ RegisterSpecTreeSPTRFromPython<SetSpecTree>();
/**
* DepSpec
@@ -1215,7 +1216,7 @@ void PALUDIS_VISIBLE expose_dep_spec()
* PackageDepSpec
*/
RegisterPackageDepSpecFromPython();
- RegisterPackageDepSpecSPFromPython();
+ RegisterPackageDepSpecSPTRFromPython();
bp::implicitly_convertible<PackageDepSpec, PythonPackageDepSpec>();
register_sp_package_dep_spec_to_python();
diff --git a/python/dep_tag.cc b/python/dep_tag.cc
index 8dcd171..b0491c4 100644
--- a/python/dep_tag.cc
+++ b/python/dep_tag.cc
@@ -21,6 +21,8 @@
#include <paludis/dep_tag.hh>
#include <paludis/dep_spec.hh>
+#include <paludis/util/set.hh>
+#include <libwrapiter/libwrapiter_forward_iterator.hh>
using namespace paludis;
using namespace paludis::python;
@@ -194,4 +196,13 @@ void PALUDIS_VISIBLE expose_dep_tag()
bp::init<>("__init__()")
)
;
+
+ /**
+ * DepListEntryTags
+ */
+ class_iterable<DepListEntryTags>
+ (
+ "DepListEntryTags",
+ "Tags attached to a DepListEntry."
+ );
}
diff --git a/python/environment.cc b/python/environment.cc
index cff065f..1186b83 100644
--- a/python/environment.cc
+++ b/python/environment.cc
@@ -111,8 +111,8 @@ void PALUDIS_VISIBLE expose_environment()
"and provides various methods for querying package visibility and options.",
bp::no_init
)
- .def("default_destinations", &Environment::default_destinations,
- "default_destinations() -> DestinationsCollection\n"
+ .add_property("default_destinations", &Environment::default_destinations,
+ "[ro] DestinationsIterable\n"
"Default destination candidates for installing packages."
)
@@ -139,14 +139,14 @@ void PALUDIS_VISIBLE expose_environment()
"Return the reasons for a package being masked."
)
- .def("root", &Environment::root,
- "root() -> string\n"
+ .add_property("root", &Environment::root,
+ "[ro] string\n"
"Our root location for installs."
)
- .def("set_names", &Environment::set_names,
- "set_names() -> SetNamesCollection\n"
- "Return all known named sets."
+ .add_property("set_names", &Environment::set_names,
+ "[ro] SetNamesIterable\n"
+ "All known named sets."
)
;
diff --git a/python/environment_TEST.py b/python/environment_TEST.py
index 1870240..f438db6 100755
--- a/python/environment_TEST.py
+++ b/python/environment_TEST.py
@@ -76,8 +76,8 @@ class TestCase_01_Environments(unittest.TestCase):
self.assert_(isinstance(e.set("everything"), AllDepSpec))
self.assert_(isinstance(nce.set("everything"), AllDepSpec))
- self.assert_(isinstance(e.set_names(), SetNameIterable))
- self.assert_(isinstance(nce.set_names(), SetNameIterable))
+ self.assert_(isinstance(e.set_names, SetNameIterable))
+ self.assert_(isinstance(nce.set_names, SetNameIterable))
def test_08_repositories(self):
nce2 = NoConfigEnvironment(repo, master_repository_dir=slaverepo)
@@ -88,12 +88,12 @@ class TestCase_01_Environments(unittest.TestCase):
self.assert_(isinstance(nce2.master_repository, Repository))
def test_09_root(self):
- self.assert_(isinstance(e.root(), str))
- self.assert_(isinstance(nce.root(), str))
+ self.assert_(isinstance(e.root, str))
+ self.assert_(isinstance(nce.root, str))
def test_10_default_destinations(self):
- self.assert_(isinstance(e.default_destinations(), DestinationsIterable))
- self.assert_(isinstance(nce.default_destinations(), DestinationsIterable))
+ self.assert_(isinstance(e.default_destinations, DestinationsIterable))
+ self.assert_(isinstance(nce.default_destinations, DestinationsIterable))
def test_11_set_accept_unstable(self):
nce.accept_unstable = True
diff --git a/python/paludis_python_so.cc b/python/paludis_python_so.cc
index 7f3b8ad..21ee40b 100644
--- a/python/paludis_python_so.cc
+++ b/python/paludis_python_so.cc
@@ -22,6 +22,7 @@
#include <boost/version.hpp>
void expose_contents();
+void expose_dep_list();
void expose_dep_spec();
void expose_dep_tag();
void expose_eapi();
@@ -57,6 +58,7 @@ BOOST_PYTHON_MODULE(paludis)
expose_mask_reasons();
expose_dep_spec();
expose_dep_tag();
+ expose_dep_list();
expose_portage_dep_parser();
expose_name();
expose_log();
diff --git a/python/repository_TEST_setup.sh b/python/repository_TEST_setup.sh
index 72aa76d..f78df77 100755
--- a/python/repository_TEST_setup.sh
+++ b/python/repository_TEST_setup.sh
@@ -113,8 +113,6 @@ END
done
-
-
cat <<"END" > foo/bar/bar-1.0.ebuild || exit 1
DESCRIPTION="Test package"
HOMEPAGE="http://paludis.pioto.org/"