Bug 1136366
Summary: | make lvm2 Python 3 compatible | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Bohuslav "Slavek" Kabrda <bkabrda> | ||||
Component: | lvm2 | Assignee: | Zdenek Kabelac <zkabelac> | ||||
Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | high | ||||||
Version: | rawhide | CC: | agk, agrover, bmarzins, bmr, dwysocha, heinzm, herrold, jonathan, lvm-team, msnitzer, msuchy, prajnoha, prockai, vondruch, zkabelac | ||||
Target Milestone: | --- | Keywords: | FutureFeature | ||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | lvm2-2.02.119-1.fc23 | Doc Type: | Enhancement | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2015-05-04 13:10:36 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Bug Depends On: | |||||||
Bug Blocks: | 1024805 | ||||||
Attachments: |
|
Description
Bohuslav "Slavek" Kabrda
2014-09-02 12:44:11 UTC
Ping? Any progress here? Can somebody review this patch? mock-lvm depends on this and this troubles me when trying to update to F22/Rawhide. The changes to python/example.py are trivial and correct (print statement to function conversions). The changes to liblvm.c introduce a set of compatibility macros to handle the differences between integer and string type operations in py2 vs. py3; most of the remaining changes to this file simply replace the hard-coded python2 type calls with their wrapped macro equivalents. There are a couple of changes to use PyVarObject_HEAD_INIT() instead of PyObject_HEAD_INIT; this avoids compiler warnings for py3 builds but the PyVarObject* versions are available since py2.6 so this is not made conditional on python version (although it does restrict lvm2 builds to python runtimes >= 2.6). There is some further macro usage to handle py2 vs. py3 library initialisation; the return types (void vs. PyObject*) and passing of the method table, module name and description are different. These look a little ugly but I'm not sure it's worth the effort to do clean up and the method used is similar to that used by other C projects with python bindings. The remaining changes switch from PyObject_IsInstance() checks to the corresponding Py{Int,Long}_Check using the macros to select appropriately for 2 vs. 3. The final set of changes are to the python lvm2 unit tests. This introduces an alias for the int vs. long changes and replaces a handrolled sort comparator (compare_pv) with a lambda expression on the object name. I've not tested these changes but they seem correct and relatively simple - just shimming for renames and mapping the remaining things to interfaces that are the same in python 2 & 3. Upstreamed given patch: https://www.redhat.com/archives/lvm-devel/2015-April/msg00162.html Yes, sorry we lost this one, but I'm aiming for an upstream lvm2 release which will include this at the end of the week which we'll build for fedora next week. Great, thank you very much! OK, there's a separate lvm2-python3-libs lvm2 subpackage now which has those python3 bindings included. Though configuring and compiling the whole lvm2 source again just to add another version of python bindings is a bit odd - the code still stays the same, it's just the python binding part which changes, not counting with the fact that it makes the spec file a bit messy. We should provide a separate configure option for this later on probably so the code is configured and compiled only once. |