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

Name:		pymunk
Version:	0.8.4
Release:	2%{?dist}
Summary:	Python wrapper for the chipmunk 2D physics engine
Group:		Development/Languages
# pymunx is under GPL+
License:	MIT and GPL+
URL:		http://code.google.com/p/pymunk/
Source0:	http://pymunk.googlecode.com/files/pymunk-%{version}.zip
# Use the shared library provided by the chipmunk package
Patch0:		pymunk-sharedlib.patch
BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires:	python-devel
BuildRequires:	python-setuptools
# Need chipmunk when building to work out the location of the 
# *installed* chipmunk library
BuildRequires:	chipmunk
Requires:	chipmunk >= 4.1.0
BuildArch:	noarch

%description
Pymunk is a Python wrapper for the wrapper for the chipmunk 2D physics
engine.  It aims to be easy to use, "Pythonic", and non-intrusive.

%prep
%setup -q
%patch0 -p0
# Fix newlines -- preserve timestamps
for file in docs/api/*.{html,txt,css,js} examples/*.py *.txt PKG-INFO; do
  sed -e 's/\r//g' $file > $file.new &&
  touch -r $file $file.new &&
  mv $file.new $file
done

# Use libchipmunk.so.N provided by chipmunk
lib=`ls %{_libdir}/libchipmunk.so.* | head -n 1`
sed -i -e "s|/usr/lib/libchipmunk.so|$lib|" pymunk/libload.py

# This source is superfluous
rm -rf chipmunk_src

%build
%{__python} setup.py build

%install
rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
 
%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%{python_sitelib}/%{name}/
%{python_sitelib}/%{name}-*.egg-info/
%doc docs examples LICENSE.txt PKG-INFO THANKS.txt README.txt

%changelog
* Thu Nov 5 2009 Robert Spanton <rspanton@zepler.net> - 0.8.4-2
- Conserve file timestamps when converting newlines

* Thu Nov 5 2009 Robert Spanton <rspanton@zepler.net> - 0.8.4-1
- Bump up to 0.8.4
- Add chipmunk as a build requirement so that shared object discovery 
  works.
- Stop the .dll and .so being installed in the first place
- Merge docs and main package, since docs are small
- Fix license.  pymunx is GPL+

* Sun Jun 21 2009 Robert Spanton <rspanton@zepler.net> - 0.8.2-3
- Put the text files, e.g. LICENSE, in the main package.

* Sun Jun 21 2009 Robert Spanton <rspanton@zepler.net> - 0.8.2-2
- Point to the correct chipmunk library file.
- Include some more documentation

* Thu Jun 18 2009 Robert Spanton <rspanton@zepler.net> - 0.8.2-1
- Initial packaging