1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2024-10-26 07:55:06 +03:00
Commit Graph

1246 Commits

Author SHA1 Message Date
Daniel P. Berrangé
c647a8ba2a gitlab: stop using a venv when creating source/binary dist
The change to use 'python -m build' in

  commit 333c8bef2b
  Author: Erik Skultety <eskultet@redhat.com>
  Date:   Tue Jun 20 12:19:40 2023 +0200

    ci: Drop direct 'setup.py' usage

resulted in the CI jobs all downloading latest setuptools and
deps from pypi and running builds with them in a venv. IOW we
ceased testing against the setuptools/wheel packages provided
by the distro, which is the whole point of the CI.

Passing the '-n -x' flags to 'python -m build' tells it to stop
using a venv and not to check dependancies, thus letting it
use what we pre-installed in the container.

This doesn't work on CentOS Stream 8, however, so we revert to
using the old setup.py approach. This is a short term issue,
since Stream 8 is EOL at the end of May, so we'll be deleting
all the Stream 8 jobs across libvirt CI very soon.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2024-04-30 10:23:31 +01:00
Daniel P. Berrangé
e2a8524bc8 ci: refresh with lcitool manifest
This pulls in the new wheel packages.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2024-04-25 10:22:46 +01:00
Daniel P. Berrangé
379ecce9f5 ci: add 'python3-wheel' as a dep
The 'python -m build' command creates a source dist and a binary
wheel. To be able run this command without creating a new venv
and downloading from pypi, we need to pre-install the 'wheel'
package.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2024-04-25 10:21:27 +01:00
Daniel P. Berrangé
5b4e4f9a90 ci: refresh with latest lcitool manifest
Fixes logic that caused some jobs to mistakenly not be run
when expected.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2024-04-25 09:53:22 +01:00
Jiri Denemark
bfc985a89e Post-release version bump to 10.3.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2024-04-02 13:44:28 +02:00
Jiri Denemark
d95eb54bc3 Post-release version bump to 10.2.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2024-03-01 12:23:02 +01:00
Michal Privoznik
acd4f6701d ci: Switch native_git_build_job to c9s and resume api_coverage_job
Currently, there's just one native_git_build_job -
x86_64-centos-stream-8-git and this is a problem because that's
the job that api_coverage_job then uses. But CentOS Stream 8 has
too old lxml which then makes tests/test_api_coverage.py skip its
run. By switching to CentOS Stream 9 the test can run happily
again.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2024-02-27 16:11:10 +01:00
Michal Privoznik
426a7689a7 test_api_coverage: Reflect different naming in python for virDomainFDAssociate() and virDomainRestoreParams()
While virDomainRestoreParams() has 'virDomain' prefix (and thus
is put into Domain class), it is really in the same family as
virDomainRestore() or virDomainRestoreFlags() -> it acts upon
virConnect object and thus belongs into Connect class.

Then, virDomainFDAssociate is exposed as Domain.FDAssociate() but
because of the way we would generate the method's name
(fDAssociate) the test thinks it's not implemented.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2024-02-27 15:08:17 +01:00
Vincent Vanlaer
56179c6a50 Fix memory leak in virStreamRecvFlags
virStreamRecvFlags allocates a temporary buffer to store the received
stream data in. This buffer was not freed on returns other than the
normal return with data.

Signed-off-by: Vincent Vanlaer <libvirt-e6954efa@volkihar.be>
2024-02-20 13:53:29 +01:00
Daniel P. Berrangé
7fb6a2182c ci: refresh with latest 'lcitool manifest'
This refresh gets rid of the split jobs for prebuilt and local
container environments.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2024-01-19 12:56:32 +00:00
Jiri Denemark
a6ad2d92ff Post-release version bump to 10.1.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2024-01-15 11:02:23 +01:00
Peter Krempa
11da469020 ci: Install built module for testing insde an venv
Distros recently started to object to using 'pip' to install system-wide
packages to prevent breakage. We were hacking-around that by using
'pip install --break-system-packages', but it's straightforward to
simply create a venv with '--system-site-packages' and install it there.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2024-01-08 11:56:20 +01:00
Peter Krempa
17d63413de ci: Update Fedora and Debian versions and regenerate
Update:
 Debian-10 -> Debian-12
 Fedora-37 -> Fedora-38
 Fedora-38 -> Fedora-39

