File brainworkshop.spec of Package brainworkshop

# spec file for package brainworkshop
# Copyright (c) 2012 SUSE LINUX Products 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

Name:           brainworkshop
Version:        4.8.4
Release:        1
License:        GPL-2.0+
Summary:        A free version of the Dual N-Back mental exercise
Group:          Amusements/Teaching/Other
Source0:         %{name}-%{version}.tar.bz2
Source1:        %name.desktop
Requires:       openal-soft
Requires:       python
Requires:       python-pyglet
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%define         installdir /usr/share/%name

Brain Workshop is a free open-source Python version of the Dual N-Back mental

A recent study in the Proceedings of the National Academy of Sciences found
that a particular memory task, called Dual N-Back, may actually improve short
term memory and fluid intelligence (IQ), previously thought to be unchangeable.

The game involves remembering a sequence of spoken letters and a
sequence of positions of a square at the same time. Brain Workshop includes an
optional Triple N-Back mode that introduces differently colored squares as a
third stimulus.

%setup -n %name


mkdir -p %{buildroot}%installdir
cp -r * %{buildroot}%installdir/
mkdir -p %{buildroot}%{_bindir}
cat > %{buildroot}%{_bindir}/brainworkshop << EOF
pushd %installdir 1>/dev/null
if [ ! -f ~/.config/brainworkshop/config.ini ]; then
	test -d ~/.config/brainworkshop || mkdir -p ~/.config/brainworkshop
	touch ~/.config/brainworkshop
/usr/bin/python brainworkshop.pyw --configfile ~/.config/brainworkshop/config.ini  --statsfile ~/.config/brainworkshop/stats.txt &
# change DOS newlines to Unix format
sed -i 's|.$||' %{buildroot}%installdir/brainworkshop.pyw
sed -i 's|/usr/bin/env python|%{_bindir}/python|' %{buildroot}%installdir/brainworkshop.pyw
# delete version from caption
sed -i '/caption.append(VERSION)/ d' %{buildroot}%installdir/brainworkshop.pyw
sed -i "s|caption.append('Brain Workshop ')|caption.append('Brain Workshop')|" %{buildroot}%installdir/brainworkshop.pyw
# delete built-in python-pyglet
rm -r %{buildroot}%installdir/pyglet
# update to support newer python-pyglet
sed -i "s|halign='middle'|align='center'|g" %{buildroot}%installdir/brainworkshop.pyw
# make the scripts executable
chmod +x %{buildroot}%{_bindir}/%name
chmod +x %{buildroot}%installdir/brainworkshop.pyw
# install desktop entries
mkdir -p %{buildroot}%{_datadir}/{applications,pixmaps}
ln -s %installdir/res/misc/brain/brain.png %{buildroot}%{_datadir}/pixmaps/brainworkshop.png
cp %{_sourcedir}/brainworkshop.desktop %{buildroot}%{_datadir}/applications/brainworkshop.desktop

rm -rf %{buildroot}


openSUSE Build Service is sponsored by