From e608d6106a75a678fe121afd8020073b9ba80836 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 20 Oct 2005 10:08:11 +0000 Subject: * merged with the progress reporting code Patches applied: * michael.vogt@ubuntu.com--2005/python-apt--progress-reporting--0--base-0 tag of michael.vogt@ubuntu.com--2005/python-apt--mvo--0--patch-43 * michael.vogt@ubuntu.com--2005/python-apt--progress-reporting--0--patch-1 * support the apt--progress-reporting--0 branch (using "InstallProgress.statusfd) * michael.vogt@ubuntu.com--2005/python-apt--progress-reporting--0--patch-2 * support for update reporting via vte/progress bars added, including a evil "pass-me-my-file-descriptor" hack * michael.vogt@ubuntu.com--2005/python-apt--progress-reporting--0--patch-3 * merged with python-apt--mvo * michael.vogt@ubuntu.com--2005/python-apt--progress-reporting--0--patch-4 * merged from python-apt--mvo * michael.vogt@ubuntu.com--2005/python-apt--progress-reporting--0--patch-5 * better support new python-apt, added example for gui-inst with support for VTE_PTY_KEEP_FD * michael.vogt@ubuntu.com--2005/python-apt--progress-reporting--0--patch-6 * removed the fdsend stuff again, libvte will be patched instead --- python/progress.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'python/progress.cc') diff --git a/python/progress.cc b/python/progress.cc index f79090f7..fb56ea87 100644 --- a/python/progress.cc +++ b/python/progress.cc @@ -11,6 +11,7 @@ #include #include "progress.h" + // generic bool PyCallbackObj::RunSimpleCallback(const char* method_name, PyObject *arglist, @@ -220,7 +221,7 @@ pkgPackageManager::OrderResult PyInstallProgress::Run(pkgPackageManager *pm) return pkgPackageManager::Failed; } if(!PyArg_Parse(result, "i", &child_id) ) - std::cerr << "result could not be parsed?"<< std::endl; + std::cerr << "custom fork() result could not be parsed?"<< std::endl; //std::cerr << "got: " << child_id << std::endl; } else { //std::cerr << "using build-in fork()" << std::endl; @@ -235,10 +236,14 @@ pkgPackageManager::OrderResult PyInstallProgress::Run(pkgPackageManager *pm) } #endif if (child_id == 0) { - res = pm->DoInstall(); + PyObject *v = PyObject_GetAttrString(callbackInst, "writefd"); + int fd = PyObject_AsFileDescriptor(v); + cout << "got fd: " << fd << endl; + res = pm->DoInstall(fd); _exit(res); } + StartUpdate(); while (waitpid(child_id, &ret, WNOHANG) == 0) UpdateInterface(); -- cgit v1.2.3