File python-buku.spec of Package python-buku

#
# spec file for package python-buku
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#

Name:           python-buku
Version:        4.9
Release:        0
Summary:        Command-line bookmark manager
License:        GPL-3.0-or-later
Group:          Productivity/Networking/Web/Utilities
Url:            https://github.com/jarun/buku
Source0:        buku-%{version}.tar.zst
BuildRequires:  %{python_module base}
BuildRequires:  %{python_module setuptools}
BuildRequires:  bash-completion
BuildRequires:  fish
BuildRequires:  python-rpm-macros
BuildRequires:  zsh
BuildRequires:  fdupes
Requires:       python-base
Requires:       python-beautifulsoup4
Requires:       python-cryptography
Requires:       python-requests
Requires:       python-urllib3
Requires:       python-certifi
Requires:       python-html5lib
Requires:       python-Flask
Requires:       python-Flask-Admin
Requires:       python-Flask-Bootstrap
Requires(post):    update-alternatives
Requires(postun):  update-alternatives
Recommends:     xsel
BuildArch:      noarch
%python_subpackages

%description
Bookmark management utility written in Python3 and SQLite3.

With tagging and multiple options to search bookmarks, including
regex and a deep scan mode (particularly for URLs), finding a
bookmark is very easy. Multiple search results can be opened in
the browser at once.

Though a terminal utility, it's possible to add bookmarks to buku
without touching the terminal.
Buku supports revisiting random forgotten bookmarks too.

%package -n %{name}-bash-completion
Summary:        Bash completion for %{name}
Group:          Productivity/Networking/Web/Utilities
Supplements:    (%{name} and bash-completion)
Requires:       bash-completion
BuildArch:      noarch

%description -n %{name}-bash-completion
Bash command line completion support for %{name}.

%package -n %{name}-fish-completion
Summary:        Fish completion for %{name}
Group:          Productivity/Networking/Web/Utilities
Supplements:    (%{name} and fish)
Requires:       fish
BuildArch:      noarch

%description -n %{name}-fish-completion
Fish command line completion support for %{name}.

%package -n %{name}-zsh-completion
Summary:        ZSH Completion for %{name}
Group:          Productivity/Networking/Web/Utilities
Supplements:    (%{name} and zsh)
Requires:       zsh
BuildArch:      noarch

%description -n %{name}-zsh-completion
ZSH command line completion support for %{name}.

%prep
%setup -q -n buku-%{version}
# ditch shebang
sed -i.old '1{/#!.*/d}' buku bukuserver/api.py bukuserver/server.py

%build
%python_build

%install
%python_install
%python_clone -a %{buildroot}%{_bindir}/buku
%python_clone -a %{buildroot}%{_bindir}/bukuserver
%python_expand %fdupes %{buildroot}%{$python_sitelib}
mkdir -pv %{buildroot}%{_mandir}/man1
install -m0644 buku.1 -t %{buildroot}%{_mandir}/man1
%python_clone -a %{buildroot}%{_mandir}/man1/buku.1
install -Dm0644 auto-completion/bash/buku-completion.bash %{buildroot}%{_datadir}/bash-completion/completions/buku
install -Dm0644 auto-completion/fish/buku.fish -t %{buildroot}%{_datadir}/fish/completions/buku.fish
install -Dm0644 auto-completion/zsh/_buku -t %{buildroot}%{_datadir}/zsh/site-functions/_buku

%post
%{python_install_alternative buku buku.1 bukuserver}

%postun
%{python_uninstall_alternative buku buku.1 bukuserver}

%files %{python_files}
%doc CHANGELOG README.md
%license LICENSE
%python_alternative %{_bindir}/buku
# FIXME: bukuserver did not work due to python-Flask-Api unavailable
%python_alternative %{_bindir}/bukuserver
%python_alternative %{_mandir}/man1/buku.1%{ext_man}
%{python_sitelib}/*

%files -n %{name}-bash-completion
%{_datadir}/bash-completion/completions/buku

%files -n %{name}-fish-completion
%{_datadir}/fish/completions/buku.fish

%files -n %{name}-zsh-completion
%{_datadir}/zsh/site-functions/_buku

%changelog
openSUSE Build Service is sponsored by