summaryrefslogtreecommitdiff
path: root/doc/source
diff options
context:
space:
mode:
Diffstat (limited to 'doc/source')
-rw-r--r--doc/source/apt_pkg.rst36
-rw-r--r--doc/source/examples/cache-pkgfile.py2
-rw-r--r--doc/source/whatsnew/0.8.0.rst82
3 files changed, 99 insertions, 21 deletions
diff --git a/doc/source/apt_pkg.rst b/doc/source/apt_pkg.rst
index 39b48c35..c814615c 100644
--- a/doc/source/apt_pkg.rst
+++ b/doc/source/apt_pkg.rst
@@ -167,7 +167,7 @@ Working with the cache
If *from_user* is ``True``, the package will be marked as manually
installed. This is the default.
- .. method:: set_re_install(pkg)
+ .. method:: set_reinstall(pkg)
Set if the :class:`Package` *pkg* should be reinstalled.
@@ -398,7 +398,7 @@ Resolving Dependencies
The component (eg. main)
- .. attribute:: file_name
+ .. attribute:: filename
The name of the file.
@@ -430,7 +430,7 @@ Resolving Dependencies
for pkgfile in cache.file_list:
if pkgfile.not_source:
- print 'The file %s has no source.' % pkgfile.file_name
+ print 'The file %s has no source.' % pkgfile.filename
.. attribute:: origin
@@ -809,7 +809,7 @@ Records
# Now you can access the record
print records.SourcePkg # == python-apt
- .. attribute:: file_name
+ .. attribute:: filename
Return the field 'Filename' of the record. This is the path to the
package, relative to the base path of the archive.
@@ -1103,7 +1103,7 @@ installation.
Constant for comparing :attr:`AcquireItem.status`
-.. class:: AcquireFile(owner, uri[, md5, size, descr, short_descr, dest_dir, dest_file])
+.. class:: AcquireFile(owner, uri[, md5, size, descr, short_descr, destdir, destfile])
Create a new :class:`AcquireFile()` object and register it with *acquire*,
so it will be fetched. AcquireFile objects provide no methods or attributes
@@ -1126,9 +1126,9 @@ installation.
used to describe the item in the progress class. *short_descr* is the
short form of it.
- You can use *dest_dir* to manipulate the directory where the file will
- be saved in. Instead of *dest_dir*, you can also specify the full path to
- the file using the parameter *dest_file*. You can not combine both.
+ You can use *destdir* to manipulate the directory where the file will
+ be saved in. Instead of *destdir*, you can also specify the full path to
+ the file using the parameter *destfile*. You can not combine both.
@@ -1379,7 +1379,7 @@ Configuration
Check whether the key *key* exists in the configuration.
- .. method:: sub_tree(key)
+ .. method:: subtree(key)
Return a sub tree starting at *key*. The resulting object can be used
like this one.
@@ -1429,7 +1429,7 @@ Configuration
Behaves like a :class:`Configuration()` objects, but provides access to
a subsection of another Configuration-like object. This type of object is
- returned by the :meth:`Configuration.sub_tree()` method.
+ returned by the :meth:`Configuration.subtree()` method.
.. data:: config
@@ -1459,7 +1459,7 @@ Modifying
the settings therein to the :class:`Configuration()` object specified by
the parameter *configuration*
-.. function:: parse_command_line(configuration, options, argv)
+.. function:: parse_commandline(configuration, options, argv)
This function is like getopt except it manipulates a configuration space.
output is a list of non-option arguments (filenames, etc). *options* is a
@@ -1541,11 +1541,11 @@ String functions
apt_pkg.check_domain_list("alioth.debian.org","debian.net,debian.org")
-.. function:: de_quote_string(string)
+.. function:: dequote_string(string)
Dequote the string specified by the parameter *string*, e.g.::
- >>> apt_pkg.DeQuoteString("%61%70%74%20is%20cool")
+ >>> apt_pkg.dequote_string("%61%70%74%20is%20cool")
'apt is cool'
.. function:: quote_string(string, repl)
@@ -1627,14 +1627,14 @@ String functions
Return the string *version*, eliminating everything following the last
'-'. Thus, this should be equivalent to ``version.rsplit('-', 1)[0]``.
-.. function:: uri_to_file_name(uri)
+.. function:: uri_to_filename(uri)
Take a string *uri* as parameter and return a filename which can be used to
store the file, based on the URI.
Example::
- >>> apt_pkg.uri_to_file_name('http://debian.org/index.html')
+ >>> apt_pkg.uri_to_filename('http://debian.org/index.html')
'debian.org_index.html'
@@ -1667,7 +1667,7 @@ Package States
.. data:: CURSTATE_HALF_INSTALLED
.. data:: CURSTATE_INSTALLED
.. data:: CURSTATE_NOT_INSTALLED
-.. data:: CURSTATE_UN_PACKED
+.. data:: CURSTATE_UNPACKED
@@ -1687,9 +1687,9 @@ Dependency types
Installed states
^^^^^^^^^^^^^^^^
.. data:: INSTSTATE_HOLD
-.. data:: INSTSTATE_HOLD_RE_INST_REQ
+.. data:: INSTSTATE_HOLD_REINSTREQ
.. data:: INSTSTATE_OK
-.. data:: INSTSTATE_RE_INST_REQ
+.. data:: INSTSTATE_REINSTREQ
.. _Priorities:
diff --git a/doc/source/examples/cache-pkgfile.py b/doc/source/examples/cache-pkgfile.py
index 1300a55c..f4cc2e66 100644
--- a/doc/source/examples/cache-pkgfile.py
+++ b/doc/source/examples/cache-pkgfile.py
@@ -7,7 +7,7 @@ def main():
apt_pkg.init()
cache = apt_pkg.Cache()
for pkgfile in cache.file_list:
- print 'Package-File:', pkgfile.file_name
+ print 'Package-File:', pkgfile.filename
print 'Index-Type:', pkgfile.index_type # 'Debian Package Index'
if pkgfile.not_source:
print 'Source: None'
diff --git a/doc/source/whatsnew/0.8.0.rst b/doc/source/whatsnew/0.8.0.rst
index d1ac3ac5..d507e82a 100644
--- a/doc/source/whatsnew/0.8.0.rst
+++ b/doc/source/whatsnew/0.8.0.rst
@@ -15,19 +15,97 @@ Python-apt is the first Debian package to support the third major release of
Python. The port is straight forward and integrates as nicely in Python 3 as
the Python 2 builds integrate in Python 2.
+Please be aware that python-apt builds for Python 3 are built without the
+compatibility options enabled for Python 2 builds. They also do not provide
+methods like :meth:`has_key` on mapping objects, because it has been removed
+in Python 3.
+
Real classes in :mod:`apt_pkg`
------------------------------
+The 0.8 release introduces real classes in the :mod:`apt_pkg` extension. This
+is an important step forward and makes writing code much easier, because you
+can see the classes without having to create an object first. It also makes
+it easier to talk about those classes, because they have a real name now.
+
+The 0.7 series shipped many functions for creating new objects, because the
+classes were not exported. In 0.8, the classes themselves replace those
+functions, as you can see in the following table.
+
+.. table::
+
+ ===================================== =================================
+ Function Replacing class
+ ===================================== =================================
+ :func:`apt_pkg.GetAcquire` :class:`apt_pkg.Acquire`
+ :func:`apt_pkg.GetCache()` :class:`apt_pkg.Cache`
+ :func:`apt_pkg.GetCdrom()` :class:`apt_pkg.Cdrom`
+ :func:`apt_pkg.GetDepCache()` :class:`apt_pkg.DepCache`
+ :func:`apt_pkg.GetPackageManager` :class:`apt_pkg.PackageManager`
+ :func:`apt_pkg.GetPkgAcqFile` :class:`apt_pkg.AcquireFile`
+ :func:`apt_pkg.GetPkgActionGroup` :class:`apt_pkg.ActionGroup`
+ :func:`apt_pkg.GetPkgProblemResolver` :class:`apt_pkg.ProblemResolver`
+ :func:`apt_pkg.GetPkgRecords` :class:`apt_pkg.PackageRecords`
+ :func:`apt_pkg.GetPkgSourceList` :class:`apt_pkg.SourceList`
+ :func:`apt_pkg.GetPkgSrcRecords` :class:`apt_pkg.SourceRecords`
+ :func:`apt_pkg.ParseSection` :class:`apt_pkg.TagSection`
+ :func:`apt_pkg.ParseTagFile` :class:`apt_pkg.TagFile`
+ ===================================== =================================
Complete rename of functions, methods and attributes
-----------------------------------------------------
+In May 2008, Ben Finney reported bug 481061 against the python-apt package,
+asking for PEP8 conformant names. With the release of python-apt 0.8, this
+is finally happening.
Supporting new language features like the :keyword:`with` statement
-------------------------------------------------------------------
+This is not a real big change, but it's good to have it:
+:class:`apt_pkg.ActionGroup` can now be used as a context manager for the
+:keyword:`with` statement. This makes it more obvious that you are using an
+action group, and is just cooler::
+
+ with apt_pkg.ActionGroup(depcache):
+ for package in my_selected_packages:
+ depcache.mark_install(package)
+
+This also works for :class:`apt.Cache`::
+
+ with cache.action_group(): # cache is an Instance of apt.Cache
+ for package in my_selected_packages:
+ package.mark_install() # Instance of apt.Package
+
Other changes
-------------
This release of python-apt also features several other, smaller changes:
- * Reduced memory usage by creating Package() objects in apt.Cache() only
- when needed.
+ * Reduced memory usage by making :class:`apt.Cache` create
+ :class:`apt.Package()` object dynamically, instead of creating all of
+ them during the cache initialization.
* Support to set the candidate version in :class:`apt.package.Package`
+
+Porting your applications to python-apt 0.8
+-------------------------------------------
+Porting your application to python-apt 0.8 may be trivial. You should download
+the source tarball of python-apt and run the tool utils/migrate-0.8 using
+Python 2.6 over your code::
+
+ python2.6 utils/migrate-0.8.py -c myapp.py mypackage/
+
+This will search your code for places where possibly deprecated names are
+used. Using the argument ``-c``, you can turn colorized output on.
+
+Now that you know which parts of your code have to be changed, you have to know
+how to do this. For classes, please look at the table. For all attributes,
+methods, functions, and their parameters the following rules apply:
+
+ 1. Replace leading [A-Z] with [a-z] (e.g DescURI => descURI)
+ 2. Replace multiple [A-Z] with [A-Z][a-z] (e.g. descURI => descUri)
+ 3. Replace every [A-Z] with the corresponding [a-z] (descUri => desc_uri)
+
+As an exception, refixes such as 'de' (e.g. 'dequote') or 'un' (e.g. 'unlock')
+are normally not seperated by underscores from the next word. There are also
+some other exceptions which are listed here, and apply to any name containing
+this word: **filename**, **filesize**, **destdir**, **destfile**, **dequote**,
+**unlock**, **reinstall**, **pinfile**, **REINSTREQ**, **UNPACKED**,
+**parse_commandline**.