Skip to content

Conversation

@deeplow
Copy link
Contributor

@deeplow deeplow commented Nov 24, 2025

Fixes #1494. Updates code to use be compatible with both PyQt5 and 6.

This is necessary for #1373 if we don't want to add pyqt6 as a dom0 dependency.

Test plan

  • lint test passes (it'll only check for pyqt6 syntax — do we want to create another poetry group that excludes PyQt6 in order to test PyQt5?)
  • Building with FEDORA_VERSION=37 (Qubes 4.2) and running rpm -qR path/to/rpm shows PyQt5 as depdency
  • Building with FEDORA_VERSION=41 (Qubes 4.3) and running rpm -qR path/to/rpm shows PyQt6 as depdency
  • test launcher application

Checklist

This change accounts for:

  • any necessary RPM packaging updates (e.g., added/removed files, see MANIFEST.in and rpm-build/SPECS/securedrop-workstation-dom0-config.spec)
  • any required documentation

Qt5 is not installed by default in dom0 under Qubes 4.3 (fedora 41),
whereas PyQt6 is.
Use Qt6 to regenerate the compiled UI. This should NOT break
compatibility with PyQt5. To achieve this I installed pyqt6-dev-tools
and ran it with:

    pyuic6 sdw_updater.ui > UpdaterAppUiQt6.py

NOTES:
  - version mismatch between version used for compilation (6.4.2) and
    the one available in dom0 (6.8.1) should not make a difference since
    syntax changes should be constant in the same Qt/PyQt version
  - Ruff lint was applied on top of the result.
Fixes #1494. Other than changing the imports to support both versions,
this commit updates the code that was not forward-compatible, namely:

  - replace "exec_()"  with exec() (Qt5 targetted also python2, which
    meant that it had "exec" reserved. This is no longer the case, so we
    can use the more aptly named "exec()"

   - Expand enums like QMessageBox.Ok to have its full name
     (QMessageBox.StandardButtons.Ok)

None of these changes should break compatibility with PyQt5.

A consolidated overview of the upgrade notes can be found at
https://www.pythonguis.com/faq/pyqt5-vs-pyqt6/
In oreder to support both PyQt5 and 6 we need an try...except logic.
Mypy doesn't seem to like this and complains about a re-definition:

    [...] already defined (by an import) [no-redef]
Instructions no longer made sense since the project moved from
virtualenv to poetry. It made specific references to PyQt versions that
are current set explicitly in pyproject.toml (which poetry uses).
@deeplow deeplow requested a review from a team as a code owner November 24, 2025 14:40
@deeplow deeplow moved this to Ready For Review in SecureDrop Nov 24, 2025
Launcher tests were failing on 'poetry install' due to:

    The currently activated Python version 3.11.6 is not supported
    by the project (>=3.13).

    Trying to find and use a compatible version.

    Poetry was unable to find a compatible version. If you have one,
    you can explicitly use it via the "env use" command.

(test on: openqa)
@deeplow deeplow moved this from Ready For Review to In Progress in SecureDrop Nov 24, 2025
The test system package requirements were being explcitly stated in the
Makefile. This would require creating a conditional for installing Qt5
in Qubes 4.2 and Qt6 in 4.3. Rather than adding it, this PR istead
searches for the system python packages required by the SPEC file and
installs those. The important bit is that they bring along other system
dependencies (e.g. Qt6) that would otherwise need to be explicitly
installed.

In case tests use poetry instead, it should also work, given that
poetry's packages should override system ones. But critically, the
non-python system packages that they would depend on, are now
automatically managed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Support PyQt6 (default in Qubes 4.3)

2 participants