File TuxMathScrabble.spec of Package TuxMathScrabble
#
# spec file for package TuxMathScrabble
#
# Copyright (c) 2021 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/
#
%define         realname tuxmathscrabble
%{!?python_sitearch: %global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
Name:           TuxMathScrabble
Version:        0.8.1
Release:        0
Summary:        Add, subtract and multiply
License:        AGPL-3.0-only
Group:          Amusements/Games/Other
URL:            https://github.com/ccosse/tuxmathscrabble
Source0:        https://github.com/ccosse/%{realname}/archive/%{version}.tar.gz#/%{realname}-%{version}.tar.gz
Source1:        tms
Source2:        TuxMathScrabble.desktop
Source3:        TuxMathScrabble.png
Source4:        TuxMathScrabble-rpmlintrc
BuildRequires:  python
Requires:       SDL
Requires:       bash
###########################################
# Fedora specials
###########################################
%if 0%{?fedora_version}
BuildRequires:  desktop-file-utils
Requires:       pygame
Requires:       wxPython
%endif
###########################################
# SUSE specials
###########################################
%if 0%{?suse_version}
BuildRequires:  fdupes
BuildRequires:  update-desktop-files
Requires:       python-pygame
Requires:       python-wxGTK
%endif
%description
TuxMathScrabble is a math version of the classic word game "Scrabble"
(Trademark of Hasbro,Inc) which challenges kids to construct compound equations
and to consider multiple abstract possibilities.
There are four skill levels for practice, from basic addition with small
numbers, through multiplication and division with larger numbers. The game can
be played by 0, 1 or 2 human players. Player submissions are made by dragging
tiles to the gameboard and pressing the "okay" button when ready to be
validated. Invalid submissions are thrown-back to the user's tray.
Several new features have recently been added, such as the ability to shuffle
player tiles in-place, the programatic creation of tiles on-the-fly (as opposed
to using images), configurable tile transparency, the ability to use a
background image, and the option of configuring the "None" character for
either/both players.
%prep
%setup -q -n %{realname}-%{version}
find -type d -name .svn -print0 | xargs -0 rm -rf {} \;
find -type f -name "*.pyc" -print0 | xargs -0 rm -rf {} \;
%build
%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{py_sitedir}
mkdir -p %{buildroot}%{_localstatedir}/games/%{name}
# config
install -m644 .tms_config_master %{buildroot}%{_localstatedir}/games/%{name}/
cp -r Font %{buildroot}%{_localstatedir}/games/%{name}/
sed -e "s|#!%{_bindir}/env python2.7-32|#!%{_bindir}/python|" tuxmathscrabble.py > %buildroot%{_bindir}/%{name}
chmod +x %{buildroot}%{_bindir}/%{name}
install -m755 %{SOURCE1} %{buildroot}%{_bindir}/tms
test -d %{buildroot}/%{python_sitearch} || mkdir -p %{buildroot}/%{python_sitearch}
cp -r %{name} %{buildroot}/%{python_sitearch}/
# below is the desktop file and icon stuff.
install -D -m 644 %{SOURCE2} %{buildroot}%{_datadir}/applications/%{name}.desktop
install -D -m 644 %{SOURCE3} %{buildroot}%{_datadir}/pixmaps/%{name}.png
%suse_update_desktop_file -n %{name} Education Math
# recompile the sources
python -O -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %{buildroot}/%{python_sitearch}/%{name}/
chmod +x %{buildroot}/%{python_sitearch}/%{name}/{projectile,environment,tms_wx,tms}.py
%fdupes -s %{buildroot}
%files
%doc README* VERSION CHANGES
%license LICENSE
%dir %{_localstatedir}/games
%{_bindir}/%{name}*
%{_bindir}/tms
%{python_sitearch}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%config(noreplace) %{_localstatedir}/games/%{name}/.tms_config_master
%{_localstatedir}/games/%{name}
%changelog