File TuxWordSmith.spec of Package TuxWordSmith

#
# spec file for package TuxWordSmith
#
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#

# norootforbuild

Name:           TuxWordSmith
%define         realname tuxwordsmith
Summary:        Scrabble like game for young children 
Version:        0.8.1
Release:        1
Group:          Amusements/Games/Other
License:        AGPL-3.0
Vendor:         openSUSE-Education
Url:            https://github.com/ccosse/tuxwordsmith
Source0:        %{realname}-%{version}.tar.bz2
Source1:        %{name}.desktop
Source2:        %{name}.png
Source3:        %{name}-rpmlintrc
Source4:        tuxwordsmith.sh
Requires:       SDL
Requires:       bash
BuildRequires:  python
%{py_requires}
###########################################
# Fedora specials
###########################################
%if 0%{?fedora_version}
Requires:       pygame
Requires:       wxPython
#Requires:       TuxWordSmith-dictionaries
BuildRequires:  desktop-file-utils
%endif
###########################################
# SUSE specials
###########################################
%if 0%{?suse_version}
Requires:       python-pygame 
Requires:       python-wxGTK
#Recommends:     TuxWordSmith-dictionaries
BuildRequires:  update-desktop-files
BuildRequires:  fdupes
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}

%description
TuxWordSmith is similar to the classic word game "Scrabble", but with unicode
support for multiple languages and character sets. The game is currently
distributed with forty-two (42) dictionary resources for playing
Language[i]-Language[j] "Scrabble". 

For example, if configured to use the French-German dictionary, then the
distribution of available tiles will be computed based on frequency of
occurance of each character of Language[i] (French), and for each submission
the corresponding definition will be given in Language[j] (German). 

The latest release includes support for the Greek and Cyrillic (Russian,
Ukranian) character sets, thus making it possible to play Scrabble in Greek,
Russian and Ukranian, as well as a host of other languages which use latin
characters.


%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%{python_sitelib}
mkdir -p %buildroot/var/games/%{name}

# config 
cp -r Font %buildroot/var/games/%{name}/
cp -r xdxf %buildroot/var/games/%{name}/
install -m644 .tws_config_master  %buildroot/var/games/%{name}/
# install binfile
install -m755 tuxwordsmith.py %buildroot%{_bindir}/%{name}
cp -r %{name} %buildroot/%python_sitelib/
install -m755 %{SOURCE4} %buildroot%{_bindir}/tuxwordsmith.sh

# below is the desktop file and icon stuff.
install -Dm 644 %SOURCE1 %buildroot%{_datadir}/applications/%{name}.desktop
install -Dm 644 %SOURCE2 %buildroot%{_datadir}/pixmaps/%{name}.png
%if 0%{?suse_version}
%suse_update_desktop_file -n %{name} Education Math
%endif

%if 0%{?fedora_version}
desktop-file-install --vendor="%{vendor}" \
  --der=%buildroot/%_datadir/applications \
  %SOURCE1
%endif
# 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_sitelib/%{name}/
chmod +x %buildroot/%python_sitelib/%{name}/{projectile,tws_wx,tws}.py
# save discspace: symlink duplicates
%if 0%{?suse_version} 
%fdupes -s %buildroot
%endif

%clean
rm -rf %buildroot

%files
%defattr(-, root, root)
%if 0%{?suse_version} >= 1500
%license LICENSE
%else
%doc LICENSE
%endif
%doc CHANGES README* VERSION 
%{_bindir}/%{name}*
%{_bindir}/tuxwordsmith.sh
%python_sitelib/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%config(noreplace) /var/games/%{name}/.tws_config_master
%dir /var/games
/var/games/%{name}

%changelog
openSUSE Build Service is sponsored by