summaryrefslogtreecommitdiff
path: root/python/progress.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-01-13 17:22:27 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2009-01-13 17:22:27 +0100
commit38d602dc83006c51dfe4ed594d691ea9b0679498 (patch)
treeb7aedfba82c44cad6c3012f879b5d6d7e8ad1425 /python/progress.cc
parent12cf58d12b969010f3d98b2974d72bbb950b775f (diff)
parent614897f798d9f16591fbd29ebe2a6c5674102d2d (diff)
downloadpython-apt-38d602dc83006c51dfe4ed594d691ea9b0679498.tar.gz
* apt/*.py:
- Almost complete cleanup of the code - Remove inconsistent use of tabs and spaces (Closes: #505443) - Improved documentation * apt/debfile.py: - Drop get*() methods, as they are deprecated and were never in a stable release - Make DscSrcPackage working * apt/gtk/widgets.py: - Fix the code and document the signals * Introduce new documentation build with Sphinx - Contains style Guide (Closes: #481562) - debian/rules: Build the documentation here - setup.py: Remove pydoc building and add new docs. - debian/examples: Include examples from documentation - debian/python-apt.docs: + Change html/ to build/doc/html. + Add build/doc/text for the text-only documentation * setup.py: - Only create build/data when building, not all the time - Remove build/mo and build/data on clean -a * debian/control: - Remove the Conflicts on python2.3-apt, python2.4-apt, as they are only needed for oldstable (sarge) - Build-Depend on python-sphinx (>= 0.5) * aptsources/distinfo.py: - Allow @ in mirror urls (Closes: #478171) (LP: #223097) * Merge Ben Finney's whitespace changes (Closes: #481563) * Merge Ben Finney's do not use has_key() (Closes: #481878) * Do not use deprecated form of raise statement (Closes: #494259) * Add support for PkgRecords.SHA256Hash (Closes: #456113)
Diffstat (limited to 'python/progress.cc')
-rw-r--r--python/progress.cc34
1 files changed, 17 insertions, 17 deletions
diff --git a/python/progress.cc b/python/progress.cc
index 99ad0a25..c5a1c138 100644
--- a/python/progress.cc
+++ b/python/progress.cc
@@ -14,7 +14,7 @@
// generic
-bool PyCallbackObj::RunSimpleCallback(const char* method_name,
+bool PyCallbackObj::RunSimpleCallback(const char* method_name,
PyObject *arglist,
PyObject **res)
{
@@ -50,8 +50,8 @@ bool PyCallbackObj::RunSimpleCallback(const char* method_name,
}
-// OpProgress interface
-void PyOpProgress::Update()
+// OpProgress interface
+void PyOpProgress::Update()
{
PyObject *o;
o = Py_BuildValue("s", Op.c_str());
@@ -64,7 +64,7 @@ void PyOpProgress::Update()
PyObject_SetAttrString(callbackInst, "majorChange", o);
Py_XDECREF(o);
- // Build up the argument list...
+ // Build up the argument list...
if(CheckChange(0.05))
{
PyObject *arglist = Py_BuildValue("(f)", Percent);
@@ -128,7 +128,7 @@ void PyFetchProgress::Fail(pkgAcquire::ItemDesc &Itm)
// Ignore certain kinds of transient failures (bad code)
if (Itm.Owner->Status == pkgAcquire::Item::StatIdle)
return;
-
+
if (Itm.Owner->Status == pkgAcquire::Item::StatDone)
{
UpdateStatus(Itm, DLIgnored);
@@ -159,7 +159,7 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner)
//std::cout << "Pulse" << std::endl;
if(callbackInst == 0)
return false;
-
+
// set stats
PyObject *o;
o = Py_BuildValue("f", CurrentCPS);
@@ -179,11 +179,11 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner)
Py_XDECREF(o);
PyObject *arglist = Py_BuildValue("()");
- PyObject *result;
+ PyObject *result;
RunSimpleCallback("pulse", arglist, &result);
bool res = true;
- if(!PyArg_Parse(result, "b", &res))
+ if(!PyArg_Parse(result, "b", &res))
{
// most of the time the user who subclasses the pulse()
// method forgot to add a return {True,False} so we just
@@ -199,22 +199,22 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner)
// install progress
-void PyInstallProgress::StartUpdate()
+void PyInstallProgress::StartUpdate()
{
RunSimpleCallback("startUpdate");
}
-void PyInstallProgress::UpdateInterface()
+void PyInstallProgress::UpdateInterface()
{
RunSimpleCallback("updateInterface");
}
-
-void PyInstallProgress::FinishUpdate()
+
+void PyInstallProgress::FinishUpdate()
{
RunSimpleCallback("finishUpdate");
}
-pkgPackageManager::OrderResult PyInstallProgress::Run(pkgPackageManager *pm)
+pkgPackageManager::OrderResult PyInstallProgress::Run(pkgPackageManager *pm)
{
void *dummy;
pkgPackageManager::OrderResult res;
@@ -233,7 +233,7 @@ pkgPackageManager::OrderResult PyInstallProgress::Run(pkgPackageManager *pm)
std::cerr << "custom fork found" << std::endl;
PyObject *arglist = Py_BuildValue("()");
PyObject *result = PyEval_CallObject(method, arglist);
- Py_DECREF(arglist);
+ Py_DECREF(arglist);
if (result == NULL) {
std::cerr << "fork method invalid" << std::endl;
PyErr_Print();
@@ -248,7 +248,7 @@ pkgPackageManager::OrderResult PyInstallProgress::Run(pkgPackageManager *pm)
//std::cerr << "using build-in fork()" << std::endl;
child_id = fork();
}
-
+
#if 0 // FIXME: this needs to be merged into apt to support medium swaping
if (child_id == 0) {
@@ -277,7 +277,7 @@ pkgPackageManager::OrderResult PyInstallProgress::Run(pkgPackageManager *pm)
//std::cerr << "custom waitChild found" << std::endl;
PyObject *arglist = Py_BuildValue("(i)",child_id);
PyObject *result = PyEval_CallObject(method, arglist);
- Py_DECREF(arglist);
+ Py_DECREF(arglist);
if (result == NULL) {
std::cerr << "waitChild method invalid" << std::endl;
PyErr_Print();
@@ -291,7 +291,7 @@ pkgPackageManager::OrderResult PyInstallProgress::Run(pkgPackageManager *pm)
//std::cerr << "got child_res: " << res << std::endl;
} else {
//std::cerr << "using build-in waitpid()" << std::endl;
-
+
while (waitpid(child_id, &ret, WNOHANG) == 0)
UpdateInterface();