Also the artifacts from the Fedora 39 job are needed for the integration
test suite in the main libvirt project.

For Debian 12 we need to start using
'pip install --break-system-packages' as a hack to work around
installation of the built package for testing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2024-01-08 11:21:12 +01:00
Jiri Denemark
d04e765440 Post-release version bump to 10.0.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2023-12-01 16:24:59 +01:00
Jiri Denemark
aa6b4902c3 Post-release version bump to 9.10.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2023-11-01 10:43:20 +01:00
Jiri Denemark
172a39551f Post-release version bump to 9.9.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2023-10-02 09:34:05 +02:00
Daniel P. Berrangé
1d0166204c Request the Python stable API when building
We have Python 3.6 as a minimum version. If we set Py_LIMITED_API
to 0x03060000, we'll get the stable python API associated with
versions >= 3.6. This lets users compile once and have the libvirt
binary module be loadable by any Python version >= 3.6, as described
in:

  https://docs.python.org/3/c-api/stable.html

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2023-09-25 11:17:31 +00:00
Daniel P. Berrangé
f76708b8fa Use PySequence_GetItem preferentially
Although marginally faster, PySequence_ITEM is not part
of the stable API and also omits some safety checks. It
is better for us to be using PySequence_GetItem instead.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2023-09-25 11:17:31 +00:00
Daniel P. Berrangé
85e58cb2ee add missing includes for C library functions
We use various C library functions like printf, strcmp, free
but don't have the corresponding #includes, getting them
indirectly via Python.h. This is a bad idea as Python.h is
not guaranteed to provided these, and indeed will omit them
when Py_LIMITED_API is greater then 0x030a0000.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2023-09-25 11:17:31 +00:00
Pino Toscano
c4ede87284 setup: simplify authors list generation
Use a set to collect the authors from the git output with no duplicates,
then sort the resulting set, and apply the wanted indentation.

This method is more Pythonic, using a set to avoid duplicates; applying
the indentation after the sorting makes the sorting slightly faster.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2023-09-25 10:42:29 +00:00
Pino Toscano
41363417b7 setup: switch away fron subprocess.Popen()
Adopt subprocess.check_output() as more modern and higher-level way to
invoke processes, checking that they succeed, and getting their output.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2023-09-25 10:42:29 +00:00
Pino Toscano
bf83c2b236 setup: remove unnecessary f-string
The whole content of this f-string is a variable, so use that variable
directly.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2023-09-25 10:42:29 +00:00
Pino Toscano
2c8339b44c setup: invoke git commands properly
Storing the git commands as single string, to split it by space later
on, works only in case there are no spaces in the arguments, which is
exactly what is in those commands.

Instead, specify them directly as lists, with the options & arguments
split in the right way. This fixes the generation of the AUTHORS and
ChangeLog files.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2023-09-25 10:42:29 +00:00
Daniel P. Berrangé
697b7727d0 gitlab: unset CFLAGS for rpm build
Setting CFLAGS before invoking rpm-build causes replacement of the
CFLAGS that RPM wants to set for python. This causes the loss of
certain flags needed to turn on debug output and optimization.
Previously this wasn't a problem as something in setuptools appears
to have been adding -g anyway, but with the update to python 3.12
this now fully breaks. We should never have been setting CFLAGS
during the RPM build so we drop it unconditionally for all distros.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2023-09-21 16:48:42 +01:00
Daniel P. Berrangé
dc9ca83ab9 Add binding for network metadata events
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2023-09-21 11:58:47 +01:00
Jiri Denemark
f02cf5d18c Post-release version bump to 9.8.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2023-09-01 13:04:56 +02:00
Erik Skultety
716a2f546d ci: lcitool: Maintain project package deps lists here
Each respective project that lcitool knows about and currently
maintains its list of package dependencies knows best what packages
they actually depend on. If a new dependency is currently needed,
first a change in lcitool is necessary before GitLab jobs and
containers can be updated. Provided a mapping already exists in
lcitool (which can quickly be added as an override via mappings.yml
         temporarily) we speed up the whole CI update process by
