Age | Commit message (Collapse) | Author | Files | Lines |
|
- 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
|
|
- Move all actual initialization work into tp_init, permit
reinitialization without leaking and use PyType_GenericNew for tp_new.
|
|
- ...means its been broken all along, sigh
|
|
|
|
- rpmdsRpmlib() can return errors but not really applicaple here
|
|
- 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.
|
|
- None of these are true enum uses as the value typically originates
from python integers etc.
|
|
- 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.
|
|
- this has never been used for anything at all, there are better things
to use our memory for than unused arrays
|
|
- 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.
|
|
- the naming between header/rpmte/rpmds "instance" is wonderfully
inconsistent... oh well
|
|
|
|
|
|
- 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
|
|
|
|
- also make them only accept one argument, simplifying arg parsing
|
|
|
|
|
|
- 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.
|
|
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
|
|
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.
|
|
- 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
|
|
- 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
|
|
- 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
|
|
|
|
|
|
|
|
- not very useful atm as various places return hard-wired built-in types
|
|
- 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()
|
|
- more preliminaries for subtyping
- remove pointless NULL checks
|
|
- pass (sub)type down to wrappers
- call subtype tp_alloc() instead of PyObject_New()
- preliminaries for allowing subtyping
|
|
- permits direct validation and conversion from arg parsing
|
|
- 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."
|
|
|
|
|
|
- nothing wrong with comments but empty comment placeholders
are not exactly useful
|
|
- all type object creation goes through foo_Wrap() which handle OOM
and all type specific initialization
|
|
- this way the only place where casts are needed are in the wrapper itself
|
|
|
|
- python adds next() methods for objects supporting iterators
|
|
|
|
|
|
- just call the ds object, no need to manually redo all this stuff
|
|
- 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
|
|
- tp_init can be called several times, allocating from there leaks memory
- tp_init gets called automatically on object creation, dont call manually
|
|
|
|
- these are just calling python defaults, no point at all...
|
|
- no point in wrapping all this stuff in our own functions
|
|
|
|
|