File qutebrowser.spec of Package qutebrowser

#
# spec file for package qutebrowser
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


# Version found in:
#   <git source>/qutebrowser/__init__.py

%define pyqt_version 6

Name:           qutebrowser
Version:        3.5.1+git20250605.96e535c7ed
Release:        0
Summary:        Keyboard-driven vim-like browser based on Qt%{pyqt_version}
License:        GPL-3.0-or-later
Group:          Productivity/Networking/Web/Browsers
URL:            https://qutebrowser.org/
#Source:         https://github.com/The-Compiler/%%{name}/releases/download/v%%{version}/%%{name}-%%{version}.tar.gz
Source:         %{name}-%{version}.tar.gz
#Source1:        https://github.com/The-Compiler/%%{name}/releases/download/v%%{version}/%%{name}-%%{version}.tar.gz.asc
### https://the-compiler.org/pubkey.asc (currently expired as of 2022-03-12, smb 20220401)
#Source2:        %%{name}.keyring
BuildRequires:  Mesa-dri
BuildRequires:  asciidoc
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  python-rpm-macros
BuildRequires:  python3-Flask
BuildRequires:  python3-Jinja2
#BuildRequires:  python3-MarkupSafe
BuildRequires:  python3-PyYAML
BuildRequires:  python3-Pygments
BuildRequires:  python3-beautifulsoup4
BuildRequires:  python3-cheroot
BuildRequires:  python3-devel >= 3.6
BuildRequires:  python3-hypothesis
BuildRequires:  python3-importlib-resources
#BuildRequires:  python3-opengl
BuildRequires:  python3-pytest
BuildRequires:  python3-pytest-bdd
BuildRequires:  python3-pytest-benchmark
BuildRequires:  python3-pytest-instafail
BuildRequires:  python3-pytest-mock
BuildRequires:  python3-pytest-qt
BuildRequires:  python3-pytest-rerunfailures
BuildRequires:  python3-pytest-xvfb
### Qt5 --> Qt6
#BuildRequires:  python3-qt5 > 5.12
BuildRequires:  python3-PyQt%{pyqt_version}
###
BuildRequires:  python3-setuptools
BuildRequires:  python3-tk
BuildRequires:  python3-tldextract
BuildRequires:  python(abi) >= 3.6.1
### Qt5 --> Qt6
#Requires:       libqt5-sql-sqlite
Requires:       qt6-sql-sqlite
###
Requires:       python3-Jinja2
Requires:       python3-PyYAML
Recommends:     python3-MarkupSafe
Recommends:     python3-opengl
### Qt5 --> Qt6
#Recommends:     python3-qt5 > 5.12
#Recommends:     python3-qtwebengine-qt5
Recommends:     python3-PyQt%{pyqt_version}
Recommends:     python3-PyQt%{pyqt_version}-WebEngine
###
Recommends:     python3-Pygments
Recommends:     python3-adblock
BuildArch:      noarch
%if 0%{?suse_version} >= 1550
### Qt5 --> Qt6
#BuildRequires:  python3-qt5-sip
BuildRequires:  python3-PyQt%{pyqt_version}-sip
###
%else
BuildRequires:  python3-sip
%endif
%if %{python3_version_nodots} <= 38
Requires:       python3-importlib-resources
%endif
%if %{python3_version_nodots} == 36
Requires:       python3-dataclasses
%endif

%description
qutebrowser is a keyboard-focused browser with a minimal GUI.
It's based on PyQt%{pyqt_version} and can use either QtWebEngine or QtWebKit.

%prep
%setup -q
sed -i '1d' %{name}/__main__.py
sed -i 's,^#!%{_bindir}/env ,#!%{_bindir}/,' \
  misc/userscripts/* \
  scripts/*.py
sed -i 's,^#!%{_bindir}/bash,#!/bin/bash,' \
  misc/userscripts/*
mv misc/Makefile .
# missing files in release tarball
rm tests/unit/scripts/test_problemmatchers.py

%build

%install
%make_install PREFIX=%{_prefix}

chmod -x %{buildroot}%{_datadir}/%{name}/scripts/cycle-inputs.js \
  %{buildroot}%{_datadir}/%{name}/scripts/utils.py \
  %{buildroot}%{_datadir}/%{name}/userscripts/README.md
rm %{buildroot}%{python3_sitelib}/%{name}/git-commit-id

### Generate documentation
python3 scripts/asciidoc2html.py

### START: debug info
#echo -e "BUILDROOT:\t'%%{buildroot}'."
#echo -e "_BUILDDIR:\t'%%{_builddir}'."
#echo -e "buildsubdir:\t'%%{buildsubdir}'."
#pwd
#find . -iname index.html
#ls -l %%{_builddir}/%%{buildsubdir}/%%{name}/html/doc
### END: debug info

### Copy generated documentation to new home
cp -rv %{_builddir}/%{buildsubdir}/%{name}/html/doc %{buildroot}%{python3_sitelib}/%{name}/html

%fdupes %{buildroot}%{python3_sitelib}/

# NOTE: test suite disabled because the BDD tests are too unreliable
# %%check
# NOTE: test suite is slow but doesn’t run reliably with xdist
# PYTHONPATH=. QUTE_BDD_WEBENGINE=true pytest -v \
#    -k 'not importlib'

%files
%license LICENSE
%doc doc/changelog.asciidoc README.asciidoc
%{_bindir}/%{name}
%{python3_sitelib}/%{name}/
%{python3_sitelib}/%{name}-*
%{_datadir}/applications/org.qutebrowser.qutebrowser.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.*
%{_datadir}/metainfo/org.qutebrowser.qutebrowser.appdata.xml
%{_datadir}/%{name}
%{_mandir}/man1/%{name}.1%{?ext_man}

%changelog
openSUSE Build Service is sponsored by