summaryrefslogtreecommitdiff
path: root/python/pkgmanager.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-06-01 17:08:24 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2010-06-01 17:08:24 +0200
commite74ead9f918b38bfe8ae5cfe941df4057dcc509e (patch)
tree9f678aa2510cb1df272cd5beca5cf551794e6307 /python/pkgmanager.cc
parent5a062bb328348cd3a2ac693b579d35d0ce8e11f0 (diff)
parent50f9df7e415deb9bb6156ef8f596b6d4d49b23a4 (diff)
downloadpython-apt-e74ead9f918b38bfe8ae5cfe941df4057dcc509e.tar.gz
* merge from debian bzr, remaining changes:
- different mirror list * data/templates/gNewSense.info.in, data/templates/gNewSense.mirrors: - add gNewSense template and mirrors, thanks to Karl Goetz * apt/cache.py: - Make Cache.get_changes() much (~35x) faster (Closes: #578074). - Make Cache.req_reinstall_pkgs much faster as well. - Make Cache.get_providing_packages() about 1000 times faster. - Use has_versions and has_provides from apt_pkg.Package where possible. * apt/package.py: - Decode using utf-8 in installed_files (LP: #407953). - Fix fetch_source() to work when source name = binary name (LP: #552400). - Merge a patch from Sebastian Heinlein to make get_changelog() only check sources where source version >= binary version (Closes: #581831). - Add Version.source_version and enhance Sebastian's patch to make use of it, in order to find the best changelog for the package. * python: - Return bool instead of int to Python where possible, looks better. - Document every class, function, property. * python/cache.cc: - Check that 2nd argument to Cache.update() really is a SourceList object. - Fix PackageFile.not_automatic to use NotAutomatic instead of NotSource. - Add Package.has_versions to see which packages have at least one version, and Package.has_provides for provides. - Add rich compare methods to the Version object. * python/generic.cc: - Fix a memory leak when using old attribute names. - Map ArchiveURI property to archive_uri * python/progress.cc: - Do not pass arguments to InstallProgress.wait_child(). * doc: - Update the long documentation. * debian/control: - Change priority to standard, keep -doc and -dev on optional. * utils/migrate-0.8.py: - Open files in universal newline support and pass filename to ast.parse. - Add has_key to the list of deprecated functions. - Don't abort if parsing failed. - do not require files to end in .py if they are passed on the command line or if they contain python somewhere in the shebang line. * 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
Diffstat (limited to 'python/pkgmanager.cc')
-rw-r--r--python/pkgmanager.cc29
1 files changed, 23 insertions, 6 deletions
diff --git a/python/pkgmanager.cc b/python/pkgmanager.cc
index e8346b3d..df66c8c7 100644
--- a/python/pkgmanager.cc
+++ b/python/pkgmanager.cc
@@ -66,7 +66,7 @@ static PyObject *PkgManagerGetArchives(PyObject *Self,PyObject *Args)
bool res = pm->GetArchives(s_fetcher, s_list,
&s_records.Records);
- return HandleErrors(Py_BuildValue("b",res));
+ return HandleErrors(PyBool_FromLong(res));
}
static PyObject *PkgManagerDoInstall(PyObject *Self,PyObject *Args)
@@ -93,18 +93,35 @@ static PyObject *PkgManagerFixMissing(PyObject *Self,PyObject *Args)
bool res = pm->FixMissing();
- return HandleErrors(Py_BuildValue("b",res));
+ return HandleErrors(PyBool_FromLong(res));
}
static PyMethodDef PkgManagerMethods[] =
{
- {"get_archives",PkgManagerGetArchives,METH_VARARGS,"Load the selected archives into the fetcher"},
- {"do_install",PkgManagerDoInstall,METH_VARARGS,"Do the actual install"},
- {"fix_missing",PkgManagerFixMissing,METH_VARARGS,"Fix the install if a pkg couldn't be downloaded"},
+ {"get_archives",PkgManagerGetArchives,METH_VARARGS,
+ "get_archives(fetcher: Acquire, list: SourceList, recs: PackageRecords) -> bool\n\n"
+ "Download the packages marked for installation via the Acquire object\n"
+ "'fetcher', using the information found in 'list' and 'recs'."},
+ {"do_install",PkgManagerDoInstall,METH_VARARGS,
+ "do_install(status_fd: int) -> int\n\n"
+ "Install the packages and return one of the class constants\n"
+ "RESULT_COMPLETED, RESULT_FAILED, RESULT_INCOMPLETE. The argument\n"
+ "status_fd can be used to specify a file descriptor that APT will\n"
+ "write status information on (see README.progress-reporting in the\n"
+ "apt source code for information on what will be written there)."},
+ {"fix_missing",PkgManagerFixMissing,METH_VARARGS,
+ "fix_missing() -> bool\n\n"
+ "Fix the installation if a package could not be downloaded."},
{}
};
+static const char *packagemanager_doc =
+ "PackageManager(depcache: apt_pkg.DepCache)\n\n"
+ "PackageManager objects allow the fetching of packages marked for\n"
+ "installation and the installation of those packages. The parameter\n"
+ "'depcache' specifies an apt_pkg.DepCache object where information\n"
+ "about the package selections is retrieved from.";
PyTypeObject PyPackageManager_Type =
{
PyVarObject_HEAD_INIT(&PyType_Type, 0)
@@ -129,7 +146,7 @@ PyTypeObject PyPackageManager_Type =
0, // tp_as_buffer
(Py_TPFLAGS_DEFAULT | // tp_flags
Py_TPFLAGS_BASETYPE),
- "PackageManager Object", // tp_doc
+ packagemanager_doc, // tp_doc
0, // tp_traverse
0, // tp_clear
0, // tp_richcompare