| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Up to now we handled this via Python 3 compatibility defines in
rpmsystem-py.h but now that Python 2 is no longer supported, actually
update the codebase. No functional changes.
|
|
|
|
|
|
| |
Since commit 73a41da965337aaacabd53924f1b67b967e0476e this doesn't need
to be inline with murky linkage across different modules. With this,
it'd now be possible to add some central control too if we wanted.
|
|
|
|
|
|
|
| |
Commit 84920f898315d09a57a3f1067433eaeb7de5e830 regressed dnf install
to segfault at the end due to some NULL string passed to strlen().
Check for NULL and return it as None, make it an inline function
to make this saner.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the almost ten years of rpm sort of supporting Python 3 bindings, quite
obviously nobody has actually tried to use them. There's a major mismatch
between what the header API outputs (bytes) and what all the other APIs
accept (strings), resulting in hysterical TypeErrors all over the place,
including but not limited to labelCompare() (RhBug:1631292). Also a huge
number of other places have been returning strings and silently assuming
utf-8 through use of Py_BuildValue("s", ...), which will just irrevocably
fail when non-utf8 data is encountered.
The politically Python 3-correct solution would be declaring all our data
as bytes with unspecified encoding - that's exactly what it historically is.
However doing so would by definition break every single rpm script people
have developed on Python 2. And when 99% of the rpm content in the world
actually is utf-8 encoded even if it doesn't say so (and in recent times
packages even advertise themselves as utf-8 encoded), the bytes-only route
seems a wee bit too draconian, even to this grumpy old fella.
Instead, route all our string returns through a single helper macro
which on Python 2 just does what we always did, but in Python 3 converts
the data to surrogate-escaped utf-8 strings. This makes stuff "just work"
out of the box pretty much everywhere even with Python 3 (including
our own test-suite!), while still allowing to handle the non-utf8 case.
Handling the non-utf8 case is a bit more uglier but still possible,
which is exactly how you want corner-cases to be. There might be some
uses for retrieving raw byte data from the header, but worrying about
such an API is a case for some other rainy day, for now we mostly only
care that stuff works again.
Also add test-cases for mixed data source labelCompare() and
non-utf8 insert to + retrieve from header.
|
|
|
|
|
|
|
| |
Older Python versions are long since past their EOL, we don't need to
support them either. Python 2.7 is also the least incompatible version
compared to Python 3, going forward. Nuke the now unnecessary compat
macros.
|
|
|
|
|
|
|
|
|
|
|
| |
When PyArg_ParseTupleAndKeywords() is used with format argument "s#"
that means get a string and his length then the length is returned as
as a Py_ssize_t in python3 but as an int in python2, which casues
a problem because rpmfd_write() that uses PyArg_ParseTupleAndKeywords()
expects the length as a Py_ssize_t always. This problem affects big
endian systems with python2 as default. If PY_SSIZE_T_CLEAN is defined
then PyArg_ParseTupleAndKeywords() returns the length as a Py_ssize_t
in both python2 and python3.
|
| |
|
|
|
|
| |
- thanks zpavlas for pointing this out.
|
|
|
|
|
|
| |
- rpm.header.new() will still keep accepting PyCObject for now in case a
client library depends on this.
- involves macro trickery to make rpm buildable against python 2.6 still.
|
|
|
|
|
| |
- Oops. Quite obviously nobody has even tried to build this with
python < 2.6. Whether it'd actually work is another question...
|
|
|
|
|
|
| |
- PyString is gone, use PyBytes instead
- Add compatibility defines to paper over
PyInt/PyLong_JustHowLongFunctionNamesYouCanComeUpWith()
|
|
|
|
|
|
| |
- Include what little we need from standard headers instead
of relying on rpm source tree system.h for anything.
- Remove non-public includes from python binding include paths
|
|
|
|
|
| |
- Python 3 unified PyInt with PyLong, the former no longer exists
- Based on a patch by David Malcolm
|
|
|
|
|
|
|
| |
- In Python 2.6 PyBytes is just an alias for PyString, Python 3.0
removed PyString entirely
- Add compatibility defines for Python < 2.6
- Based on David Malcolm's Python 3.x efforts
|
| |
|
| |
|
|
|
|
| |
- pretty much everything might need this...
|
|
|