summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2010-03-26 15:53:37 +0100
committerJulian Andres Klode <jak@debian.org>2010-03-26 15:53:37 +0100
commit33851a84b6868eaff1fadaa5b5f57aa696cdc2e8 (patch)
tree4a6e24fc90e012f17515f0363a2424429ba951ee
parent95112f12cea6ec54aaa8b5e372ee158a300f8967 (diff)
parent57624b5df523c0b3a3ebc1741680f283ee1fbbcd (diff)
downloadpython-apt-33851a84b6868eaff1fadaa5b5f57aa696cdc2e8.tar.gz
Merge with mvo, with the following changes:
* python/generic.cc is changed instead of python/indexfile.cc to add the ArchiveURI property * tests/test_apt_cache.py is changed to assert the properties of the Dependency object instead of assigning them to a variable. The additions to the changelog are: [ Julian Andres Klode ] - Map ArchiveURI property to archive_uri [ Michael Vogt ] * apt/cache.py: - make cache open silent by default (use apt.progress.base.OpProgress) * tests/data/aptsources_ports/sources.list: - fix ports test-data * tests/test_apt_cache.py: - add simple test for basic cache/dependency iteration
-rw-r--r--apt/cache.py2
-rw-r--r--debian/changelog10
-rw-r--r--python/generic.cc1
-rw-r--r--tests/data/aptsources_ports/sources.list16
-rw-r--r--tests/test_apt_cache.py34
5 files changed, 54 insertions, 9 deletions
diff --git a/apt/cache.py b/apt/cache.py
index 2e6d24e5..cfe6bedc 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -117,7 +117,7 @@ class Cache(object):
a dictionary
"""
if progress is None:
- progress = apt.progress.text.OpProgress()
+ progress = apt.progress.base.OpProgress()
self._run_callbacks("cache_pre_open")
self._cache = apt_pkg.Cache(progress)
diff --git a/debian/changelog b/debian/changelog
index b7617f90..69eecc2b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,20 @@
python-apt (0.7.94.3) UNRELEASED; urgency=low
+ [ Julian Andres Klode ]
* python/generic.cc:
- Fix a memory leak when using old attribute names.
+ - Map ArchiveURI property to archive_uri
* debian/control:
- Change priority to standard, keep -doc and -dev on optional.
+ [ Michael Vogt ]
+ * apt/cache.py:
+ - make cache open silent by default (use apt.progress.base.OpProgress)
+ * tests/data/aptsources_ports/sources.list:
+ - fix ports test-data
+ * tests/test_apt_cache.py:
+ - add simple test for basic cache/dependency iteration
+
-- Julian Andres Klode <jak@debian.org> Mon, 15 Mar 2010 17:04:49 +0100
python-apt (0.7.94.2) unstable; urgency=low
diff --git a/python/generic.cc b/python/generic.cc
index 1c68a481..e04743ff 100644
--- a/python/generic.cc
+++ b/python/generic.cc
@@ -63,6 +63,7 @@ static PyObject *_PyApt_NewNameForAttribute(const char *attr) {
if (strcasecmp(attr, "ReadPinFile") == 0) return PyString_FromString("read_pinfile");
if (strcasecmp(attr, "SetReInstall") == 0) return PyString_FromString("set_reinstall");
if (strcasecmp(attr, "URI") == 0) return PyString_FromString("uri");
+ if (strcasecmp(attr, "ArchiveURI") == 0) return PyString_FromString("archive_uri");
if (strcasecmp(attr, "MD5Hash") == 0) return PyString_FromString("md5_hash");
if (strcasecmp(attr, "SHA1Hash") == 0) return PyString_FromString("sha1_hash");
if (strcasecmp(attr, "SHA256Hash") == 0) return PyString_FromString("sha256_hash");
diff --git a/tests/data/aptsources_ports/sources.list b/tests/data/aptsources_ports/sources.list
index a6b2f6ed..54f048b2 100644
--- a/tests/data/aptsources_ports/sources.list
+++ b/tests/data/aptsources_ports/sources.list
@@ -6,12 +6,12 @@
# newer versions of the distribution.
deb http://ports.ubuntu.com/ubuntu-ports/ hardy main restricted
-deb-src http://archive.ubuntu.com/ubuntu hardy main restricted
+deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://ports.ubuntu.com/ubuntu-ports/ hardy-updates main restricted
-deb-src http://archive.ubuntu.com/ubuntu hardy-updates main restricted
+deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
@@ -19,9 +19,9 @@ deb-src http://archive.ubuntu.com/ubuntu hardy-updates main restricted
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://ports.ubuntu.com/ubuntu-ports/ hardy universe
-deb-src http://archive.ubuntu.com/ubuntu hardy universe
+deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy universe
deb http://ports.ubuntu.com/ubuntu-ports/ hardy-updates universe
-deb-src http://archive.ubuntu.com/ubuntu hardy-updates universe
+deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
@@ -29,9 +29,9 @@ deb-src http://archive.ubuntu.com/ubuntu hardy-updates universe
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://ports.ubuntu.com/ubuntu-ports/ hardy multiverse
-deb-src http://archive.ubuntu.com/ubuntu hardy multiverse
+deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy multiverse
deb http://ports.ubuntu.com/ubuntu-ports/ hardy-updates multiverse
-deb-src http://archive.ubuntu.com/ubuntu hardy-updates multiverse
+deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy-updates multiverse
## Uncomment the following two lines to add software from the 'backports'
## repository.
@@ -41,7 +41,7 @@ deb-src http://archive.ubuntu.com/ubuntu hardy-updates multiverse
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://ports.ubuntu.com/ubuntu-ports/ hardy-backports main restricted universe multiverse
-# deb-src http://archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
+# deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository. This software is not part of Ubuntu, but is
@@ -56,4 +56,4 @@ deb http://ports.ubuntu.com/ubuntu-ports/ hardy-security universe
deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy-security universe
deb http://ports.ubuntu.com/ubuntu-ports/ hardy-security multiverse
deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy-security multiverse
-deb-src http://archive.ubuntu.com/ubuntu/ hardy-proposed restricted main multiverse universe
+deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy-proposed restricted main multiverse universe
diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py
new file mode 100644
index 00000000..fdcf482d
--- /dev/null
+++ b/tests/test_apt_cache.py
@@ -0,0 +1,34 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2010 Julian Andres Klode <jak@debian.org>
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.
+"""Unit tests for verifying the correctness of check_dep, etc in apt_pkg."""
+import unittest
+
+import apt
+
+
+class TestAptCache(unittest.TestCase):
+ """ test the apt cache """
+
+ def testAptCache(self):
+ """cache: iterate all packages and all dependencies """
+ cache = apt.Cache()
+ # number is not meaningful and just need to be "big enough",
+ # the important bit is the test against __len__
+ self.assertTrue(len(cache) > 100)
+ # go over the cache and all dependencies, just to see if
+ # that is possible and does not crash
+ for pkg in cache:
+ if pkg.candidate:
+ for or_dep in pkg.candidate.dependencies:
+ for dep in or_dep.or_dependencies:
+ self.assertTrue(dep.name)
+ self.assertTrue(isinstance(dep.relation, str))
+ self.assertTrue(dep.pre_depend in (True, False))
+
+if __name__ == "__main__":
+ unittest.main()