one step.

Note that starting this commit lcitool must be invoked as
    '$ lcitool -d/--data-dir ci/lcitool ...'
to pick up the project dependency list correctly.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-08-21 11:54:09 +02:00
Jiri Denemark
84009289c0 Post-release version bump to 9.7.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2023-08-01 11:50:19 +02:00
Jiri Denemark
f47efd8bf8 Post-release version bump to 9.6.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2023-07-03 12:17:38 +02:00
Erik Skultety
b957ee3daf README: Drop direct 'setup.py' usage
With all the bits in place we can now replace the direct 'setup.py'
invocation examples with alternatives.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-22 10:52:40 +02:00
Erik Skultety
333c8bef2b ci: Drop direct 'setup.py' usage
With all the bits in place we can now drop the 'setup.py' invocations
with preferred alternatives.
This patch does a few things:
- we don't run plain install because that always spins up a new build
  process regardless of whether there are build artifacts literally from
  the previous command, so instead we install the built wheel directly

- when building, we build both the .whl binary and an sdist because
  we'll need the sdist for rpmbuild later in the CI job

- we don't capture the 'build' path as a job artifact anymore, because
  that now only contains egg metadata, all the build artifacts are
  created by Python's build module under 'dist' so we capture that one
  instead

- we always limit pytest to the 'tests' directory which was something
  'setup.py test' used to do as a precaution measure, but setup.py no
  longer has the logic (which is fine)

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-22 10:52:40 +02:00
Erik Skultety
8d89f932e7 spec: Invoke pytest properly
With all the bits in place we can now drop the 'setup.py' invocations
with preferred alternatives. The way to do this in a SPEC file is to
use either of the following macros: %tox or %pytest - both of which
automatically set paths for the test suite correctly which is
something we used to do ourselves in our implementation of the
setup.py's test command originally.
That is wrong and with the migration to PEP-517 compliant builds it
also won't work anymore properly, because there'd be no libs to import
by mangling PYTHONPATH, we'd only get an sdist or a wheel, or in case
of rpmbuild a preset buildroot environment.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-22 10:52:40 +02:00
Erik Skultety
1baa0870ea setup: Drop the my_test command
Direct setup.py invocations are being discouraged in favour of
using Python's 'build' module. Therefore, we can't really make use of this command
anymore since only wheels and tarballs are built with the 'build' module
compared to the previous state of the art of dumping the freshly built
modules and libraries directly inside the build directory.

We'll have to encourage usage of tox which will install the package
inside a virtualenvironment for the tests. Future patch will update the
Makefile targets to make this easier for the end users.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-22 10:27:41 +02:00
Erik Skultety
aeb62b087b setup: Drop the clean command
Direct setup.py invocations are discouraged anyway, use git clean
or 'make clean' instead.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-22 10:27:41 +02:00
Erik Skultety
b8656c12b0 Add pyproject.toml
Given the missing setuptools keywords issue and hence having moved all
the declarative stuff to setup.cfg this one is only a very basic one
just to comply PEP-517 and foolproof this project for the future
PyPa/pip changes.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-22 10:27:41 +02:00
Erik Skultety
01ac61c5e7 Makefile: Add a 'test' rule to run the full tox execution
This one should be used for the "full" test experience including any
additional environments, test suites and linters we may introduce
further down the road.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-22 10:27:41 +02:00
Erik Skultety
72ad0434aa Makefile: Update targets according to the new way of building
- drop direct setup.py invocations
- clean the artifacts directly with 'rm'
- use tox instead of invoking pytest otherwise we don't have a
  mechanism to test against the freshly built libvirt modules other
  than unpacking the built wheel and mangling the PYTHONPATH again
