File pysycache.spec of Package pysycache
#
# spec file for package pysycache
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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/
#
%define real_version 3.1b
%define real_name pysycache-src
%define py_group games
%define py_user games
Name: pysycache
Version: 3.1.01
Release: 0
Summary: Educational point-and-click software for young children
License: GPL-2.0+
Group: Amusements/Teaching/Other
URL: http://www.pysycache.org/
Source0: %{name}-%{real_version}.tar.bz2
Source2: %{name}.permissions
Source3: %{name}-rpmlintrc
Patch0: pysycache-desktop.patch
Patch1: pysycache-lang-de.patch
Patch2: pysycache-lang-es.patch
Patch3: pysycache-console_encoding.patch
Patch4: pysycache-fast_quitting.patch
Patch5: pysycache-no-return-in-nonvoid-function.patch
BuildRequires: gzip
BuildRequires: update-desktop-files
Requires: SDL
Requires: SDL_mixer
Requires: python-pygame
# FIXME: use proper Requires(pre/post/preun/...)
PreReq: %{_bindir}/getent
PreReq: %{_sbindir}/groupadd
PreReq: %{_sbindir}/useradd
PreReq: permissions
%if 0%{?suse_version} > 1020
BuildRequires: fdupes
%endif
%if 0%{?suse_version} > 1000
Recommends: pysycache-languagepack
%else
Requires: pysycache-languagepack
%endif
# BuildArch: noarch
%description
PySyCache is an educational software for the young children (4-7 years old)
with target to learn them to move the mouse to click with mouse buttons
PySyCache doesn't want some powerful computer, and it can be used
at home with yours children in the schools.
%prep
%setup -q -n %{real_name}
%patch0
%patch1
%patch2
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
cd linux
gcc %{optflags} -pie -fpie -o pysycache pysycache.c
%install
# python files
install -d %{buildroot}%{_datadir}/%{name}
cp -rf %{_builddir}/%{real_name}/pysycache/* %{buildroot}/%{_datadir}/%{name}/
for file in %{buildroot}/%{_datadir}/%{name}/*.py; do
sed -e "s|#!%{_bindir}/env python|#!%{_bindir}/python|" $file > $file.$$
mv -vf $file.$$ $file
chmod +x $file
done
find %{buildroot}/%{_datadir}/%{name}/licences/ -type f -exec chmod 644 {} \;
# sound files
cd %{buildroot}/%{_datadir}/%{name}/lang
mv de de_DE
for lang in $(ls -d *); do
case $lang in
.*)
continue;
;;
*en_EN*)
continue;
;;
*)
pushd $lang
for i in $(find ../en_EN/ -name "*.ogg"); do
ogg=$(basename $i)
echo "ogg = $ogg"
test -f $ogg || ln -s $i $ogg
echo "link = $i -> $ogg"
done
popd
;;
esac
done
cd -
# binary
install -d %{buildroot}/%{_bindir}/
install -m755 %{_builddir}/%{real_name}/linux/pysycache %{buildroot}/%{_bindir}/
chmod 2755 %{buildroot}%{_bindir}/%{name}
# documentation
install -d %{buildroot}%{_defaultdocdir}/%{name}
cp -rf %{_builddir}/%{real_name}/pysycache/doc/* %{buildroot}%{_defaultdocdir}/%{name}/
find %{buildroot}%{_defaultdocdir}/%{name}/ -type f -exec chmod 644 {} \;
for i in AUTHORS ChangeLog COPYING NEWS README; do
mv %{buildroot}%{_datadir}/%{name}/$i %{buildroot}%{_defaultdocdir}/%{name}/
done
rm %{buildroot}%{_datadir}/%{name}/INSTALL
# man files
install -d %{buildroot}%{_mandir}/man1
gzip -c %{_builddir}/%{real_name}/linux/man/pysycache.1 > %{buildroot}%{_mandir}/man1/pysycache.1.gz
# desktop entry
install -d %{buildroot}/%{_datadir}/pixmaps
install -d %{buildroot}/%{_datadir}/applications
install -m 644 %{_builddir}/%{real_name}/linux/usr/share/pixmaps/*.png %{buildroot}/%{_datadir}/pixmaps/
install -m 644 %{_builddir}/%{real_name}/linux/usr/share/applications/*.desktop %{buildroot}/%{_datadir}/applications/
%suse_update_desktop_file -n -i pysycache-admin
%suse_update_desktop_file -n -i pysycache
# configuration directory
install -d %{buildroot}/%{_sysconfdir}/pysycache
install -m644 %{_builddir}/%{real_name}/linux%{_sysconfdir}/pysycache/pysycache.dfg %{buildroot}/%{_sysconfdir}/pysycache/
mkdir -p %{buildroot}%{_localstatedir}/games/%{name}/{users,themes-move,themes-click,themes-dblclick,themes-buttons,themes-puzzle}
# permissions file
install -d %{buildroot}/%{_sysconfdir}/permissions.d/
install -m 644 %{SOURCE2} %{buildroot}/%{_sysconfdir}/permissions.d/pysycache
%if 0%{?suse_version} > 1020
%fdupes -s %{buildroot}
%endif
%post
%if 0%{?suse_version} <= 1130
%run_permissions
%else
%set_permissions %{name}
%set_permissions %{_bindir}/%{name}
%set_permissions %{_sysconfdir}/%{name}
%set_permissions %{_sysconfdir}/%{name}/pysycache.dfg
%set_permissions %{_localstatedir}/games/%{name}/themes-puzzle/
%set_permissions %{_localstatedir}/games/%{name}/themes-click/
%set_permissions %{_localstatedir}/games/%{name}/themes-dblclick/
%set_permissions %{_localstatedir}/games/%{name}/themes-buttons/
%set_permissions %{_localstatedir}/games/%{name}/themes-move/
%endif
%verifyscript
%verify_permissions -e %{_bindir}/%{name}
%verify_permissions -e %{_sysconfdir}/%{name}
%verify_permissions -e %{_sysconfdir}/%{name}/pysycache.dfg
%verify_permissions -e %{_localstatedir}/games/%{name}/themes-puzzle/
%verify_permissions -e %{_localstatedir}/games/%{name}/themes-click/
%verify_permissions -e %{_localstatedir}/games/%{name}/themes-dblclick/
%verify_permissions -e %{_localstatedir}/games/%{name}/themes-buttons/
%verify_permissions -e %{_localstatedir}/games/%{name}/themes-move/
%files
%defattr(-,root,root)
%doc %{_defaultdocdir}/%{name}
%verify(not mode user group) %attr (2755, %{py_user},%{py_group}) %{_bindir}/%{name}
%verify(not mode user group) %attr(1775,%{py_user},%{py_group}) %dir %{_sysconfdir}/pysycache
%verify(not mode user group) %attr(1775,%{py_user},%{py_group}) %config(noreplace) %{_sysconfdir}/pysycache/pysycache.dfg
%config %{_sysconfdir}/permissions.d/pysycache
%{_datadir}/%{name}
%{_mandir}/man1/pysycache.1%{ext_man}
%{_datadir}/applications/pysycache-admin.desktop
%{_datadir}/applications/pysycache.desktop
%{_datadir}/pixmaps/%{name}.png
%dir %{_localstatedir}/games
%defattr(01775,%{py_user},%{py_group})
%verify(not mode user group) %dir %{_localstatedir}/games/%{name}
%verify(not mode user group) %dir %{_localstatedir}/games/%{name}/users
%verify(not mode user group) %dir %{_localstatedir}/games/pysycache/themes-move
%verify(not mode user group) %dir %{_localstatedir}/games/pysycache/themes-click
%verify(not mode user group) %dir %{_localstatedir}/games/pysycache/themes-dblclick
%verify(not mode user group) %dir %{_localstatedir}/games/pysycache/themes-buttons
%verify(not mode user group) %dir %{_localstatedir}/games/pysycache/themes-puzzle
%changelog