File pyfa.spec of Package pyfa

# norootforbuild

%define use_python %{primary_python}
%define python_files *.py eos graphs gui service utils

Name:           pyfa
Version:        2.64.3
Release:        0
%define pkg_version %{version}
%define pkg_name Pyfa
#
Group:          Games/Tools
License:        GPL-3.0
#
BuildArch:      noarch
BuildRequires:  rsync
BuildRequires:  fdupes
BuildRequires:  update-desktop-files
BuildRequires:  xz
BuildRequires:  %{use_python}-wxPython  >=  4.0.6
BuildRequires:  %{use_python}-Logbook >= 1.0.0
BuildRequires:  %{use_python}-matplotlib  >=  3.2.2
BuildRequires:  %{use_python}-numpy >= 1.19.2
BuildRequires:  %{use_python}-python-dateutil
BuildRequires:  %{use_python}-requests >= 2.0.0
BuildRequires:  %{use_python}-SQLAlchemy1 >= 1.3.23
BuildRequires:  %{use_python}-cryptography >= 2.3
BuildRequires:  %{use_python}-markdown2  >=  2.3.5
BuildRequires:  %{use_python}-packaging >=  16.8
BuildRequires:  %{use_python}-roman  >=  2.0.0
BuildRequires:  %{use_python}-beautifulsoup4  >=  4.6.0
BuildRequires:  %{use_python}-PyYAML >= 5.1
%requires_ge    %{use_python}-wxPython
%requires_ge    %{use_python}-Logbook
%requires_ge    %{use_python}-matplotlib
%requires_ge    %{use_python}-numpy
%requires_ge    %{use_python}-python-dateutil
%requires_ge    %{use_python}-requests
%requires_ge    %{use_python}-SQLAlchemy1
%requires_ge    %{use_python}-cryptography
%requires_ge    %{use_python}-markdown2
%requires_ge    %{use_python}-packaging
%requires_ge    %{use_python}-roman
%requires_ge    %{use_python}-beautifulsoup4
%requires_ge    %{use_python}-PyYAML
#
Url:            https://github.com/pyfa-org/Pyfa
Source:         %{pkg_name}-%{pkg_version}.tar.gz
Source1:        pyfa.desktop
Patch1:         path_fixes.patch
Patch2:         disable_download_for_debs.patch
Patch3:         shebang-fixes.patch
Source99:       series
#
#
Summary:        An advanced fitting tool for EVE
%description
Pyfa is an advanced fitting tool available on all platforms.

%prep
%autosetup -n Pyfa-%{pkg_version} -p1

%build
find -type f -executable -print0 | xargs -r0 chmod -v a-x
chmod a+x pyfa.py db_update.py
find -type f -name .git\* -delete -print
perl -p -i -e 's|\r\n|\n|g'      \
    db_update.py                 \
    scripts/compile_data.py      \
    scripts/dump_data.py         \
    scripts/dynamicattributes.py \
    scripts/effectUsedBy.py      \
    scripts/findNonMarket.py     \
    scripts/icons_update.py      \
    scripts/itemDiff.py          \
    scripts/renders_update.py
python3 -m compileall -d %{_datadir}/pyfa/ %{_smp_mflags} %{python_files}
python3 db_update.py

%install
install -d %{buildroot}{%{_datadir}/pyfa/,%{_bindir}}
rsync -av \
  --exclude=debian --exclude='.*' --exclude=scripts --exclude=dist_assets --exclude=staticdata --exclude=tests \
  %{python_files} imgs version.yml eve.db \
  %{buildroot}%{_datadir}/pyfa/
cat <<EOF > %{buildroot}%{_bindir}/pyfa
#!/bin/sh
cd %{_datadir}/pyfa
exec /usr/bin/%{use_python} %{_datadir}/pyfa/pyfa.py $@
EOF
chmod 0755 %{buildroot}%{_bindir}/pyfa
%fdupes %{buildroot}%{_datadir}/pyfa/
# desktop file
install -D -m 0644 %{S:1} %{buildroot}%{_datadir}/applications/pyfa.desktop
install -D -m 0755 -d     %{buildroot}%{_datadir}/pixmaps/
ln -sf /usr/share/pyfa/imgs/gui/pyfa64.png %{buildroot}%{_datadir}/pixmaps/pyfa.png
%suse_update_desktop_file %{name}

%files
%doc *.md
%license LICENSE
%{_bindir}/pyfa
%{_datadir}/pyfa/
%{_datadir}/pixmaps/pyfa.png
%{_datadir}/applications/pyfa.desktop

%changelog
openSUSE Build Service is sponsored by