- use direct rpmbuild invocation to build RPM (the rpm target in its
  current form didn't really work anyway)

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-22 10:27:41 +02:00
Erik Skultety
390cadccc0 setup: Query library version out of a file
This makes it possible to programatically query the version in any
stage of the build process, including Makefile etc.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-22 10:27:41 +02:00
Erik Skultety
8c3eb73631 Move declarative stuff out of setup.py to setup.cfg
So, why using setup.cfg if pyproject.toml is the new best thing
recommended everywhere? Well, quite a few of the fields we use with
setuptools are setuptools-specific and haven't been introduced as
keywords to pyproject.toml yet. There is a chance that these fields
could be added via a dedicated 'tool.setuptools' TOML section, but none
of it is officially documented and so it would be BETA at best anyway.
Let's not try our luck and use a declarative config file tailored
specifically to setuptools - setup.cfg. It's also unlikely we'd switch
from setuptools to something else in the near future given the nature
of building this project (i.e. building with C modules) and if so, it
would likely not be a PyPa recommended PEP-517 compliant build
system anyway, e.g. meson, so we're totally fine doing this.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-22 10:27:41 +02:00
Erik Skultety
68c9acbd3a README: Move the long_description from setup.py in here
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-22 10:27:41 +02:00
Erik Skultety
e0bf78cf7d MANIFEST.in: Cleanup
When migrated to the PEP-517 compliant builds, some errors occurred due
to missing or non-existent files mentioned in the MANIFEST. Notable
changes:

- README and MANIFEST files are automatically added to sdist per
  MANIFEST documentation
- we want all tests/examples to be included, so use the 'graft' keyword
  instead of enumerating individual files
- we want all *.[ch] files as those are needed for the build, so use
  'include *.[ch]' instead of enumerating individual files
- we want all *.xml files, so use 'include *.xml'
- we want all *.py files - in case this is no longer the case in the
  future, we'll need to tweak that 'include'
- we don't want any __pycache__ nor *.pyc build artifacts, so exclude
  them globally

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-22 10:25:23 +02:00
Erik Skultety
10f0ad6cef ci: Refresh with latest lcitool changes
- bump OpenSUSE Leap 15.4 -> 15.5
- add python3-build dependency (PEP-517)
- add python3-venv dependency (PEP-517)

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-21 18:03:14 +02:00
Erik Skultety
3ffb60b7c8 setup: styling: Fix last occurrence of os.path in favour of pathlib
Commit e749b4cf forgot to update a couple more occurrences.

Fixes: e749b4cf11
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-09 11:12:34 +02:00
Erik Skultety
28d620c36c setup: Drop explicit creation of the build dir in sdist
No need to do that since we'll create it in the top-level code as a
first thing anyway.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-09 11:12:34 +02:00
Erik Skultety
8ba4e9d626 setup: Use a simple helper to generate dist files from .in templates
The code is almost identical in the impacted cases, so factor it out.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-09 11:12:25 +02:00
Erik Skultety
910079e4a7 setup: styling: Use context managers more
Some of the operations, namely file operations and spawning processes
can utilize the power of context managers. Use them more, use them
together.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-09 11:05:35 +02:00
Erik Skultety
d1cf506635 setup: Move over from os.popen to subprocess.Popen
subprocess is the high-level Pythonic interface providing more
flexibility over the low-level os.popen stuff. It is recommended to
always use subprocess over the direct 'os' interface.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-09 11:05:35 +02:00
Erik Skultety
583203c94c setup: styling: More f-string conversions
Fix a few more occurrences.

Fixes: 745e5a8ca4
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-09 11:05:35 +02:00
Erik Skultety
115b1de8f9 MANIFEST.in: Add Makefile
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-08 09:52:50 +02:00
Erik Skultety
724a305167 tox.ini: Drop sanitytest execution
Commit 60044515 renamed sanitytest to test_coverage_api but forgot to
update the tox.ini file.

Fixes: 60044515a2
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-08 09:52:50 +02:00