summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt/cache.py6
-rw-r--r--apt/package.py50
-rw-r--r--apt/progress/old.py16
-rw-r--r--debian/changelog75
-rw-r--r--debian/control5
-rw-r--r--debian/python-apt-dbg.install1
-rw-r--r--debian/python-apt.docs2
-rw-r--r--debian/python-apt.install5
-rwxr-xr-xdebian/rules52
-rw-r--r--po/python-apt.pot32
-rw-r--r--python/tag.cc25
11 files changed, 169 insertions, 100 deletions
diff --git a/apt/cache.py b/apt/cache.py
index 40808abd..f507863c 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -69,6 +69,9 @@ class Cache(object):
# create required dirs/files when run with special rootdir
# automatically
self._check_and_create_required_dirs(rootdir)
+ # Call InitSystem so the change to Dir::State::Status is actually
+ # recognized (LP: #320665)
+ apt_pkg.InitSystem()
self.open(progress)
def _check_and_create_required_dirs(self, rootdir):
@@ -106,9 +109,6 @@ class Cache(object):
progress = apt.progress.text.OpProgress()
self._run_callbacks("cache_pre_open")
- # Make changes to Dir::State::Status work again, by reinitialising
- # the system.
- apt_pkg.init_system()
self._cache = apt_pkg.Cache(progress)
self._depcache = apt_pkg.DepCache(self._cache)
self._records = apt_pkg.PackageRecords(self._cache)
diff --git a/apt/package.py b/apt/package.py
index 1307ca3e..f8e1354b 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -33,6 +33,11 @@ except ImportError:
# (for Python < 2.6) pylint: disable-msg=C0103
Sequence = Mapping = object
+try:
+ from collections import Sequence
+except ImportError:
+ Sequence = object
+
import apt_pkg
import apt.progress.text
from apt_pkg import gettext as _
@@ -40,7 +45,7 @@ from apt.deprecation import (function_deprecated_by, AttributeDeprecatedBy,
deprecated_args)
__all__ = ('BaseDependency', 'Dependency', 'Origin', 'Package', 'Record',
- 'Version')
+ 'Version', 'VersionList')
def _file_is_same(path, size, md5):
@@ -200,22 +205,47 @@ class Version(object):
self.package = package
self._cand = cand
- def __eq__(self, other):
+ def _cmp(self, other):
try:
- return self._cand.id == other._cand.id
+ return apt_pkg.Version_compare(self._cand.ver_str, other.version)
except AttributeError:
- return apt_pkg.version_compare(self.version, other) == 0
- except Exception:
- return False
+ return apt_pkg.Version_compare(self._cand.ver_str, other)
+
+ def __eq__(self, other):
+ try:
+ return self._cmp(other) == 0
+ except TypeError:
+ return NotImplemented
+
+ def __ge__(self, other):
+ try:
+ return self._cmp(other) >= 0
+ except TypeError:
+ return NotImplemented
def __gt__(self, other):
- return apt_pkg.version_compare(self.version, other.version) > 0
+ try:
+ return self._cmp(other) > 0
+ except TypeError:
+ return NotImplemented
+
+ def __le__(self, other):
+ try:
+ return self._cmp(other) <= 0
+ except TypeError:
+ return NotImplemented
def __lt__(self, other):
- return apt_pkg.version_compare(self.version, other.version) < 0
+ try:
+ return self._cmp(other) < 0
+ except TypeError:
+ return NotImplemented
def __ne__(self, other):
- return not self.__eq__(other)
+ try:
+ return self._cmp(other) != 0
+ except TypeError:
+ return NotImplemented
def __hash__(self):
return self._cand.hash
@@ -610,8 +640,6 @@ class Package(object):
This property is writeable to allow you to set the candidate version
of the package. Just assign a Version() object, and it will be set as
the candidate version.
-
- .. versionadded:: 0.7.9
"""
cand = self._pcache._depcache.get_candidate_ver(self._pkg)
if cand is not None:
diff --git a/apt/progress/old.py b/apt/progress/old.py
index 05597481..88957272 100644
--- a/apt/progress/old.py
+++ b/apt/progress/old.py
@@ -315,14 +315,20 @@ class InstallProgress(DumbInstallProgress):
while True:
try:
select.select([self.statusfd], [], [], self.select_timeout)
- except select.error, e:
- if e[0] != errno.EINTR:
+ except select.error, (errno_, errstr):
+ if errno_ != errno.EINTR:
raise
self.update_interface()
- (pid, res) = os.waitpid(self.child_pid, os.WNOHANG)
- if pid == self.child_pid:
- break
+ try:
+ (pid, res) = os.waitpid(self.child_pid, os.WNOHANG)
+ if pid == self.child_pid:
+ break
+ except OSError, (errno_, errstr):
+ if errno_ != errno.EINTR:
+ raise
+ if errno_ == errno.ECHILD:
+ break
return res
def run(self, pm):
diff --git a/debian/changelog b/debian/changelog
index e67408ee..ce5c3b22 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,28 +1,17 @@
python-apt (0.7.92) UNRELEASED; urgency=low
- [ Julian Andres Klode ]
* Add apt_pkg.HashString and apt_pkg.IndexRecords (Closes: #456141)
* Add apt_pkg.Policy class (Closes: #382725)
* Provide a C++ API in the package python-apt-dev (Closes: #334923)
* Allow types providing __new__() to be subclassed.
* Bugfix: Delete pointers correctly, fixing memory leaks. (LP: #370149)
- * apt/package.py: Return VersionList objects in Package.versions, which
- are sequences and also provide features of mappings. (small API BREAK)
- * apt/progress/__init__.py: Check for EINTR in select (Closes: #499296)
- * Add support for Enhances as a dependency type (Closes: #416247)
- * apt/cache.py: Provide broken_count, delete_count, install_count, keep_count
- properties (Closes: #532338)
- * apt/cache.py: Correctly handle rootdir on second and later invocations of
- open() (LP: #320665).
* Add apt_pkg.DepCache.mark_auto() and apt.Package.mark_auto() methods to
mark a package as automatically installed.
* Drop apt_pkg.Cache.open() and apt_pkg.Cache.close(), they cause segfaults
- and memory leaks. Simply create a new cache instead.
- * Merge 0.7.10.4, 0.7.11.0 from unstable
- * debian/control: Update Standards-Version to 3.8.2
+ and memory leaks. Simply create a new cache instxead.
+ * Merge releases 0.7.10.4 - 0.7.12.0 from unstable
* Make AcquireFile a subclass of AcquireItem
* Make ConfigurationPtr,ConfigurationSub subclasses of Configuration.
- * debian/control: Build-Depend on libapt-pkg-dev (>= 0.7.22~).
* Unification of dependency handling:
- apt_pkg.parse_[src_]depends() now use CompType instead of CompTypeDeb
(i.e. < instead of <<) to match the interface of Version.depends_list_str
@@ -35,18 +24,12 @@ python-apt (0.7.92) UNRELEASED; urgency=low
* Make AcquireItem objects raise ValueError instead of segfaulting when the Acquire()
object is shut down or the main object (e.g. AcquireFile) is deallocated.
* Unify all Configuration,ConfigurationPtr,ConfigurationSub into one type.
- * Upgrade to debhelper 7 and remove debian/tmp in python-apt.install, to
- work around a bug in debhelper.
* Build-Depend on python-all-dev (>= 2.5.4-3), so we build for Python 2.6
* Simplify the whole building, build all Python versions with setup.py
* Introduce new progress (base) classes in apt_pkg:
- apt_pkg.AcquireProgress
- apt_pkg.OpProgress
- [ Sebastian Heinlein ]
- * apt/progress.py: Extract the package name from the status message
- (Closes: #532660)
-
-- Julian Andres Klode <jak@debian.org> Wed, 15 Jul 2009 14:56:24 +0200
python-apt (0.7.91) experimental; urgency=low
@@ -87,7 +70,59 @@ python-apt (0.7.90) experimental; urgency=low
-- Julian Andres Klode <jak@debian.org> Wed, 15 Apr 2009 13:47:42 +0200
-python-apt (0.7.11.0) UNRELEASED; urgency=low
+python-apt (0.7.12.0) unstable; urgency=low
+
+ [ Julian Andres Klode ]
+ * python/cache.cc:
+ - Support Breaks, Enhances dependency types (Closes: #416247)
+ * debian/control:
+ - Only recommend libjs-jquery (Closes: #527543)
+ - Build-depend on libapt-pkg-dev (>= 0.7.22~)
+ - Update Standards-Version to 3.8.2
+ * apt/cache.py:
+ - Correctly handle rootdir on second and later invocations of
+ open(), by calling InitSystem again. (LP: #320665).
+ - Provide broken_count, delete_count, install_count, keep_count
+ properties (Closes: #532338)
+ - Only create Package objects when they are requested, do not keep them in
+ a dict. Saves 10MB for 25,000 packages on my machine.
+ * apt/package.py:
+ - Allow to set the candidate of a package (Closes: #523997)
+ + Support assignments to the 'candidate' property of Package objects.
+ + Initial patch by Sebastian Heinlein
+ - Make comparisons of Version object more robust.
+ - Return VersionList objects in Package.versions, which are sequences
+ and also provide features of mappings. (partial API BREAK)
+ + Allows to get a specific version (Closes: #523998)
+ * apt/progress/__init__.py:
+ - Do not break out of InstallProgress.waitChild()'s loop just because it
+ is hitting EINTR, but only on child exit or on ECHILD.
+ * Use debhelper 7 instead of CDBS
+
+ [ Stefano Zacchiroli ]
+ * debian/python-apt.doc-base: register the documentation with the
+ doc-base system (Closes: #525134)
+
+ [ Sebastian Heinlein ]
+ * apt/progress.py: Extract the package name from the status message
+ (Closes: #532660)
+
+ -- Julian Andres Klode <jak@debian.org> Thu, 30 Jul 2009 14:08:30 +0200
+
+python-apt (0.7.11.1) unstable; urgency=low
+
+ [ Stephan Peijnik ]
+ * apt/progress/__init__.py:
+ - Exception handling fixes in InstallProgress class.
+
+ [ Michael Vogt ]
+ * python/tag.cc:
+ - merge patch from John Wright that adds FindRaw method
+ (closes: #538723)
+
+ -- Michael Vogt <mvo@debian.org> Wed, 29 Jul 2009 19:15:56 +0200
+
+python-apt (0.7.11.0) unstable; urgency=low
[ Julian Andres Klode ]
* data/templates/Debian.info.in: Squeeze will be 6.0, not 5.1
diff --git a/debian/control b/debian/control
index 36a4d8d8..7c3bfaac 100644
--- a/debian/control
+++ b/debian/control
@@ -6,9 +6,8 @@ Uploaders: Michael Vogt <mvo@debian.org>, Julian Andres Klode <jak@debian.org>
Standards-Version: 3.8.2
XS-Python-Version: >= 2.5
Build-Depends: apt-utils,
- cdbs,
- debhelper (>= 7),
- libapt-pkg-dev (>= 0.7.12~),
+ debhelper (>= 7.3.5),
+ libapt-pkg-dev (>= 0.7.22~),
python-all-dbg (>= 2.5.4-3),
python-all-dev (>= 2.5.4-3),
python3.1-dev,
diff --git a/debian/python-apt-dbg.install b/debian/python-apt-dbg.install
new file mode 100644
index 00000000..1bbba721
--- /dev/null
+++ b/debian/python-apt-dbg.install
@@ -0,0 +1 @@
+usr/lib/python*/*/*_d.so
diff --git a/debian/python-apt.docs b/debian/python-apt.docs
index 29219341..1bfc7c1c 100644
--- a/debian/python-apt.docs
+++ b/debian/python-apt.docs
@@ -1,4 +1,6 @@
README
+AUTHORS
+TODO
apt/README.apt
data/templates/README.templates
build/sphinx/html/
diff --git a/debian/python-apt.install b/debian/python-apt.install
index efd54743..ca86ed11 100644
--- a/debian/python-apt.install
+++ b/debian/python-apt.install
@@ -1,3 +1,6 @@
-usr/lib/python*
+usr/lib/python*/*/apt_pkg.so
+usr/lib/python*/*/apt_inst.so
+usr/lib/python*/*/*/
+usr/lib/python*/*/*.egg-info
usr/share/locale
usr/share/python-apt
diff --git a/debian/rules b/debian/rules
index 967da911..6e2204cf 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,50 +1,20 @@
#!/usr/bin/make -f
-
-DEB_AUTO_CLEANUP_RCS := yes
-DEB_PYTHON_SYSTEM=pycentral
-
export DH_PYCENTRAL=nomove
+export DEBVER=$(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')
+export CFLAGS=-Wno-write-strings
-DEB_PYTHON_PACKAGES_EXCLUDE=python-apt-dbg
-
-# Add here any variable or target overrides you need
-include /usr/share/cdbs/1/rules/debhelper.mk
-include /usr/share/cdbs/1/class/python-distutils.mk
-
-# Add python3 versions to the list of python versions
-cdbs_python_build_versions += $(shell find /usr/bin/python3.? | sed s/.*python//)
-
+%:
+ dh --with python-central $@
-DEBVER=$(shell dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p')
-DEB_COMPRESS_EXCLUDE:=.html .js _static/* _sources/* _sources/*/* .inv
-DEB_PYTHON_INSTALL_ARGS_ALL=--no-compile --install-layout=deb
-
-# Define COMPAT_0_7 to get all the deprecated interfaces.
-export CFLAGS+=-DCOMPAT_0_7 -Wno-write-strings
-export DEBVER
-
-build/python-apt-dbg::
- set -e; \
- for i in $(cdbs_python_build_versions); do \
- python$$i-dbg ./setup.py build; \
- done
-
-install/python-apt-dbg::
- for i in $(cdbs_python_build_versions); do \
- python$$i-dbg ./setup.py install --root $(CURDIR)/debian/python-apt-dbg \
- $(DEB_PYTHON_INSTALL_ARGS_ALL); \
- done
- find debian/python-apt-dbg \
- ! -type d ! -name '*_d.so' | xargs rm -f
- find debian/python-apt-dbg -depth -empty -exec rmdir {} \;
-
-binary-predeb/python-apt::
+override_dh_installdocs:
+ dh_installdocs
ln -sf ../../../../javascript/jquery/jquery.js \
debian/python-apt/usr/share/doc/python-apt/html/_static/jquery.js
-
-binary-predeb/python-apt-dbg::
rm -rf debian/python-apt-dbg/usr/share/doc/python-apt-dbg
ln -s python-apt debian/python-apt-dbg/usr/share/doc/python-apt-dbg
-clean::
- rm -rf build/lib* build/temp* build
+override_dh_strip:
+ dh_strip --dbg-package=python-apt-dbg
+
+override_dh_compress:
+ dh_compress -X.js -X_static/* -X _sources/* -X_sources/*/* -X.inv
diff --git a/po/python-apt.pot b/po/python-apt.pot
index 5d7e4984..d5acde5d 100644
--- a/po/python-apt.pot
+++ b/po/python-apt.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2009-07-19 15:59+0200\n"
+"POT-Creation-Date: 2009-07-30 20:28+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -369,16 +369,16 @@ msgstr ""
msgid "Complete"
msgstr ""
-#: ../apt/package.py:301
+#: ../apt/package.py:331
#, python-format
msgid "Invalid unicode in description for '%s' (%s). Please report."
msgstr ""
-#: ../apt/package.py:937 ../apt/package.py:1043
+#: ../apt/package.py:965 ../apt/package.py:1071
msgid "The list of changes is not available"
msgstr ""
-#: ../apt/package.py:1047
+#: ../apt/package.py:1075
#, python-format
msgid ""
"The list of changes is not available yet.\n"
@@ -387,7 +387,7 @@ msgid ""
"until the changes become available or try again later."
msgstr ""
-#: ../apt/package.py:1053
+#: ../apt/package.py:1081
msgid ""
"Failed to download the list of changes. \n"
"Please check your Internet connection."
@@ -441,32 +441,32 @@ msgstr ""
msgid "An essential package would be removed"
msgstr ""
-#: ../apt/progress/text.py:81
+#: ../apt/progress/text.py:82
#, python-format
msgid "%c%s... Done"
msgstr ""
-#: ../apt/progress/text.py:118
+#: ../apt/progress/text.py:121
msgid "Hit "
msgstr ""
-#: ../apt/progress/text.py:126
+#: ../apt/progress/text.py:130
msgid "Ign "
msgstr ""
-#: ../apt/progress/text.py:128
+#: ../apt/progress/text.py:132
msgid "Err "
msgstr ""
-#: ../apt/progress/text.py:138
+#: ../apt/progress/text.py:143
msgid "Get:"
msgstr ""
-#: ../apt/progress/text.py:198
+#: ../apt/progress/text.py:203
msgid " [Working]"
msgstr ""
-#: ../apt/progress/text.py:208
+#: ../apt/progress/text.py:214
#, python-format
msgid ""
"Media change: please insert the disc labeled\n"
@@ -475,19 +475,19 @@ msgid ""
msgstr ""
#. Trick for getting a translation from apt
-#: ../apt/progress/text.py:216
+#: ../apt/progress/text.py:223
#, python-format
msgid "Fetched %sB in %s (%sB/s)\n"
msgstr ""
-#: ../apt/progress/text.py:229
+#: ../apt/progress/text.py:239
msgid "Please provide a name for this Disc, such as 'Debian 2.1r1 Disk 1'"
msgstr ""
-#: ../apt/progress/text.py:241
+#: ../apt/progress/text.py:255
msgid "Please insert a Disc in the drive and press enter"
msgstr ""
-#: ../apt/cache.py:96
+#: ../apt/cache.py:120
msgid "Building data structures"
msgstr ""
diff --git a/python/tag.cc b/python/tag.cc
index 24a43320..b1a3e520 100644
--- a/python/tag.cc
+++ b/python/tag.cc
@@ -108,6 +108,29 @@ static PyObject *TagSecFind(PyObject *Self,PyObject *Args)
return PyString_FromStringAndSize(Start,Stop-Start);
}
+static char *doc_FindRaw = "FindRaw(Name) -> String/None";
+static PyObject *TagSecFindRaw(PyObject *Self,PyObject *Args)
+{
+ char *Name = 0;
+ char *Default = 0;
+ if (PyArg_ParseTuple(Args,"s|z",&Name,&Default) == 0)
+ return 0;
+
+ unsigned Pos;
+ if (GetCpp<pkgTagSection>(Self).Find(Name,Pos) == false)
+ {
+ if (Default == 0)
+ Py_RETURN_NONE;
+ return PyString_FromString(Default);
+ }
+
+ const char *Start;
+ const char *Stop;
+ GetCpp<pkgTagSection>(Self).Get(Start,Stop,Pos);
+
+ return PyString_FromStringAndSize(Start,Stop-Start);
+}
+
static char *doc_FindFlag = "FindFlag(Name) -> integer/none";
static PyObject *TagSecFindFlag(PyObject *Self,PyObject *Args)
{
@@ -410,10 +433,12 @@ static PyMethodDef TagSecMethods[] =
{
// Query
{"find",TagSecFind,METH_VARARGS,doc_Find},
+ {"find_raw",TagSecFindRaw,METH_VARARGS,doc_FindRaw},
{"find_flag",TagSecFindFlag,METH_VARARGS,doc_FindFlag},
{"bytes",TagSecBytes,METH_VARARGS,doc_Bytes},
#ifdef COMPAT_0_7
{"Find",TagSecFind,METH_VARARGS,doc_Find},
+ {"FindRaw",TagSecFindRaw,METH_VARARGS,doc_FindRaw},
{"FindFlag",TagSecFindFlag,METH_VARARGS,doc_FindFlag},
{"Bytes",TagSecBytes,METH_VARARGS,doc_Bytes},
#endif