Skip to content
Snippets Groups Projects
  1. Nov 24, 2023
  2. Oct 12, 2023
  3. Oct 11, 2023
  4. Sep 20, 2023
  5. Sep 07, 2023
    • Paolo Bonzini's avatar
      Revert "mkvenv: work around broken pip installations on Debian 10" · 0a88ac96
      Paolo Bonzini authored
      
      Debian 10 has Python 3.7, so it is not possible to use it anymore
      now that Python 3.8 is required.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      0a88ac96
    • Paolo Bonzini's avatar
      mkvenv: assume presence of importlib.metadata · 3e4b6b0a
      Paolo Bonzini authored
      
      importlib.metadata is included in Python 3.8, so there is no
      need to fallback to either importlib-metadata or pkgresources
      when generating console script shims.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      3e4b6b0a
    • Paolo Bonzini's avatar
      Python: Drop support for Python 3.7 · ca056f44
      Paolo Bonzini authored
      
      Debian 10 is not anymore a supported distro, since Debian 12 was
      released on June 10, 2023.  Our supported build platforms as of today
      all support at least 3.8 (and all of them except for Ubuntu 20.04
      support 3.9):
      
      openSUSE Leap 15.5: 3.6.15 (3.11.2)
      CentOS Stream 8:    3.6.8  (3.8.13, 3.9.16, 3.11.4)
      CentOS Stream 9:    3.9.17 (3.11.4)
      Fedora 37:          3.11.4
      Fedora 38:          3.11.4
      Debian 11:          3.9.2
      Debian 12:          3.11.2
      Alpine 3.14, 3.15:  3.9.16
      Alpine 3.16, 3.17:  3.10.10
      Ubuntu 20.04 LTS:   3.8.10
      Ubuntu 22.04 LTS:   3.10.12
      NetBSD 9.3:         3.9.13*
      FreeBSD 12.4:       3.9.16
      FreeBSD 13.1:       3.9.18
      OpenBSD 7.2:        3.9.17
      
      Note: NetBSD does not appear to have a default meta-package, but offers
      several options, the lowest of which is 3.7.15. However, "python39"
      appears to be a pre-requisite to one of the other packages we request
      in tests/vm/netbsd.
      
      Since it is safe under our supported platform policy, bump our
      minimum supported version of Python to 3.8.  The two most interesting
      features to have by default include:
      
      - the importlib.metadata module, whose lack is responsible for over 100
        lines of code in mkvenv.py
      
      - improvements to asyncio, for example asyncio.CancelledError
        inherits from BaseException rather than Exception
      
      In addition, code can now use the assignment operator ':='
      
      Because mypy now learns about importlib.metadata, a small change to
      mkvenv.py is needed to pass type checking.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      ca056f44
  6. Aug 28, 2023
    • Paolo Bonzini's avatar
      Revert "tests: Use separate virtual environment for avocado" · c03f57fd
      Paolo Bonzini authored
      This reverts commit e8e4298f.
      
      ensuregroup allows to specify both the acceptable versions of avocado,
      and a locked version to be used when avocado is not installed as a system
      pacakge.  This lets us install avocado in pyvenv/ using "mkvenv.py" and
      reuse the distro package on Fedora and CentOS Stream (the only distros
      where it's available).
      
      ensuregroup's usage of "(>=..., <=...)" constraints when evaluating
      the distro package, and "==" constraints when installing it from PyPI,
      makes it possible to avoid conflicts between the known-good version and
      a package plugins included in the distro.
      
      This is because package plugins have "==" constraints on the version
      that is included in the distro, and, using "pip install avocado==88.1"
      on a venv that includes system packages will result in an error:
      
         avocado-framework-plugin-varianter-yaml-to-mux 98.0 requires avocado-framework==98.0, but you have avocado-framework 88.1 which is incompatible.
         avocado-framework-plugin-result-html 98.0 requires avocado-framework==98.0, but you have avocado-framework 88.1 which is incompatible.
      
      But at the same time, if the venv does not include a system distribution
      of avocado then we can install a known-good version and stick to LTS
      releases.
      
      Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1663
      
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      c03f57fd
    • Paolo Bonzini's avatar
      python: use vendored tomli · edc21078
      Paolo Bonzini authored
      
      Debian only introduced tomli in the bookworm release.  Use a
      vendored wheel to avoid requiring a package that is only in
      bullseye-backports and is also absent in Ubuntu 20.04.
      
      While at it, fix an issue in the vendor.py scripts which does
      not add a newline after each package and hash.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      edc21078
    • Paolo Bonzini's avatar
      python: mkvenv: add ensuregroup command · 71ed611c
      Paolo Bonzini authored
      
      Introduce a new subcommand that retrieves the packages to be installed
      from a TOML file. This allows being more flexible in using the system
      version of a package, while at the same time using a known-good version
      when installing the package.  This is important for packages that
      sometimes have backwards-incompatible changes or that depend on
      specific versions of their dependencies.
      
      Compared to JSON, TOML is more human readable and easier to edit.  A
      parser is available in 3.11 but also available as a small (12k) package
      for older versions, tomli.  While tomli is bundled with pip, this is only
      true of recent versions of pip.  Of all the supported OSes pretty much
      only FreeBSD has a recent enough version of pip while staying on Python
      <3.11.  So we cannot use the same trick that is in place for distlib.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      71ed611c
    • Paolo Bonzini's avatar
      python: mkvenv: introduce TOML-like representation of dependencies · 0f1ec070
      Paolo Bonzini authored
      
      We would like to place all Python dependencies in the same file, so that
      we can add more information without having long and complex command lines.
      The plan is to have a TOML file with one entry per package, for example
      
        [avocado]
        avocado-framework = {
          accepted = "(>=88.1, <93.0)",
          installed = "88.1",
          canary = "avocado"
        }
      
      Each TOML section will thus be a dictionary of dictionaries.  Modify
      mkvenv.py's workhorse function, _do_ensure, to already operate on such
      a data structure.  The "ensure" subcommand is modified to separate the
      depspec into a name and a version part, and use the result (plus the
      --diagnose argument) to build a dictionary for each command line argument.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      0f1ec070
    • Paolo Bonzini's avatar
      python: mkvenv: tweak the matching of --diagnose to depspecs · 67b9a83d
      Paolo Bonzini authored
      
      Move the matching between the "absent" array and dep_specs[0] inside
      the loop, preparing for the possibility of having multiple canaries
      among the installed packages.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      67b9a83d
  7. Jul 07, 2023
    • Paolo Bonzini's avatar
      python: bump minimum requirements so they are compatible with 3.12 · 3d7b8974
      Paolo Bonzini authored
      
      There are many Python 3.12 issues right now, but a particularly
      problematic one when debugging them is that one cannot even use
      minreqs.txt in a Python 3.12 virtual environment to test with
      locked package versions.
      
      Bump the mypy and wrapt versions to fix this, while remaining
      within the realm of versions compatible with Python 3.7.
      
      This requires a workaround for a mypy false positive
      
          qemu/qmp/qmp_tui.py:350: error: Non-overlapping equality check (left operand type: "Literal[Runstate.DISCONNECTING]", right operand type: "Literal[Runstate.IDLE]")  [comparison-overlap]
      
      where mypy does not realize that self.disconnect() could change
      the value of self.runstate.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      3d7b8974
  8. Jun 06, 2023
  9. May 31, 2023
  10. May 22, 2023
  11. May 19, 2023
    • Paolo Bonzini's avatar
      mkvenv: pass first missing package to diagnose() · d37c21b5
      Paolo Bonzini authored
      
      If sphinx is present but the theme is not, mkvenv will print an
      inaccurate diagnostic:
      
      ERROR: Could not find a version that satisfies the requirement sphinx-rtd-theme>=0.5.0 (from versions: none)
      ERROR: No matching distribution found for sphinx-rtd-theme>=0.5.0
      
      'sphinx>=1.6.0' not found:
       • Python package 'sphinx' version '5.3.0' was found, but isn't suitable.
       • mkvenv was configured to operate offline and did not check PyPI.
      
      Instead, ignore the packages that were found to be present, and report
      an error based on the first absent package.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      d37c21b5
    • Paolo Bonzini's avatar
      mkvenv: replace distlib.database with importlib.metadata/pkg_resources · c673f3d0
      Paolo Bonzini authored
      
      importlib.metadata is just as good as distlib.database and a bit more
      battle-proven for "egg" based distributions, and in fact that is exactly
      why mkvenv.py is not using distlib.database to find entry points: it
      simply does not work for eggs.
      
      The only disadvantage of importlib.metadata is that it is not available
      by default before Python 3.8, so we need a fallback to pkg_resources
      (again, just like for the case of finding entry points).  Do so to
      fix issues where incorrect egg metadata results in a JSONDecodeError.
      
      While at it, reuse the new _get_version function to diagnose an incorrect
      version of the package even if importlib.metadata is not available.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      c673f3d0
  12. May 18, 2023
    • Paolo Bonzini's avatar
      meson: require 0.63.0 · 3b087f79
      Paolo Bonzini authored
      
      This version allows cleanups in modinfo collection, but they only
      work with Ninja 1.9.x and 1.8.x is still supported.  It also supports the
      equivalent of QEMU's --static option to configure.
      
      The wheel file is bumped to 0.63.3, the last release in the 0.63 branch.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      3b087f79
    • Paolo Bonzini's avatar
      python: bump some of the dependencies · 7b4b98c4
      Paolo Bonzini authored
      
      The version of pyflakes that is listed in python/tests/minreqs.txt
      breaks on Python 3.8 with the following message:
      
        AttributeError: 'FlakesChecker' object has no attribute 'CONSTANT'
      
      Now that we do not support EOL'd Python versions anymore, we can
      update to newer, fixed versions.  It is a good time to do so, before
      Python packages start dropping support for Python 3.7 as well!
      
      The new mypy is also a bit smarter about which packages are actually
      being used, so remove the now-unnecessary sections from setup.cfg.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Message-Id: <20230511035435.734312-27-jsnow@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      7b4b98c4
    • Paolo Bonzini's avatar
      mkvenv: mark command as required · 02312f1a
      Paolo Bonzini authored
      
      This is only available in Python 3.7+.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Message-Id: <20230511035435.734312-26-jsnow@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      02312f1a
    • Paolo Bonzini's avatar
      Python: Drop support for Python 3.6 · 5591b745
      Paolo Bonzini authored
      
      Python 3.6 was EOL 2021-12-31. Newer versions of upstream libraries have
      begun dropping support for this version and it is becoming more
      cumbersome to support. Avocado-framework and qemu.qmp each have their
      own reasons for wanting to drop Python 3.6, but won't until QEMU does.
      
      Versions of Python available in our supported build platforms as of today,
      with optional versions available in parentheses:
      
      openSUSE Leap 15.4: 3.6.15 (3.9.10, 3.10.2)
      CentOS Stream 8:    3.6.8  (3.8.13, 3.9.16)
      CentOS Stream 9:    3.9.13
      Fedora 36:          3.10
      Fedora 37:          3.11
      Debian 11:          3.9.2
      Alpine 3.14, 3.15:  3.9.16
      Alpine 3.16, 3.17:  3.10.10
      Ubuntu 20.04 LTS:   3.8.10
      Ubuntu 22.04 LTS:   3.10.4
      NetBSD 9.3:         3.9.13*
      FreeBSD 12.4:       3.9.16
      FreeBSD 13.1:       3.9.16
      OpenBSD 7.2:        3.9.16
      
      Note: Our VM tests install 3.9 explicitly for FreeBSD and 3.10 for
      NetBSD; the default for "python" or "python3" in FreeBSD is
      3.9.16. NetBSD does not appear to have a default meta-package, but
      offers several options, the lowest of which is 3.7.15. "python39"
      appears to be a pre-requisite to one of the other packages we request in
      tests/vm/netbsd. pip, ensurepip and other Python essentials are
      currently only available for Python 3.10 for NetBSD.
      
      CentOS and OpenSUSE support parallel installation of multiple Python
      interpreters, and binaries in /usr/bin will always use Python 3.6.  However,
      the newly introduced support for virtual environments ensures that all build
      steps that execute QEMU Python code use a single interpreter.
      
      Since it is safe to under our supported platform policy, bump our
      minimum supported version of Python to 3.7.
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <20230511035435.734312-24-jsnow@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      5591b745
    • John Snow's avatar
      python/wheels: add vendored meson package · e80bdbf2
      John Snow authored
      
      In preference to vendoring meson source, vendor a built distributable
      ("bdist" in python parlance). This has some benefits:
      
      (1) We can get rid of a git submodule,
      (2) Installing built meson into a venv doesn't require any extra
          dependencies (the python "wheel" package, chiefly.)
      (3) We don't treat meson any differently than we would any other python
          package (we install it, end of story, done.)
      (4) All future tarball *and* developer checkouts will function offline;
          No git or PyPI connection needed to fetch meson.
      
      Note that because mkvenv prefers vendored packages to PyPI, as mkvenv is
      currently written we will never consult PyPI for meson. (Do keep in mind
      that your distribution's meson will be preferred above the vendored
      version, though.)
      
      ```
      jsnow@scv ~/s/q/python (python-configure-venv)> python3 scripts/vendor.py
      pip download --dest /home/jsnow/src/qemu/python/wheels --require-hashes -r /tmp/tmpvo5qav7i
      Collecting meson==0.61.5
        Using cached meson-0.61.5-py3-none-any.whl (862 kB)
      Saved ./wheels/meson-0.61.5-py3-none-any.whl
      Successfully downloaded meson
      ```
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Message-Id: <20230511035435.734312-17-jsnow@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      e80bdbf2
    • John Snow's avatar
      python: add vendor.py utility · 2274817f
      John Snow authored
      
      This is a teeny-tiny script that just downloads any packages we want to
      vendor from PyPI and stores them in qemu.git/python/wheels/. If I'm hit
      by a meteor, it'll be easy to replicate what I have done in order to
      udpate the vendored source.
      
      We don't really care which python runs it; it exists as a meta-utility
      with no external dependencies and we won't package or install it. It
      will be monitored by the linters/type checkers, though; so it's
      guaranteed safe on python 3.6+.
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Message-Id: <20230511035435.734312-15-jsnow@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      2274817f
    • John Snow's avatar
      mkvenv: work around broken pip installations on Debian 10 · c8049626
      John Snow authored
      
      This is a workaround intended for Debian 10, where the debian-patched
      pip does not function correctly if accessed from within a virtual
      environment.
      
      We don't support Debian 10 as a build platform any longer, though we do
      still utilize it for our build-tricore-softmmu CI test. It's also
      possible that this bug might appear on other derivative platforms and
      this workaround may prove useful.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Message-Id: <20230511035435.734312-11-jsnow@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      c8049626
Loading