summaryrefslogtreecommitdiff
path: root/python
AgeCommit message (Collapse)AuthorFilesLines
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
2009-06-09python/cache.cc: Fix segfaults using the new allocation methods.Julian Andres Klode2-3/+22
We switched to using tp_alloc() to create new objects. Some types had no tp_flags set and were not initialized using PyType_Ready, causing tp_alloc (PyType_GenericAlloc) to crash.
2009-06-08Fix build failures with python2.4-dbg (const)Julian Andres Klode2-3/+3
2009-06-08python/progress.cc: #include "generic.h" to fix build failure with python2.4Julian Andres Klode1-0/+1
2009-06-08python/indexrecords.cc: Swap tuple elements in lookup, and raise KeyError ↵Julian Andres Klode1-3/+8
when none is found.
2009-06-08Add apt_pkg.HashString and apt_pkg.IndexRecords (Closes: #456141)Julian Andres Klode5-1/+271
2009-06-08python/generic.h,tag.cc,configuration.cc: Use tp_alloc/tp_free instead of ↵Julian Andres Klode3-11/+12
PyObject_NEW/DEL This allows us to finally implement subclassing. Previously deletion of an instance of a subclass caused segmentation faults, this is not the case anymore.
2009-06-08merge with mvojak@debian.org1-6/+118
2009-06-05python/progress.cc, apt/progress/*.py: Use PEP 8 naming conventions for progressJulian Andres Klode1-17/+64
This changes the progress classes to use PEP 8 names. Due to the concept of the deprecation system, this causes methods of subclasses not to be called at all. If a class implements a command with underscores, it is called. If the class also implements the version in mixedCase, this is ignored. This means that all subclasses will not work correctly, because only the method from the parent class is called.
2009-06-05python/acquire.cc(AcquireItemType): Use "apt_pkg.AcquireItem" as tp_nameJulian Andres Klode1-1/+1
2009-06-05python/: Put all deprecated Get*() functions into #ifdef COMPAT_0_7.Julian Andres Klode10-9/+29
2009-06-05python/apt_pkgmodule.cc: Fix refcount problem.Julian Andres Klode1-1/+3
2009-06-05Introduce the rename rules formally, and add some exceptions.Julian Andres Klode6-18/+18
2009-06-04python/apt_pkgmodule.cc: Make sure all types are ready.Julian Andres Klode1-18/+1
2009-06-04python/cache.cc: Remove some (char*) to make migrate-0.8.py work again.Julian Andres Klode1-13/+13
2009-06-04python/: Unify naming conventions for all new names.Julian Andres Klode8-60/+60
Unify all names to follow these rules: 1. Replace the first [A-Z] with the lowercase version [a-z] 2. Replace multiple [A-Z] with [A-Z][a-z] (one upper, remaining ones lowercase) 3. Replace all remaining [A-Z] with _[a-z] This brings us from 'FileName' to 'file_name' and from 'DescURI' to 'desc_uri'. We will at a later stage add some exceptions to this rule, like 'filename' instead of 'file_name', to improve readability.
2009-06-04python/cache.cc, python/metaindex.cc: Convert remaining stuff to getset ↵Julian Andres Klode2-170/+356
descriptors.
2009-06-03python/apt_pkgmodule.cc: Rename STATE_* constants.Julian Andres Klode1-15/+15
2009-06-03python/: Convert most names to PEP8 naming conventions (except ↵Julian Andres Klode13-22/+329
Version,PackageFile,MetaIndex). On our way to close Bug#481061, this converts almost all names to PEP 8 naming conventions. Missing are now apt_pkg.Version, apt_pkg.PackageFile, apt_pkg.MetaIndex and apt.progress.*. In case of the missing apt_pkg classes, they are not converted yet because they do not use getset descriptors yet. apt.progress.* has not been converted yet because the extension interacts with it, and we first need to modify the extension to recognize the new names, as well as the old names (old applications shouldn't break).
2009-05-05* apt/progress/__init__.py:Michael Vogt1-7/+119
- add update_status_full() that takes file_size/partial_size as additional callback arguments - add pulse_items() that takes a addtional "items" tuple that gives the user full access to the individual items that are fetched * python/progress.cc: - low level code for update_status_full and pulse_items()
2009-04-24* python/*.cc: Fix build failures with python2.4-dbg.Julian Andres Klode5-9/+9
2009-04-19ActionGroups can be used as a context manager for the 'with' statement.Julian Andres Klode1-5/+27
2009-04-19* python/*.cc: Export all types and add a __new__() method to them.Julian Andres Klode14-174/+519
Some names may be changed before the release, but this is a good draft.
2009-04-17* python/apt_pkgmodule.cc: Do not access the modules __dict__.Julian Andres Klode1-60/+44
Instead of accessing the modules __dict__ directly, we should use the functions provided by Python to add objects to the module.
2009-04-17* python/generic.h: Force 0.7 compatibility to be off in Python 3 buildsJulian Andres Klode1-0/+2
2009-04-16* python/cache.cc: Correct the 'Auto' descriptor of the Package class.Julian Andres Klode1-1/+1