summaryrefslogtreecommitdiff
path: root/python/rpmds-py.c
AgeCommit message (Collapse)AuthorFilesLines
2011-07-06Revert the ds, ts, fi and spec python object creation commitsPanu Matilainen1-11/+13
- Hasty push-finger syndrom, while its not exactly plain wrong to do things this way, it doesn't really make sense for these types either. Python's own file object permits reinitialization though, so leaving rpm.fd() the way it is now. - This reverts the following commits: d056df28c38e602d82b4f9b527c686037074e660 3f77c3146da46a49f44b17fa66139fbe2dd9e45c 7214b2e0a271b7a7b3df312c58593878cbf56504 dc50fb2863c81159fb4cc8b25ce3862720c0cce5
2011-07-01Fix/sanitize rpm.ds python object creation a bitPanu Matilainen1-13/+11
- Move all actual initialization work into tp_init, permit reinitialization without leaking and use PyType_GenericNew for tp_new.
2011-06-09Eww, python ds.Instance() doesn't take any argumentsPanu Matilainen1-1/+1
- ...means its been broken all along, sigh
2011-03-09Python bindings dont need our debug.h for anythingPanu Matilainen1-2/+0
2011-03-04Remove unused return code variablePanu Matilainen1-2/+1
- rpmdsRpmlib() can return errors but not really applicaple here
2010-12-16Permit comparison operator strings (<, >= etc) in python ds constructorPanu Matilainen1-1/+44
- Creating ('foo', '>=', '1.2') dependency is much nicer than or'ing rpm.RPMSENSE_FOO for flags. Allow (but validate) the string usage, ints get passed as is.
2010-10-22Switch python bindings to use rpm(Dbi)TagVal as appropriatePanu Matilainen1-1/+1
- None of these are true enum uses as the value typically originates from python integers etc.
2010-05-19Handle non-existent dependency sets in python (RhBug:593553)Panu Matilainen1-2/+3
- rpmdsNew() returns NULL if the requested dependency type doesn't exist in the header. The C-side API can handle NULL to all rpmds "methods" and this is how librpm deals with non-existent sets rather than waste memory on for empty ds structures. However the python side wasn't expecting NULL for legal requests (but not setting error either) and thus blowing up with SystemError exception. - Raise TypeError on illegal arguments to rpm.ds constructor, and present non-existent dependency sets as empty rpm.ds objects to python. This lets python callers use iteration over ds items regardless of whether the dependency actually exists or not. The alternative of returning None (or raising exceptions) would break existing code for no particularly good reason.
2010-03-29Remove unused dependency set file reference countPanu Matilainen1-8/+0
- this has never been used for anything at all, there are better things to use our memory for than unused arrays
2010-03-29Remove unused and non-sensible depedency set build-timePanu Matilainen1-8/+0
- Buildtime was never part of rpm version comparison nor should it be, on rpm level the only sensible differentiator between two identical dependencies is the dependency color if any. Other than that, random() just as "appropriate" as build time.
2010-03-26Add ds.Instance() method to python bindingsPanu Matilainen1-0/+7
- the naming between header/rpmte/rpmds "instance" is wonderfully inconsistent... oh well
2010-03-26Take advantage of rpmdsCurrent() in python bindingsPanu Matilainen1-6/+1
2010-03-24Document deprecation of mi.count() and ds.Count().Ville Skyttä1-1/+1
2009-10-28Eliminate ambiguous tp_compare and tp_richcompare from rpm.dsPanu Matilainen1-106/+2
- both comparison types are highly ambiguous, eg what on earth does "foo provides bar = 1" < "bar requires foo > 2" mean? - if straight ds1.evr vs ds2.evr comparison is needed, we'll be better off supporting that through rpm.versionCompare() which has clear semantics - avoids another Python 3 incompatibility too
2009-10-28Add ds.Compare() as a thin wrapper over rpmdsCompare()Panu Matilainen1-0/+12
2009-10-28Type-check rpm.ds() comparison/search arguments everywherePanu Matilainen1-25/+10
- also make them only accept one argument, simplifying arg parsing
2009-10-28Rip out stillborn codePanu Matilainen1-32/+0
2009-10-27Argh, typo in previous commitPanu Matilainen1-1/+1
2009-10-27Remove explicit Py_TPFLAGS_HAVE_RICHCOMPARE from ds type flagsPanu Matilainen1-3/+1
- HAVE_RICHCOMPARE is included in Py_TPFLAGS_DEFAULT since at least Python 2.3 which is as far back as we care, no need to explicitly set it. Eliminating the unnecessary flag removes another Python 3 compatibility issue as the flag is gone there.
2009-10-19Generalize type object initialization to work with both Python 2.* and ↵David Malcolm1-2/+1
Python 3.* The layout of PyVarObject changed between python 2 and python 3, and this leads to the existing code for all of the various PyTypeObject initializers failing to compile with python 3 Change the way we initialize these structs to use PyVarObject_HEAD_INIT directly, rather than merely PyObject_HEAD_INIT, so that it compiles cleanly with both major versions of Python
2009-10-19Generalize access to ob_type so that they work with both Python 2.* and ↵David Malcolm1-2/+2
Python 3.* Python 2's various object structs use macros to implement common fields at the top of each struct. Python 3's objects instead embed a PyObject struct as the first member within the more refined object structs. Use the Py_TYPE() macro when accessing ob_type in order to encapsulate this difference.
2009-10-09Revert explicit PyErr_NoMemory() returns to just returning NULLPanu Matilainen1-1/+1
- tp_alloc failing is likely to be OOM but we dont know that for a fact, and the failing method is responsible for setting the exception
2009-10-05Handle all rpmds variants in its constructorPanu Matilainen1-37/+22
- either it takes a header + tag, or (name, flags, version) tuple + tag to generate a single dep - push rpm.dsSingle() compatibility out to python side - hdr.dsFromHeader() and hdr.dsOfHeader() no longer need to be in rpmds-py.c
2009-10-01Deprecation tweaksPanu Matilainen1-1/+1
- use PyErr_WarnEx() for better control and leave the tracking up to python - use PendingDeprecationWarning for now - document the replacing functionality in the deprecation messages - make hdr.sprintf() just an alias to hdr.format() without deprecating, at least for now it'd be only a gratuitous incompatible change on python side
2009-10-01Oops, these are mappings, not dicts...Panu Matilainen1-1/+1
2009-09-30Deprecate custom foo.count() methods, support len() insteadPanu Matilainen1-3/+3
2009-09-30Turn hdrGetHeader() into argument parsing converter interfacePanu Matilainen1-6/+7
2009-09-24Enable subtyping on the rest of our type-objectsPanu Matilainen1-1/+2
- not very useful atm as various places return hard-wired built-in types
2009-09-24Eliminate all custom tp_free() type methodsPanu Matilainen1-8/+1
- tp_free()'s purpose is only to free up the memory used by the python object structure, cleaning up our own allocations belongs to tp_dealloc()
2009-09-24Call (sub)type tp_free from destructorsPanu Matilainen1-4/+2
- more preliminaries for subtyping - remove pointless NULL checks
2009-09-24Make object allocation type agnosticPanu Matilainen1-7/+7
- pass (sub)type down to wrappers - call subtype tp_alloc() instead of PyObject_New() - preliminaries for allowing subtyping
2009-09-23Turn tagNumFromPyObject() into an object converter interfacePanu Matilainen1-14/+4
- permits direct validation and conversion from arg parsing
2009-09-23Remove tp_print methods from all rpm-python objectsPanu Matilainen1-13/+1
- these violate the intended use of tp_print, python docs state "A type should never implement tp_print in a way that produces different output than tp_repr or tp_str would."
2009-09-23Lose the debug junk from python bindingsPanu Matilainen1-15/+0
2009-09-22Rename python system.h for disambiguationPanu Matilainen1-1/+1
2009-09-22Lose the empty doxygen markersPanu Matilainen1-16/+0
- nothing wrong with comments but empty comment placeholders are not exactly useful
2009-09-22Put some consistency to python object creationPanu Matilainen1-5/+4
- all type object creation goes through foo_Wrap() which handle OOM and all type specific initialization
2009-09-22Make all python object creation wrappers return PyObject pointersPanu Matilainen1-13/+8
- this way the only place where casts are needed are in the wrapper itself
2009-09-22Dont leak memory on rpm.ds iterationPanu Matilainen1-2/+0
2009-09-22Lose unnecessary next() methodsPanu Matilainen1-16/+0
- python adds next() methods for objects supporting iterators
2009-09-22All rpm-python iterators are self-iterators, just use PyObject_SelfIterPanu Matilainen1-8/+1
2009-09-22Dont leak memory from rpm.dsSingle()Panu Matilainen1-2/+0
2009-09-22Simplify dsFromHeader()Panu Matilainen1-15/+2
- just call the ds object, no need to manually redo all this stuff
2009-09-22Sanitize python object -> tag number exception handlingPanu Matilainen1-12/+3
- raise exception in tagNumFromPyObject(), not in 12 different callers - check against RPMTAG_NOT_FOUND consistently instead of -1 and whatnot - unknown tags are value, not key or type errors
2009-09-22Move allocations out of rpmds object init methodPanu Matilainen1-28/+15
- tp_init can be called several times, allocating from there leaks memory - tp_init gets called automatically on object creation, dont call manually
2009-09-22Use Py_RETURN_NONE macro for returning None everywherePanu Matilainen1-10/+5
2009-09-22Eliminate unnecessary custom object allocation functionsPanu Matilainen1-12/+1
- these are just calling python defaults, no point at all...
2009-09-22Use generic python get/set attribute functions directly where appropriatePanu Matilainen1-12/+2
- no point in wrapping all this stuff in our own functions
2009-09-22Make the python object structures opaquePanu Matilainen1-0/+9
2009-09-22We dont support ancient python versions...Panu Matilainen1-2/+0