summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Release of libvirt-python 1.2.2v1.2.2Daniel Veillard2014-03-021-1/+1
|
* generator: Skip exporting only sentinelsv1.2.2-rc2Martin Kletzander2014-02-201-5/+14
| | | | | | | | | | | | When enum type has '_LAST' in its name, but is not the last type in that enum, it's skipped even though it shouldn't be. Currently, this is the case for only VIR_NETWORK_UPDATE_COMMAND_ADD_LAST inside an enum virNetworkUpdateCommand. Also, since _LAST types can have other enums instead of values, that needs to be filtered out using a try-except when converting the value. Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
* Fix stream related spelling mistakesPhilipp Hahn2014-02-131-2/+2
| | | | | | Consistent spelling of all-uppercase I/O. Signed-off-by: Philipp Hahn <hahn@univention.de>
* examples: demonstrate network eventsEric Blake2014-02-111-19/+51
| | | | | | | | | Commit 6ea5be0 added network event callback support, so we might as well demonstrate that it works by updating our example. * examples/event-test.py: Add network event, fix typos. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: ignore editor filesEric Blake2014-02-041-0/+2
| | | | | | * .gitignore: Exclude emacs cruft. Signed-off-by: Eric Blake <eblake@redhat.com>
* Merge tag 'v1.2.1'Eric Blake2014-02-031-1/+1
|\ | | | | | | Release of libvirt-python-1.2.1
| * Release of libvirt-python-1.2.1v1.2.1Daniel Veillard2014-01-161-1/+1
| |
* | Fix calling of virStreamSend methodRobie Basak2014-01-231-1/+1
|/ | | | | | | | | Change d40861 removed the 'len' argument from the virStreamSend C level wrapper, but forgot to remove it from the python level wrapper. Reported-by: Robie Basak <robie.basak@canonical.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* virStream.sendAll() fix raising an undeclared varv1.2.1-rc2Doug Goldstein2014-01-101-0/+1
| | | | | | The exception is raised from the variable 'e', which was undeclared in this context. Used code that is compatible with old and new Python versions.
* Add space after comma for consistency with code stylev1.2.1-rc1Doug Goldstein2014-01-021-1/+1
|
* define __GNUC_PREREQ macro before using itDoug Goldstein2013-12-301-0/+10
| | | | | | We brought over use of the __GNUC_PREREQ macro from libvirt but didn't bring over the definition of it. This brings over the macro from libvirt sources.
* Rewrite libvirt_charPtrUnwrap to work with Python 3.0->3.2Daniel P. Berrange2013-12-121-8/+11
| | | | | | | | The PyUnicode_AsUTF8 method doesn't exist prior to Python 3.3. It is also somewhat inefficient, so rewrite it to use an intermediate PyBytes object. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Add python3 to the automated build and RPMDaniel P. Berrange2013-12-122-9/+58
| | | | | | | | This updates autobuild.sh to test the python3 build process. The RPM specfile is changed to build a libvirt-python3 RPM on Fedora > 18 Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Skip network event callbacks in sanity testDaniel P. Berrange2013-12-111-0/+2
| | | | Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Fix return type in override method for virStreamRecvDaniel P. Berrange2013-12-111-2/+3
| | | | | | The virStreamRecv override returns a PyObject not an int Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* sanitytest: remove use of string.lower()Daniel P. Berrange2013-12-111-2/+2
| | | | | | | Call lower() directly on the string object instance, not the class Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* sanitytest: Fix broken comparison between int and stringDaniel P. Berrange2013-12-111-1/+1
| | | | | | | Python2 was forgiving of a comparison between an int and string but Python3 gets very upset. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* override: Switch virStreamSend wrapper to use libvirt_charPtrSizeUnwrapDaniel P. Berrange2013-12-113-5/+34
| | | | | | | | Instead of using a 'z#i' format string to receive byte array, use 'O' and then libvirt_charPtrSizeUnwrap. This lets us hide the Python 3 vs 2 differences in typewrappers.c Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* override: Conditionalize use of PyString_Check and PyInt_CheckDaniel P. Berrange2013-12-111-0/+6
| | | | | | | The PyString and PyInt classes are gone in Python 3, so we must conditionalize their use to be Python 2 only. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* typewrappers: PyInt/PyLong merge for Python3Daniel P. Berrange2013-12-111-5/+28
| | | | | | | In Python3 the PyInt / PyLong types have merged into a single PyLong type. Conditionalize the use of PyInt to Python 2 only Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* typewrappers: Replace use of PyString classDaniel P. Berrange2013-12-111-0/+19
| | | | | | | | Replace use of PyString with either PyBytes or PyUnicode. The former is used for buffers with explicit sizes, which are used by APIs processing raw bytes. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* override: Replace PyInt_AsLong with helperDaniel P. Berrange2013-12-111-7/+3
| | | | | | | | Replace use of the PyInt_AsLong libvirt_intUnwrap helper. This isolates the need for Python3 specific code in one place Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* override: Replace Py{Int,Long}_FromLong with helpersDaniel P. Berrange2013-12-114-53/+62
| | | | | | | | | Replace use of the PyInt_FromLong and PyLong_FromLongLong with libvirt_{int,uint,longlong,ulonglong}Wrap helpers. This isolates the need for Python3 specific code in one place. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* override: Replace PyString_AsString with libvirt_charPtrUnwrapDaniel P. Berrange2013-12-113-44/+81
| | | | | | | | | | | Replace calls to PyString_AsString with the helper method libvirt_charPtrUnwrap. This isolates the code that will change in Python3. In making this change, all callers now have responsibility for free'ing the string. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* override: Replace PyString_FromString with libvirt_constcharPtrWrapDaniel P. Berrange2013-12-112-20/+20
| | | | | | | | Make use of libvirt_constcharPtrWrap in all override code, to match generated code. This will isolate Python3 specific changes in one place. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* sanitytest: Fix libvirtError class handling for Python 2.4Daniel P. Berrange2013-12-111-1/+3
| | | | | | | | | The Exception class hiearchy in Python 2.4 reports different data types than in later Python versions. As a result the type(libvirt.libvirtError) does not return 'type'. We just special case handling of this class. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* override: Fix native module registration to work with Python3Daniel P. Berrange2013-12-113-55/+166
| | | | | | | The way native modules are registered has completely changed, so the code must be #ifdef'd for Python2 & 3 Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* examples: Ensure we write bytes to the self-pipeDaniel P. Berrange2013-12-111-1/+1
| | | | | | | | Strings in python3 default to unicode, so when writing to the self-pipe we must be sure to use bytes by calling the encode() method. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* examples: Invoke print("...") instead of print "..."Daniel P. Berrange2013-12-118-85/+82
| | | | | | | The 'print' method must be called as a function in python3, ie with brackets. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Don't free passed in args in libvirt_charPtrWrap / libvirt_charPtrSizeWrapDaniel P. Berrange2013-12-112-3/+3
| | | | | | | Functions should not make assumptions about the memory management callers use for parameters Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Added python binding for the new network events APICédric Bosdonnat2013-12-113-0/+188
| | | | | | | The new network events code requires manual binding code to be written. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* test: Invoke print("...") instead of print "..."Doug Goldstein2013-12-091-5/+5
| | | | | | The 'print' statement no longer exists in Python 3 and now must be called as a function. This is compatible down to Python 2.4 as we are not using any special syntax of the function.
* override: Fix exception handling syntaxDoug Goldstein2013-12-092-3/+8
| | | | | | Python 3 no longer accepts 'except Exception, e:' as valid while Python 2.4 does not accept the new syntax 'except Exception as e:' so this uses a fall back method that is compatible with both.
* generator: Sort enums and functions when generating codeDaniel P. Berrange2013-12-091-2/+8
| | | | | | | | To assist in diff comparisons between code generated with different versions of Python, do an explicit sort of all functions and enums. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* generator: Remove use of string.replace and string.find functionsDaniel P. Berrange2013-12-091-3/+3
| | | | | | | | Call the 'replace' and 'find' functions directly on the string variables, instead of via the 'string' module. Python3 only accepts the latter syntax Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* generator: Update to use sort() 'key' paramDaniel P. Berrange2013-12-091-22/+8
| | | | | | | The sort() method previously took either a comparator function or a key function. Only the latter is supported in Python3. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* generator: Remove use of 'has_key' functionDaniel P. Berrange2013-12-091-54/+54
| | | | | | | | | | | The code 'XXX.has_key(YYYY)' must be changed to be of the form 'YYY in XXXX' which works in Python2 and 3 As an added complication, if 'YYY in XXX' is used against an object overriding the '__getitem__' method it does not work in Python 2.4. Instead we must use 'YYY in XXX.keys()' Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Update exception catching in generated codeDoug Goldstein2013-12-051-4/+8
| | | | | | | | Use a syntax for exception handling that works in both Python 2 and Python 3. The new syntax is 'except Exception as e:' but this does not work in older Pythons so we use the most compatible way by just catching the exception and getting the type and the exception value after the fact.
* generator: Support exceptions in Python 2 and 3Doug Goldstein2013-12-051-2/+4
| | | | | Use a syntax for exception handling that works in both Python 2 and Python 3
* setup: Drop unused exception variableDoug Goldstein2013-12-051-1/+1
| | | | | Drop the unused exception variable in setup.py. This has the benefit of dropping syntax that is not valid with Python 3.
* generator: Cast iterators to a list() explicitlyDaniel P. Berrange2013-12-041-19/+19
| | | | | | | In python3 various methods list 'dict.keys()' do not return a list, so we must explicitly cast the result. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Revert "Optimize callback lookup in event handlers"Daniel P. Berrange2013-12-041-11/+24
| | | | | | | | | This reverts commit 084729e26905f574b8c057cc4c732b1b6ce852d3. The PyImport_ImportModuleNoBlock method does not exist in python 2.4 Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Revert accidental change to exception handling syntaxDaniel P. Berrange2013-12-041-2/+2
| | | | | | | The previous commit changed the exception handling syntax to use 'as' instead of a ','. This doesn't work with python 2.4 Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* generator: Invoke print("...") instead of print "..."Daniel P. Berrange2013-12-041-21/+21
| | | | | | | The 'print' method must be called as a function in python3, ie with brackets. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* generator: Remove string.lower(XXX) with XXX.lower()Daniel P. Berrange2013-12-041-45/+45
| | | | | | | | | In python3 the string.lower() method doesn't exist, the lower() function can only be executed against a string variable directly. Python2 supported both approaches so this change is compatible Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* generator: Don't use 'list' as a variable nameDaniel P. Berrange2013-12-041-4/+4
| | | | | | | | In python3 if we use 'list' as a variable name it causes it to hide the corresponding 'list()' function from the entire function that holds the variable. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Optimize callback lookup in event handlersDaniel P. Berrange2013-12-041-24/+11
| | | | | | | | | | The event handler code currently invokes PyImport_ImportModule which is very heavyweight. This is not in fact required, since we know the libvirt module has already been imported. We can thus use PyImport_ImportModuleNoBlock and do away with the global variables caching the imported module reference. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Fix use of virDomainEventRegister in python bindingsDaniel P. Berrange2013-12-042-60/+6
| | | | | | | | | | | | | | | | | | | If an app used the virDomainEventRegister binding instead of the virDomainEventRegisterAny binding, it would never have its callback invoked. This is because the code for dispatching from the C libvirt_virConnectDomainEventCallback method was totally fubar. If DEBUG macro was set in the python build the error would become visible "libvirt_virConnectDomainEventCallback dom_class is not a class!" The code in libvirt_virConnectDomainEventCallback was inexplicably complex and has apparently never worked. The fix is to write it the same way as the other callback handlers. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* setup: Use user requested python binaryDoug Goldstein2013-12-031-4/+4
| | | | | | | When setup.py is kicked off with a python interpreter other than the system 'python', (e.g. python2.7 setup.py build) the build process would switch to 'python' and not use python2.7 as requested by the user. We should always respect the user requested python interpreter and use it.
* Improve quality of sanitytest checkv1.2.0Daniel P. Berrange2013-11-282-50/+293
| | | | | | | Validate that every public API method is mapped into the python and that every python method has a sane C API. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>