summaryrefslogtreecommitdiff
path: root/python
AgeCommit message (Collapse)AuthorFilesLines
2009-07-13python/apt_pkgmodule.cc: Remove all dependendy type constants, and cleanup.Julian Andres Klode1-87/+41
The dependency type constants have no use, because we do not export values anywhere. The cleanup moves all #ifdef COMPAT_0_7 together into one section.
2009-07-13python/apt_pkgmodule.cc: Fix build on Python 2.4Julian Andres Klode1-1/+1
2009-07-13python/apt_pkgmodule.cc: Add function name to ParseDepends and friends.Julian Andres Klode1-6/+7
2009-07-13python/generic.h: Use PyBytes_AS_STRING instead of PyBytes_AsString in ↵Julian Andres Klode1-1/+2
PyUnicode_AsString.
2009-07-13python/apt_pkgmodule.cc, python/apt_instmodule.cc: Remove useless state.Julian Andres Klode2-43/+13
This was copied over from "Porting Extension Modules to 3.0", and is not really needed.
2009-07-13python/apt_pkgmodule.cc: ParseDepends_old only needed in COMPAT_0_7.Julian Andres Klode1-0/+2
2009-07-13python: Rename all PyTypeObject's to conform to PEP 7.Julian Andres Klode15-177/+177
This is the first step towards implementing coding guidelines for the C++ code and providing an usable C++ API.
2009-07-12python/acquire.cc: Fix segmentation faults, introduce PyAcquireObject.Julian Andres Klode1-26/+70
Make AcquireItem objects raise ValueError instead of segfaulting when the Acquire() object is shut down or the main object (e.g. AcquireFile) is deallocated. This is implemented by using a vector of the AcquireItem objects, and setting AcquireItem->Object = NULL, when the memory 'Object' previously pointed to is going to be deleted.
2009-07-12python/hashes.cc: Introduce the Hashes class.Julian Andres Klode4-2/+141
The Hashes class is a function which calculates all supported hashes for one input. DebImg will use this for calculating the hashes of files.
2009-07-12python/policy.cc: Disable Policy.read_pindir() on apt < 0.7.22.Julian Andres Klode1-0/+4
2009-07-12python/cdrom.cc: Remove PkgCdromStruct, use pkgCdrom directly.Julian Andres Klode1-12/+6
2009-07-12python/indexfile.cc: Deallocate the pointer correctly.Julian Andres Klode1-2/+2
2009-07-12python/pkgsrcrecords.cc: Do not delete the pkgIndexFile*, it is managed by ↵Julian Andres Klode1-1/+5
PkgSrcRecords::Parser. APT still has a bug which causes the index file to not be deleted, but we should prepare for the fix.
2009-07-12python/sourcelist.cc: Do not delete the pkgIndexFile*, it is managed elsewhere.Julian Andres Klode1-1/+3
2009-07-12python/metaindex.cc: Fix deletion of the IndexFile objects in ↵Julian Andres Klode1-2/+5
MetaIndex.index_files First of all, make the objects mortal by decreasing their refcount after adding them to the list. Secondly, make the objects owned by MetaIndex and thirdly, set NoDelete on them, because they are managed by metaIndex.
2009-07-12python/sourcelist.cc: Fix deletion of MetaIndex objects returned in ↵Julian Andres Klode1-2/+5
SourceList.list. First of all, make the objects mortal by decreasing their refcount after adding them to the list. Secondly, make the objects owned by SourceList and thirdly, set NoDelete on them, because they are managed by SourceList.
2009-07-12python/cache.cc: Set NoDelete for Caches, instead of using the wrong dealloc ↵Julian Andres Klode1-1/+3
function.
2009-07-12python/depcache.cc: Set NoDelete for DepCaches, instead of using the wrong ↵Julian Andres Klode1-4/+5
dealloc function.
2009-07-12python/cache.cc: Py_DECREF the CacheFile, so it can be deleted.Julian Andres Klode1-1/+1
2009-07-11python/depcache.cc: Introduce DepCache.policy property.Julian Andres Klode1-0/+13
This property allows you to access the Policy of the DepCache.
2009-07-10python/generic.h: Introduce NoDelete field in CppPyObject.Julian Andres Klode1-4/+13
Setting NoDelete to true causes the deallocation functions to not delete the underlying C++ object. This is useful in situations where the object is already managed somewhere else, e.g. DepCache by CacheFile. It will also assist us in providing a flexible C++ API which only takes ownership if requested.
2009-07-10python/indexrecords.cc: Correctly Decrease refcount for HashString.Julian Andres Klode1-3/+6
Create a copy of the HashString() and create a CppPyObject for it. After adding it to the tuple, decrease the reference count. The HashString() copy allows us to deallocate the indexRecords and does not require the PyHashString objects to be CppOwnedPyObject.
2009-07-08python/pkgsrcrecords.cc: Unify dep handling -- part 2: ↵Julian Andres Klode1-1/+50
SourceRecords.build_depends Change apt_pkg.SourceRecords.build_depends to match exactly the interface of Version.depends_list_str just with different keys (e.g. Build-Depends). + Closes: #468123 - there is no need anymore for binding CompType or CompTypeDeb, because we don't return integer values for CompType anymore.
2009-07-08python/apt_pkgmodule.cc: Unify dep handling -- part 1: parse_depends()Julian Andres Klode1-5/+14
apt_pkg.parse_[src_]depends() now use CompType instead of CompTypeDeb (i.e. < instead of <<) to match the interface of Version.depends_list_str.
2009-07-07python/policy.cc: Add Policy_ReadPinDir() [APT 0.7.22]Julian Andres Klode1-0/+14
2009-06-25python: Use PyVarObject_HEAD_INIT() instead of PyObject_HEAD_INIT().Julian Andres Klode16-121/+34
This is related to PEP 3123 and fixes some compiler warnings.
2009-06-25python: Fix some build warnings.Julian Andres Klode7-14/+11
2009-06-25python/generic.h: Make PyObject_AsString() only accept unicode on Python 3.Julian Andres Klode1-1/+11
2009-06-25python/cache.cc: Support unicode objects and str objects in Python 2.Julian Andres Klode3-9/+34
2009-06-25python/tag.cc: Return False for non-strings in 'TagSection.__contains__()'.Julian Andres Klode1-0/+2
2009-06-25python/tag.cc: Store the return value of PyString_AsString as const char*.Julian Andres Klode1-1/+1
2009-06-25python/policy.cc: Use strcmp() for comparing strings.Julian Andres Klode1-3/+3
2009-06-23python/configuration.cc: Make ConfigurationPtr,ConfigurationSub subclasses ↵Julian Andres Klode1-0/+6
of Configuration. This makes isinstance(apt_pkg.config, apt_pkg.Configuration) return True instead of False.
2009-06-23python/acquire.cc: Make AcquireFile a subclass of AcquireItemJulian Andres Klode1-18/+32
Generalized the code a bit, so we can now access the various attributes of AcquireItem in the AcquireFile (pkgAcqFile is a subclass of pkgAcquire::Item). This will allow us to implement a raw object with a single pointer to an Item later, which we will need for the new progress interface.
2009-06-22python/cache.cc: Drop apt_pkg.Cache.open() and apt_pkg.Cache.close().Julian Andres Klode1-2/+5
Drop these functions, because they cause segfaults and memory leaks. To replace this functionality, simply create/delete a Cache object. This way, reference counting can work.
2009-06-22Add apt_pkg.DepCache.mark_auto() and apt.Package.mark_auto() methods toJulian Andres Klode1-0/+18
mark a package as automatically installed.
2009-06-21python/generic.h: Define a compat macro PyErr_WarnEx for Python 2.4Julian Andres Klode1-0/+5
2009-06-21python/apt_pkgmodule.cc: Delete apt_pkg.Version constant [API break]Julian Andres Klode1-1/+1
We can not keep the old apt_pkg.Version constant, because the name Version is already used by the Version class.
2009-06-21python: Make all CppOwnedPyObjects and similar support garbage collection.Julian Andres Klode8-70/+125
If you want to subclass apt_pkg.Cache() and create an apt_pkg.DepCache() object in it (e.g. as self.depcache) this is needed because otherwise, Python would not know about the cyclic dependency and refuse to free any of them. This also changes apt_pkg.Cache to the standard deallocation schema, because the underlying CacheFile deletes its pointers automatically on deletion. Thus a second call is not needed.
2009-06-21python/acquire.cc, python/indexfile.cc: Do not delete the pointers for some ↵Julian Andres Klode2-3/+5
objects. We can not delete the AcquireFile object's pointer on deallocation because this would cause the item to be removed from the fetcher, which would be incompatible to the previous behaviour. We can not delete the IndexFile object's pointer on deallocation because it is managed by other objects like MetaIndex.
2009-06-21python: Add DeprecationWarning to functions which were replaced by classes.Julian Andres Klode10-8/+37
2009-06-21python/cache.cc: Give more information on TypeErrors in CacheMapOpJulian Andres Klode1-1/+3
2009-06-21python/progress.cc: Just try to call a function and fallback.Julian Andres Klode1-21/+7
2009-06-21python/progress.cc: Fix segfault related to pulse_items.Julian Andres Klode1-5/+5
2009-06-15Add support for Enhances as a dependency type (Closes: #416247)Julian Andres Klode1-1/+1
2009-06-14python/cache.cc,depcache.cc: Do not delete the depcache and cache pointers.Julian Andres Klode2-2/+5
Deleting the pointers caused a crash because those pointers will also be deleted by closing the cache file.
2009-06-12Bugfix: Delete pointers correctly, fixing memory leaks. (LP: #370149)Julian Andres Klode11-16/+35
We previously called the destructor of the pointer. This resulted in no object using pointers being deallocated. This patch introduces CppDeallocPtr() and CppOwnedDeallocPtr() which do the same as the other CppDealloc() and CppOwnedDealloc(), but use 'delete' on the pointer instead of the deconstructor. Furthermore, this patch also changes AcquireFile to be a CppOwnedPyObject, owned by the Acquire object. Without this change, deleting the Acquire object would cause a crash when AcquireFile is deallocated.
2009-06-09python/apt_pkgmodule.cc: Fix the modulename.Julian Andres Klode1-1/+1
2009-06-09Add apt_pkg.Policy class (Closes: #382725)Julian Andres Klode4-1/+194
2009-06-09Allow types providing __new__() to be subclassed.Julian Andres Klode12-16/+32