File whichwayisup.spec of Package whichwayisup
#
# spec file for package whichwayisup
#
# Copyright (c) 2021 SUSE LLC
# 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: whichwayisup
Version: 0.7.9
Release: 0
Summary: Which Way Is Up?
License: GPL-2.0 and CC-BY-3.0
Group: Amusements/Games/Action/Arcade
URL: https://www.oletus.fi/static/whichwayisup/
# Source downloaded from https://www.oletus.fi/static/whichwayisup/whichwayisup_b079.zip
# Removed included font in data/misc/Vera.ttf
# Repacked as .tar.bz2
Source: %{name}-%{version}.tar.bz2
Source1: %{name}.desktop
Source2: %{name}.png
# PATCH-FEATURE-OPENSUSE -- Patch to force the game to use the system font instead of expecting a bundled one.
Patch0: %{name}-font.patch
# PATCH-FIX-OPENSUSE fix-compare-None-int.patch -- Fixed compare for python3
Patch1: fix-compare-None-int.patch
# PATCH-FIX-OPENSUSE fix-run-script.patch
Patch2: fix-run-script.patch
BuildRequires: dos2unix
BuildRequires: fdupes
BuildRequires: python3
BuildRequires: python3-modernize
BuildRequires: python3-pygame
BuildRequires: update-desktop-files
BuildArch: noarch
Requires: bitstream-vera
Requires: python3-pygame
%description
A traditional and challenging 2D platformer game with a slight rotational twist.
Help a mysterious big-eared salaryman named Guy find his keys in a labyrinth of
dangers and bad dialogue.
%prep
%setup -q
%patch0
%patch1 -p1
%patch2 -p1
dos2unix *.txt
%build
sed -i "s|@DATADIR@|%{_datadir}/%{name}|" run_game.py
# Convert to python3
python3 -m modernize -w -n lib
# Compile to bytecode
python3 -m compileall lib
%install
export DATADIR="%{buildroot}/%{_datadir}/%{name}/"
# startup script
install -D -d -m 755 "$DATADIR"
install -D -p -m 755 run_game.py $DATADIR/
install -D -d -m 755 %{buildroot}%{_bindir}
ln -s %{_datadir}/%{name}/run_game.py %{buildroot}%{_bindir}/%{name}
# install code
install -D -d -m 755 "$DATADIR/lib"
install -D -p -m 644 lib/*.py* "$DATADIR/lib/"
cp -Ra lib/__pycache__ "$DATADIR/lib/"
# data
install -D -d -m 755 "$DATADIR/data"
cp -R 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
%fdupes $DATADIR
%suse_update_desktop_file %{name}
%files
%doc README.txt changelog.txt
%{_bindir}/%{name}
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%changelog