diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2007-12-06 16:13:54 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2007-12-06 16:13:54 +0100 |
| commit | c394a309fe4094867c1713cac21bfffb6b4c9b6b (patch) | |
| tree | e6d23c370202ca9faf73d696e5deeb5715231f97 /python | |
| parent | 1d71e83e5646f35fd15e06bcc58d3a0a4b7f3c98 (diff) | |
| parent | 63e4e0f6eeebf5a2ee7422d717fa85b4fa883951 (diff) | |
| download | python-apt-c394a309fe4094867c1713cac21bfffb6b4c9b6b.tar.gz | |
* apt/debfile.py:
- added wrapper around apt_inst.debExtract()
- support dictionary like access
* python/apt_instmodule.cc:
- added arCheckMember()
* aptsources/distro.py:
- throw NoDistroTemplateException if not distribution template
can be found
* python/string.cc:
- fix overflow in SizeToStr()
* python/depcache.cc:
- be more threading friendly
* python/tag.cc
- support "None" as default in
ParseSection(control).get(field, default), LP: #44470
* python/progress.cc:
- fix refcount problem in OpProgress
- fix refcount problem in FetchProgress
- fix refcount problem in CdromProgress
* apt/README.apt:
- fix typo (thanks to Thomas Schoepf, closes: #387787)
* po/fr.po:
- merge update, thanks to Christian Perrier (closes: #435918)
- throw FetchCancelleException, FetchFailedException,
- SizeToString supports PyLong too
* python/depcache.cc:
- "IsGarbage()" method added (to support auto-mark)
* apt/progress.py:
- initialize FetchProgress.eta with the correct type
- strip the staus str before passing it to InstallProgress.statusChanged()
- added InstallProgress.statusChange(pkg, percent, status)
- make DumbInstallProgress a new-style class
(thanks to kamion for the suggestions)
- fix various pychecker warnings
* apt/cache.py:
* memleak fixed when pkgCache objects are deallocated
no longer locale specific but always english
Diffstat (limited to 'python')
| -rw-r--r-- | python/depcache.cc | 27 | ||||
| -rw-r--r-- | python/progress.cc | 11 | ||||
| -rw-r--r-- | python/tag.cc | 7 |
3 files changed, 32 insertions, 13 deletions
diff --git a/python/depcache.cc b/python/depcache.cc index 94ff708c..5664a6d8 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -227,17 +227,19 @@ static PyObject *PkgDepCacheGetCandidateVer(PyObject *Self,PyObject *Args) static PyObject *PkgDepCacheUpgrade(PyObject *Self,PyObject *Args) { + bool res; pkgDepCache *depcache = GetCpp<pkgDepCache *>(Self); char distUpgrade=0; if (PyArg_ParseTuple(Args,"|b",&distUpgrade) == 0) return 0; - bool res; + Py_BEGIN_ALLOW_THREADS if(distUpgrade) res = pkgDistUpgrade(*depcache); else res = pkgAllUpgrade(*depcache); + Py_END_ALLOW_THREADS Py_INCREF(Py_None); return HandleErrors(Py_BuildValue("b",res)); @@ -245,12 +247,15 @@ static PyObject *PkgDepCacheUpgrade(PyObject *Self,PyObject *Args) static PyObject *PkgDepCacheMinimizeUpgrade(PyObject *Self,PyObject *Args) { + bool res; pkgDepCache *depcache = GetCpp<pkgDepCache *>(Self); if (PyArg_ParseTuple(Args,"") == 0) return 0; - bool res = pkgMinimizeUpgrade(*depcache); + Py_BEGIN_ALLOW_THREADS + res = pkgMinimizeUpgrade(*depcache); + Py_END_ALLOW_THREADS Py_INCREF(Py_None); return HandleErrors(Py_BuildValue("b",res)); @@ -351,8 +356,10 @@ static PyObject *PkgDepCacheMarkInstall(PyObject *Self,PyObject *Args) &autoInst, &fromUser) == 0) return 0; + Py_BEGIN_ALLOW_THREADS pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj); depcache->MarkInstall(Pkg, autoInst, 0, fromUser); + Py_END_ALLOW_THREADS Py_INCREF(Py_None); return HandleErrors(Py_None); @@ -521,7 +528,7 @@ static PyMethodDef PkgDepCacheMethods[] = { {"Init",PkgDepCacheInit,METH_VARARGS,"Init the depcache (done on construct automatically)"}, {"GetCandidateVer",PkgDepCacheGetCandidateVer,METH_VARARGS,"Get candidate version"}, - {"SetCandidateVer",PkgDepCacheSetCandidateVer,METH_VARARGS,"Get candidate version"}, + {"SetCandidateVer",PkgDepCacheSetCandidateVer,METH_VARARGS,"Set candidate version"}, // global cache operations {"Upgrade",PkgDepCacheUpgrade,METH_VARARGS,"Perform Upgrade (optional boolean argument if dist-upgrade should be performed)"}, @@ -652,23 +659,31 @@ PyObject *GetPkgProblemResolver(PyObject *Self,PyObject *Args) static PyObject *PkgProblemResolverResolve(PyObject *Self,PyObject *Args) { + bool res; pkgProblemResolver *fixer = GetCpp<pkgProblemResolver *>(Self); char brokenFix=1; if (PyArg_ParseTuple(Args,"|b",&brokenFix) == 0) return 0; - bool res = fixer->Resolve(brokenFix); + Py_BEGIN_ALLOW_THREADS + res = fixer->Resolve(brokenFix); + Py_END_ALLOW_THREADS return HandleErrors(Py_BuildValue("b", res)); } static PyObject *PkgProblemResolverResolveByKeep(PyObject *Self,PyObject *Args) -{ +{ + bool res; pkgProblemResolver *fixer = GetCpp<pkgProblemResolver *>(Self); if (PyArg_ParseTuple(Args,"") == 0) return 0; - bool res = fixer->ResolveByKeep(); + + Py_BEGIN_ALLOW_THREADS + res = fixer->ResolveByKeep(); + Py_END_ALLOW_THREADS + return HandleErrors(Py_BuildValue("b", res)); } diff --git a/python/progress.cc b/python/progress.cc index df9c2ec1..793265db 100644 --- a/python/progress.cc +++ b/python/progress.cc @@ -65,10 +65,11 @@ void PyOpProgress::Update() Py_XDECREF(o); // Build up the argument list... - PyObject *arglist = Py_BuildValue("(f)", Percent); if(CheckChange(0.05)) + { + PyObject *arglist = Py_BuildValue("(f)", Percent); RunSimpleCallback("update", arglist); - Py_XDECREF(arglist); + } }; void PyOpProgress::Done() @@ -163,14 +164,19 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner) PyObject *o; o = Py_BuildValue("f", CurrentCPS); PyObject_SetAttrString(callbackInst, "currentCPS", o); + Py_XDECREF(o); o = Py_BuildValue("f", CurrentBytes); PyObject_SetAttrString(callbackInst, "currentBytes", o); + Py_XDECREF(o); o = Py_BuildValue("i", CurrentItems); PyObject_SetAttrString(callbackInst, "currentItems", o); + Py_XDECREF(o); o = Py_BuildValue("i", TotalItems); PyObject_SetAttrString(callbackInst, "totalItems", o); + Py_XDECREF(o); o = Py_BuildValue("f", TotalBytes); PyObject_SetAttrString(callbackInst, "totalBytes", o); + Py_XDECREF(o); PyObject *arglist = Py_BuildValue("()"); PyObject *result; @@ -306,6 +312,7 @@ void PyCdromProgress::Update(string text, int current) PyObject *o = Py_BuildValue("i", totalSteps); PyObject_SetAttrString(callbackInst, "totalSteps", o); + Py_XDECREF(o); RunSimpleCallback("update", arglist); } diff --git a/python/tag.cc b/python/tag.cc index d0d862c9..4b378a55 100644 --- a/python/tag.cc +++ b/python/tag.cc @@ -78,7 +78,7 @@ static PyObject *TagSecFind(PyObject *Self,PyObject *Args) { char *Name = 0; char *Default = 0; - if (PyArg_ParseTuple(Args,"s|s",&Name,&Default) == 0) + if (PyArg_ParseTuple(Args,"s|z",&Name,&Default) == 0) return 0; const char *Start; @@ -86,10 +86,7 @@ static PyObject *TagSecFind(PyObject *Self,PyObject *Args) if (GetCpp<pkgTagSection>(Self).Find(Name,Start,Stop) == false) { if (Default == 0) - { - Py_INCREF(Py_None); - return Py_None; - } + Py_RETURN_NONE; return PyString_FromString(Default); } return PyString_FromStringAndSize(Start,Stop-Start); |
