5b4e4f6
%global srcname qutebrowser
5b4e4f6
5b4e4f6
Name:		%{srcname}
3606704
Version:	2.5.2
e49816d
Release:	%autorelease
Timothée Floure 5f013f2
Summary:	A keyboard-driven, vim-like browser based on PyQt5 and QtWebEngine
5b4e4f6
License:	GPLv3
5b4e4f6
URL:		http://www.qutebrowser.org
Timothée Floure e7643e8
Source0:	https://github.com/%{srcname}/%{srcname}/releases/download/v%{version}/%{srcname}-%{version}.tar.gz
5b4e4f6
BuildArch:	noarch
5b4e4f6
BuildRequires:	python3-devel
5b4e4f6
BuildRequires:	asciidoc
5b4e4f6
BuildRequires:	desktop-file-utils
2ab69fd
BuildRequires:	libappstream-glib
32f611c
BuildRequires:	python3-setuptools
e571f61
Requires:	qt5-qtbase
e6ac386
Requires:	qt5-qtdeclarative
5b4e4f6
Requires:	python3-qt5
5b4e4f6
Requires:	python3-jinja2
5b4e4f6
Requires:	python3-PyYAML
Timothée Floure ce02c23
Requires:	((qt5-qtwebengine and python3-qt5-webengine) or (qt5-qtwebkit and python3-qt5-webkit))
32f611c
Recommends:	(qt5-qtwebengine and python3-qt5-webengine and qt5-qtwebengine-devtools)
Timothée Floure ce02c23
Recommends:	(qt5-qtwebkit and python3-qt5-webkit)
32f611c
Recommends:	python3-pygments
9a1ae03
Recommends:	python3-adblock
30dec69
5b4e4f6
%description
5b4e4f6
qutebrowser is a keyboard-focused browser with a minimal GUI. It’s based on
Timothée Floure 5f013f2
Python, PyQt5 and QtWebEngine and free software, licensed under the GPL.
5b4e4f6
It was inspired by other browsers/addons like dwb and Vimperator/Pentadactyl.
5b4e4f6
5b4e4f6
5b4e4f6
%prep
Timothée Floure b33f614
%autosetup -p 1 -n %{srcname}-%{version}
5b4e4f6
5b4e4f6
5b4e4f6
%build
5b4e4f6
# Compile the man page
5b4e4f6
a2x -f manpage doc/qutebrowser.1.asciidoc
5b4e4f6
74034ca
# Find all *.py files and if their first line is exactly '#!/usr/bin/env python3'
74034ca
# then replace it with '#!/usr/bin/python3' (if it's the 1st line).
74034ca
find . -type f -iname "*.py" -exec sed -i '1s_^#!/usr/bin/env python3$_#!/usr/bin/python3_' {} +
5b4e4f6
5b4e4f6
%py3_build
5b4e4f6
5b4e4f6
5b4e4f6
%install
5b4e4f6
%py3_install
5b4e4f6
90e7e17
# Install desktop and appdata files
5b4e4f6
desktop-file-install \
5b4e4f6
	--add-category="Network" \
5b4e4f6
	--delete-original \
5b4e4f6
	--dir=%{buildroot}%{_datadir}/applications \
f4a3415
	misc/org.%{srcname}.%{srcname}.desktop
5b4e4f6
90e7e17
install -Dm644 misc/org.qutebrowser.qutebrowser.appdata.xml -t %{buildroot}%{_datadir}/metainfo
90e7e17
5b4e4f6
# Install man page
5b4e4f6
install -Dm644 doc/%{srcname}.1 -t %{buildroot}%{_mandir}/man1
5b4e4f6
5b4e4f6
# Install icons
5b4e4f6
install -Dm644 icons/qutebrowser.svg \
5b4e4f6
	-t "%{buildroot}%{_datadir}/icons/hicolor/scalable/apps"
5b4e4f6
for i in 16 24 32 48 64 128 256 512; do
5b4e4f6
	install -Dm644 "icons/qutebrowser-${i}x${i}.png" \
5b4e4f6
		"%{buildroot}%{_datadir}/icons/hicolor/${i}x${i}/apps/qutebrowser.png"
5b4e4f6
done
5b4e4f6
5b4e4f6
# Set __main__.py as executable
5b4e4f6
chmod 755 %{buildroot}%{python3_sitelib}/%{srcname}/__main__.py
5b4e4f6
5b4e4f6
# Remove zero-length files:
5b4e4f6
# https://fedoraproject.org/wiki/Packaging_tricks#Zero_length_files
5b4e4f6
find %{buildroot} -size 0 -delete
5b4e4f6
2ab69fd
%check
2ab69fd
appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/*.appdata.xml
2ab69fd
5b4e4f6
%files
Timothée Floure 5f013f2
%license LICENSE
Timothée Floure 4a049e3
%doc README.asciidoc doc/changelog.asciidoc qutebrowser/html/doc
5b93c8c
%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info
5b4e4f6
%{python3_sitelib}/%{srcname}
5b4e4f6
%{_bindir}/%{srcname}
f4a3415
%{_datadir}/applications/org.%{srcname}.%{srcname}.desktop
5b4e4f6
%{_mandir}/man1/%{srcname}.1*
5b4e4f6
%{_datadir}/icons/hicolor/scalable/apps/%{srcname}.svg
5b4e4f6
%{_datadir}/icons/hicolor/16x16/apps/%{srcname}.png
5b4e4f6
%{_datadir}/icons/hicolor/24x24/apps/%{srcname}.png
5b4e4f6
%{_datadir}/icons/hicolor/32x32/apps/%{srcname}.png
5b4e4f6
%{_datadir}/icons/hicolor/48x48/apps/%{srcname}.png
5b4e4f6
%{_datadir}/icons/hicolor/64x64/apps/%{srcname}.png
5b4e4f6
%{_datadir}/icons/hicolor/128x128/apps/%{srcname}.png
5b4e4f6
%{_datadir}/icons/hicolor/256x256/apps/%{srcname}.png
5b4e4f6
%{_datadir}/icons/hicolor/512x512/apps/%{srcname}.png
2ab69fd
%{_datadir}/metainfo/org.qutebrowser.qutebrowser.appdata.xml
5b4e4f6
5b4e4f6
%changelog
e49816d
%autochangelog