1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-12-06 00:23:47 +03:00
Commit Graph

1034 Commits

Author SHA1 Message Date
Daniel P. Berrangé
b37f39e4f7 gitlab: re-generate container images from lcitool
This introduces Fedora 33 and removes some redundant packages.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-12-01 16:52:31 +00:00
Daniel P. Berrangé
2110591acf gitlab: move dockerfiles into ci/containers sub-directory
This brings the repo into alignment with the main libvirt.git practice.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-12-01 16:17:35 +00:00
Jiri Denemark
f49e204c28 Post-release version bump to 7.0.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2020-12-01 09:55:41 +01:00
Erik Skultety
167276ae0e MANIFEST.in: Distribute MANIFEST.in in the source tarball
Follow the same procedure as we do with specfiles in the main library
where we distribute libvirt.spec.in along with the generated
libvirt.spec inside the tarball.

Fixes: https://gitlab.com/libvirt/libvirt-python/-/issues/5

Signed-off-by: Erik Skultety <eskultet@redhat.com>
v6.10.0
2020-11-27 19:09:15 +01:00
Michal Privoznik
767bf23ba6 Implement virDomainAuthorizedSSHKeys{Get,Set}
Both APIs work with string lists (the getter returns it, the
setter gets keys to set from it) -> represent that as a python
list. The rest is kept as is in C.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-19 18:12:33 +01:00
Daniel P. Berrangé
417b39049e Add support for memory failure event callbacks
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-12 14:51:56 +00:00
Daniel P. Berrangé
ae219e3480 Replace deprecated PyEval_CallObject with PyObject_Call
The former is deprecated since Python 3.9, and the latter has existed
for all 3.x and probably before.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-12 14:31:54 +00:00
Daniel P. Berrangé
fb2123c28b Pass -Werror when building extension
This ensures we pick up warnings from new python headers or other
problems.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-12 13:36:46 +00:00
Daniel P. Berrangé
991ecb5de8 Avoid truncating python version number when running sanity test
The current code assumes the version number string will be only three
characters long, which fails with "3.10".

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-12 13:34:14 +00:00
Daniel P. Berrangé
2035a5e2f1 Avoid use of thread function deprecated in 3.9
PyEval_ThreadsInitialized was deprecated in 3.9, with deletion targetted
for 3.11. Furthermore since 3.7 it is guaranteed that threads are always
initialized by Py_Initialize(), so checking it is redundant.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-12 13:30:23 +00:00
Daniel P. Berrangé
4a6f381bd9 Add unit tests for openAuth method
Validate that the type hinting is working as expected

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-06 10:35:05 +00:00
Jiri Denemark
2822e23156 Post-release version bump to 6.10.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2020-11-02 11:19:00 +01:00
Daniel P. Berrangé
3a4d51e266 gitlab: optimize CI job dependencies
Allow more parallelization by giving explicit dependencies between jobs.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
v6.9.0
2020-10-06 12:34:38 +00:00
Daniel P. Berrangé
1f44167510 tests: start basic unit tests for more APIs
To prevent regressions, especially with generated code, we need to have
test coverage of more APIs. This starts off with coverage for object
creation for all object types supported by the test driver
currently. This exercises constructors which have been broken several
times in the past.

Related https://gitlab.com/libvirt/libvirt-python/-/issues/4
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-10-06 12:25:14 +01:00
Daniel P. Berrangé
613411502d fix constructor param name for virDomainSnapshot / virDomainCheckpoint
Fixes 7f021c21d6
Resolves https://gitlab.com/libvirt/libvirt-python/-/issues/4

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-10-06 11:15:48 +01:00
Jiri Denemark
379a65bd68 Post-release version bump to 6.9.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2020-10-01 09:54:11 +02:00
Philipp Hahn
22bfd4bcab generator: Work around type change
a variable should not change its type.

