File lightyears.spec of Package lightyears

#
# spec file for package lightyears
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright Vincent Petry <PVince81@yahoo.fr>
#
# 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:           lightyears
Version:        1.5.0
Release:        0
Summary:        Steampunk-themed strategy game
License:        GPL-2.0
Group:          Amusements/Games/Strategy/Other
Url:            https://www.jwhitham.org/20kly/
Source:         https://github.com/20kly/20kly/archive/refs/tags/v%{version}.tar.gz#/20kly-%{version}.tar.gz
Source1:        %{name}.desktop
Source2:        %{name}.png
BuildRequires:  update-desktop-files
BuildRequires:  python3
Requires:       python3-pygame >= 1.9.4
BuildArch:      noarch

%description
20,000 Light Years Into Space is a steampunk-themed strategy game
where you have to manage a steam supply network.

%prep
%setup -q -n 20kly-%{version}
# change game path and interpreter in startup script
sed -e 's|^LIGHTYEARS_DIR =.*$|LIGHTYEARS_DIR = "%{_datadir}/%{name}"|' \
    -e 's|#!/usr/bin/python$|#!%{_bindir}/python3\n|' \
    -i %{name}

%build
python3 -m compileall lib20k

%install
export DATADIR="%{buildroot}/%{_datadir}/%{name}/"
# startup script
install -D -m 755 %{name} %{buildroot}%{_bindir}/%{name}
# install code
install -D -d -m 755 "$DATADIR/code"
touch "$DATADIR/code/__init__.py"
cp -Ra lib20k "$DATADIR/"
# data
install -D -d -m 755 "$DATADIR/data"
install -D -m 644 data/* "$DATADIR/data"
# desktop icon
install -D -m 644 %{SOURCE1} %{buildroot}/%{_datadir}/applications/%{name}.desktop
install -D -m 644 %{SOURCE2} %{buildroot}/%{_datadir}/pixmaps/%{name}.png
%suse_update_desktop_file %{name}

%files
%license LICENSE.txt
%doc manual.pdf
%{_bindir}/%{name}
%{_datadir}/%{name}/
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png

%changelog
openSUSE Build Service is sponsored by