Blob Blame History Raw
# sitelib for noarch packages, sitearch for others (remove the unneeded one)
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}

Name:           pyexiv2
Version:        0.1.2
Release:        3%{?dist}
Summary:        Python binding to exiv2

Group:          Development/Languages
License:        GPLv2+
URL:            http://tilloy.net/dev/pyexiv2/
Source0:        http://tilloy.net/dev/pyexiv2/releases/pyexiv2-%{version}.tar.bz2
# next patch should be removed when
# https://bugs.launchpad.net/pyexiv2/+bug/249513
# is fixed
Patch0:         pyexiv2-multilib.patch
# the same for bug
# https://bugs.launchpad.net/pyexiv2/+bug/249835
Patch1:         pyexiv2-packager.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
      
BuildRequires:  python-devel exiv2-devel boost-devel scons

%description
pyexiv2 is a python binding to exiv2, the C++ library for manipulation
of EXIF and IPTC image metadata. It is a python module that allows your
python scripts to read and write metadata (EXIF, IPTC, thumbnail)
embedded in image files (JPEG, TIFF, ...). 

%prep
%setup -q -n %{name}
%patch0 -p1 -b .multilib
%patch1 -p1 -b .packager

%build
# Remove CFLAGS=... for noarch packages (unneeded)
#CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
export CXXFLAGS="%{optflags}"
export LDFLAGS="%{optflags}"
scons

%install
rm -rf $RPM_BUILD_ROOT
#%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
export CXXFLAGS="%{optflags}"
export LDFLAGS="%{optflags}"
scons DESTDIR=$RPM_BUILD_ROOT install
chmod +x ${RPM_BUILD_ROOT}%{python_sitearch}/pyexiv2.py

%clean
rm -rf $RPM_BUILD_ROOT

%check
# There is unittest/ directory available, but not sure, how
# how to make it work.

%files
%defattr(-,root,root,-)
%doc README ChangeLog COPYING doc/
%{python_sitearch}/*

%changelog
* Fri Jul 18 2008 Matěj Cepl <mcepl@redhat.com> 0.1.2-3
- Fix building system.
- Approved for Fedora 

* Fri Jul 18 2008 Matěj Cepl <mcepl@redhat.com> 0.1.2-2
- Dan's patch to fix compilation flags.

* Thu Jul 17 2008 Matěj Cepl <mcepl@redhat.com> 0.1.2-1
- initial build