Signed-off-by: Philipp Hahn <hahn@univention.de>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
v6.8.0
2020-09-01 13:26:01 +00:00
Philipp Hahn
d30d872251 generator: Add PEP 484 type annotations
Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
62d99b6dad generator: Merge common code of print_function_wrapper
Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
7f021c21d6 generator: Merge code for __init__ genration
Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
5a2c12278a generator: Expand tuple to names in for loop
Assign tuple to multiple loop variables for better readability

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
f87eba2fee generator: break lines in generated code
to be closes to pep8 which makes reading the generated code easier and
reduces the number of issues found by flake8.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
f7bd89c0bd generator: Use empty string instead of None
for better type checking: both are bool()==False, but None is not str.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
4df8e83808 generator: Convert to defaultdict()
for nested dictionaries allows to remove the case distinction for
"first" from "all other" cases.

Signed-off-by: Philipp Hahn <hahn@univention.de>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-09-01 13:26:01 +00:00
Philipp Hahn
87e0ca6390 generator: Move funcs_failed into buildStubs()
The variables are local to that funcion

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
099459096a generator: Convert list() to set()
tuple() and list() are sequences, while dict() and set() are hash-based,
which is more efficient for contains().

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
fe100b90ef generator: Convert dict() to set()
Python has a native type for set()s.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
3bb106d5e5 generator: Simplify boolean condition
no need to compare with None or empty string.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
c95a957084 generator: Simplify loop break
Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
9f6638d3b2 generator: Simplify sorting
Use sorted(..., key=...) instead of using explicit list.sort()

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
3b9ef6ecad generator: Fixed writing cached=None
Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
88e668c64c generator: Store arguments and return as tuple
instead of list.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
3f493a3a6b generator: Expand tuple to names in for loop
Assign tuple to multiple loop variables for better readability

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
fad7bce226 generator: Initialize with empty strings
instead of using None as this has a different type.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
5d12443e50 generator: Simplify XML attribute fetching
Use attr.get(key, default) instead.

Also use the empty sting "" as the default value instead of "None": Both
are "False" when used as a bool()ean, but "None" would require an
explicit check for "not None" in many places as str() and None have
different types.

Signed-off-by: Philipp Hahn <hahn@univention.de>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-09-01 13:26:01 +00:00
Philipp Hahn
425901da21 generator: Convert in_function to bool
Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
d560971513 generator: Use string formatting
instead of sting concatenating.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
9be847c7ce generator: Use SAX method names
directly instead of using legacy method names from xmllib.

Depends: 3740a5e4c7
Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
90e861ab4a generator: Remove unused SAX content handler methods
getmethodname()
close()
cdata()

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
06de635ed2 generator: Refactor parser creation
to use closing context manager.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
4d06f2b2fb generator: Open file with context manager
Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
8f354ae738 generator: Use splitlines()
instead of hand-coded implementation.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
f36643acac generator: Just walk the dict
instead of generating a list first.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
ada1554532 generator: Directly get dict length
instead of generating a list and then counting the elements.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
280b1d6640 generator: Walk only the values
instead of the keys and then doing a lookup.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
89c453db00 generator: Use dict.item() to walk keys and values
which saves a lookup of each key.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
659d0b4dfd generator: Check contained in hash
directly instead of explicitly requesting only the keys as a list and
converting that list to another list.
Checking directly for an element to be contained in a hash is much more
efficient as this is done using hashing O(1) instead of walking the list
in half on average O(n).

Signed-off-by: Philipp Hahn <hahn@univention.de>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-09-01 13:26:01 +00:00
Philipp Hahn
a0798b9bbc generator: Initialize function_classes directly
Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
94b30b7fb7 generator: Remove global declarations
for variables with are not assigned.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00
Philipp Hahn
f4aefad212 generator: Use string concatenation
:%s,\(\w\+\)\s*=\s*\1\s*+,\1 +=,

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-09-01 13:26:01 +00:00