Blob Blame History Raw
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}

%global date    20141101
%global commit  e7766f1ea8bc328b9320d72f8567a33a0516ff47
%global scommit %(c=%{commit}; echo ${c:0:7})
%global readme  README.md

Name:           apx
Version:        0
Release:        0.5.%{date}git%{scommit}%{?dist}
Summary:        QIX clone, cut into and claim the square area

License:        MIT
URL:            https://github.com/projecthamster/%{name}
Source0:        https://github.com/projecthamster/%{name}/archive/%{scommit}/%{name}-%{scommit}.tar.gz
Source10:       https://camo.githubusercontent.com/e5a26552ee632107f0031b5ca06f521a720b94fd/68747470733a2f2f6661726d382e737461746963666c69636b722e636f6d2f373433342f31333832333837383333355f653234326163316332335f6f2e706e67#/%{name}.png

BuildArch:      noarch

BuildRequires:  python2 python2-devel python-setuptools
BuildRequires:  desktop-file-utils

Requires:       python2

# we need also cairo with pygobject3
Requires:       pygobject3-base pycairo-devel

Requires:      %{name}-fonts = %{version}-%{release}

%description
APX is a QIX clone with minor differences in game-play from the original.
Read about the original: http://en.wikipedia.org/wiki/Qix

Use arrow keys to move around the perimeter of square, hold down Space or Shift
to cut into the area. Connect back to perimeter to claim the area.

Your objective is to claim 75 percent or more to proceed to the next level.

Claiming with Shift key will be slower but give you double the points.

For every claimed full percent over 75 percent you get extra 1000 points.


%package fonts
Summary:       Fonts for the game %{name}
License:       CC-BY
URL:           http://www.04.jp.org/
BuildArch:     noarch

%description fonts
Font named 04b03 for the game %{name}.
Redistribution from http://www.04.jp.org/


%prep
%setup -qn %{name}-%{commit}
sed -i 's|%{name}.sqlite|%{_sharedstatedir}/%{name}/%{name}.sqlite|' scores.py

# FIXME question location for font (subpackage/folder) and license (documentation)
# https://fedoraproject.org/wiki/Packaging:FontsPolicy#Package_layout_for_fonts
mv assets/04b03_LICENSE .

# prepare setuptools
mkdir %{name}
cp -a *.py lib %{name}
# remove shebang
find %{name} -name '*.py' |xargs sed -i '1{\@^#!/usr/bin/env python@d}'

# configure setuptools
# https://github.com/projecthamster/apx/issues/6
cat > setup.py << EOF
#!/usr/bin/env %{__python2}
# - coding: utf-8 -
import os
from setuptools import setup
setup(
    name = "%{name}",
    version = "%{version}git%{scommit}",
    author = "Toms Bauń£is",
    author_email = "toms.baugis at gmail.com",
    description = ("%{summary}"),
    license = "%{license}",
    keywords = "",
    url = "%{url}",
    packages=['%{name}', '%{name}.lib'],
    long_description=open(os.path.join(os.path.dirname(__file__), '%{readme}')).read(),
    classifiers=[
        "Development Status :: 2 - Pre-Alpha",
        "Environment :: X11 Applications :: GTK",
        "Intended Audience :: End Users/Desktop",
        "Topic :: Games/Entertainment",
        "License :: OSI Approved :: %{licence} License",
    ],
)
EOF


%build
%{__python2} setup.py build


%install
install -d %{buildroot}%{_sharedstatedir}/%{name}
install -m0644 -t %{buildroot}%{_sharedstatedir}/%{name} apx.sqlite
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}

# font
cp -ap assets %{buildroot}%{python2_sitelib}/%{name}

cd %{buildroot}

# easy start
install -d .%{_bindir}
cat > .%{_bindir}/%{name} << EOF
#!/usr/bin/sh
cd %{python2_sitelib}/%{name}
%{__python2} %{name}.py
EOF
chmod a+x .%{_bindir}/%{name}

#icon and desktop
install -d .%{_datadir}/pixmaps
install -m0644 %{SOURCE10} .%{_datadir}/pixmaps
install -d .%{_datadir}/applications
cat > .%{_datadir}/applications/%{name}.desktop << EOF
[Desktop Entry]
Name=APX
Comment=%{summary}
Exec=%{name}
Icon=%{name}
Terminal=false
Type=Application
StartupNotify=false
Categories=Game;
EOF
desktop-file-validate .%{_datadir}/applications/%{name}.desktop

 
%files
%doc AUTHORS LICENSE %{readme}
%{_sharedstatedir}/%{name}/
%dir %{python2_sitelib}/%{name}
%{python2_sitelib}/%{name}/*.py*
%{python2_sitelib}/%{name}/lib/
%{python2_sitelib}/*.egg-info/
%{_bindir}/%{name}
%{_datadir}/pixmaps/*.png
%{_datadir}/applications/*.desktop

%files fonts
%doc 04b03_LICENSE
%dir %{python2_sitelib}/%{name}/assets
%{python2_sitelib}/%{name}/assets/04b03.ttf


%changelog
* Fri Dec 19 2014 Raphael Groner <projects.rg [AT] smart.ms> - 0-0.5.20141102gite7766f1
- require cairo
- honor AUTHORS
- use date of last commit (instead of export/clone)

* Mon Nov 03 2014 Raphael Groner <projects.rg [AT] smart.ms> - 0-0.4.20141102gite7766f1
- proper usage of macro python2_sitelib
- comment about strange location for redistributed font

* Sun Nov 02 2014 Raphael Groner <projects.rg [AT] smart.ms> - 0-0.3.20141102gite7766f1
- new snapshot: license change for font

* Wed Oct 29 2014 Raphael Groner <projects.rg [AT] smart.ms> - 0-0.2.20141010git853fdd0
- fix Requires
- fix description
- preserve timestamps

* Sat Oct 11 2014 Raphael Groner <projects.rg [AT] smart.ms> - 0-0.1.20141010git853fdd0
- initial