File timeline.spec of Package timeline

#
# spec file for package python-timeline
#
# Copyright (c) 2024 Malcolm J Lewis <malcolmlewis@opensuse.org>
#
# 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/
#

%define         _version 2.10.0-beta-0249eaf098e4-2024-01-24
Name:           timeline
Version:        2.10.0+beta.0249ea
Release:        0
Summary:        Display and navigate events
License:        GPL-3.0-or-later
URL:            https://thetimelineproj.sourceforge.net/index.html
Source0:        timeline-%{_version}.zip
## PATCH-FIX-OPENSUSE timeline-fix-path.patch malcolmlewis@opensuse.org -- Use datadir for root and translations.
Patch0:         timeline-fix-path.patch
BuildRequires:  fdupes
BuildRequires:  gettext
BuildRequires:  hicolor-icon-theme
BuildRequires:  python3-devel
BuildRequires:  unzip
BuildRequires:  update-desktop-files
## MANUAL BEGIN
Requires:       python3-humblewx
Requires:       python3-icalendar
Requires:       python3-markdown2
Requires:       python3-wxPython
## MANUAL END
BuildArch:      noarch

%description
A cross-platform application for displaying and navigating events on a timeline.

%prep
%autosetup -p1 -n timeline-%{_version}
sed -i -e 's|/usr/bin/env python3|/usr/bin/python3|g' source/timeline.py

%build
python3 ./tools/generate-mo-files.py

%install
install -d -m0755 %{buildroot}%{_bindir} \
                  %{buildroot}%{_datadir}/timeline \
                  %{buildroot}%{python3_sitelib}/timelinelib \
                  %{buildroot}%{_datadir}/applications \
                  %{buildroot}%{_datadir}/icons/hicolor/48x48/apps \
                  %{buildroot}%{_datadir}/locale

install -m0755 source/timeline.py %{buildroot}%{_bindir}/timeline
cp -pr icons %{buildroot}%{_datadir}/timeline/
cp -pr source/timelinelib/* %{buildroot}%{python3_sitelib}/timelinelib/
install -m0644 icons/48.png %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/timeline.png
cp -a translations/*/ %{buildroot}%{_datadir}/locale/

## Drop bundled python dependencies.
rm -rf %{buildroot}%{_datadir}/timeline/dependencies

## Add desktop file
cat > %{buildroot}%{_datadir}/applications/timeline.desktop <<EOF
[Desktop Entry]
Name=Timeline
Comment=Displays and navigates events on a timeline
Exec=timeline
Icon=timeline
Terminal=false
Type=Application
StartupNotify=false
Categories=Office;Calendar;ProjectManagement;
EOF

%suse_update_desktop_file %{buildroot}%{_datadir}/applications/timeline.desktop

%fdupes -s %{buildroot}

%find_lang %{name}

%files -f %{name}.lang
%doc AUTHORS README
%license COPYING
%{_bindir}/timeline
%{_datadir}/timeline
%{_datadir}/applications/timeline.desktop
%{_datadir}/icons/hicolor/48x48/apps/timeline.png
%{python3_sitelib}/timelinelib*

%changelog

openSUSE Build Service is sponsored by