File electrum.spec of Package electrum

#
# spec file for package electrum
#
# Copyright (c) 2023 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/
#


Name:           electrum
Version:        4.6.0
Release:        0
Summary:        Lightweight BitCoin Client
License:        MIT
Group:          Productivity/Networking/Other
URL:            https://%{name}.org/
Source0:        https://download.electrum.org/%{version}/Electrum-%{version}.tar.gz
Source1:        https://download.electrum.org/%{version}/Electrum-%{version}.tar.gz.asc
# Obtained from https://raw.githubusercontent.com/spesmilo/electrum/master/pubkeys/ThomasV.asc
Source2:        Electrum.keyring
Patch0:         0001-lift-attrs-dnspython-versions.patch
BuildArch:      noarch
BuildRequires:  bitcoin-utils
BuildRequires:  fdupes
BuildRequires:  libsecp256k1-6
BuildRequires:  python3-Kivy
BuildRequires:  python3-QDarkStyle
BuildRequires:  python3-PySocks >= 1.6.6
BuildRequires:  python3-aiohttp-socks
BuildRequires:  python3-aiorpcX
BuildRequires:  python3-attrs
BuildRequires:  python3-bitstring
BuildRequires:  python3-devel
BuildRequires:  python3-dnspython
BuildRequires:  python3-electrum-aionostr
BuildRequires:  python3-electrum-ecc
BuildRequires:  python3-jsonpatch
BuildRequires:  python3-jsonrpclib-pelix
BuildRequires:  python3-pbkdf2
BuildRequires:  python3-protobuf
BuildRequires:  python3-qrcode
BuildRequires:  python3-qt6-devel
BuildRequires:  python3-requests
BuildRequires:  python3-setuptools
Provides:       qt6qmlimport(org.electrum)
Provides:       qt6qmlimport(org.electrum.1)
Requires:       libsecp256k1-6
Requires:       python3-PyQt6
Recommends:     %{name}-lang
%{?python_enable_dependency_generator}

%description
Electrum is an easy to use BitCoin wallet. It protects you from losing coins in
a backup mistake or computer failure, because your wallet can be recovered from
a secret phrase that you can write on paper or learn by heart. There is no
waiting time when you start the client, because it does not download the
BitCoin blockchain.

%lang_package

%prep
%autosetup -p1 -n Electrum-%{version}
%{__sed} -i -e 's#^Exec=sh -c "PATH=.* \(electrum.* %u\)"$#Exec=\1#' %{name}.desktop

%build
export CFLAGS="%{optflags}"
%python3_build

%install
%python3_install

rm -f %{buildroot}%{python3_sitelib}/electrum/plugins/payserver/www/{.editorconfig,.gitignore}

find %{buildroot}%{python3_sitelib} -type f \( -name '*.py' -o -name electrum \) -exec sed -i '1 { /#! *\/usr\/bin\/env python3*/ d }' {} + -exec chmod a-x {} +
find %{buildroot}%{python3_sitelib} -type f -name '.gitignore' -delete

%find_lang %{name}
%fdupes %{buildroot}%{python3_sitelib}/%{name}
%fdupes %{buildroot}%{_datadir}/icons/ %{buildroot}%{_datadir}/pixmaps/

%check
# it fails:
#%%{__python3} setup.py test

# at least a naive test
export PYTHONPATH=%{buildroot}%{python3_sitelib}/
%{buildroot}%{_bindir}/%{name} --help | grep -q 'show this help message and exit'

%files
%doc AUTHORS README.md RELEASE-NOTES
%license LICENCE
%attr(755,root,root) %{_bindir}/%{name}
%{python3_sitelib}/*
%exclude %{python3_sitelib}/%{name}/locale
%{_datadir}/applications/%{name}.desktop
%dir %{_datadir}/icons/hicolor/
%dir %{_datadir}/icons/hicolor/*x*/
%dir %{_datadir}/icons/hicolor/*x*/apps/
%{_datadir}/icons/hicolor/*x*/apps/%{name}.png
%{_datadir}/pixmaps/%{name}.png

%files lang -f %{name}.lang
%dir %{python3_sitelib}/%{name}/locale/
%dir %{python3_sitelib}/%{name}/locale/locale/
%dir %{python3_sitelib}/%{name}/locale/locale/*/
%dir %{python3_sitelib}/%{name}/locale/locale/*/*/

%changelog
openSUSE Build Service is sponsored by