%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}

Name: usbmanager
Version: 1.0.0
Release: 2%{?_dist_release}
Summary:	An USB storage management interface written in Python
Summary(ja): Python で書かれた USB ストレージ管理インターフェイス

Group: Applications/System
License: LGPLv3
URL:	 https://launchpad.net/usbmanager
Source0:	%{name}-%{version}.tar.gz
Source1:	%{name}_ja.po

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildArch: noarch

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

Requires:	dbus-python
Requires:	gksu
Requires:	python pygtk2
Requires:	mtools
Requires:	dbus hal

%description
USBManager is a simple and intuitive tool developed to help people
who have hard times managing theirs USB storage devices.

%description -l ja
USBManager は USB ストレージデバイスの管理に手を焼く人々を
助けるために開発されたシンプルで直感的なツールです。

%prep
%setup -q -n %{name}
cp -f %{SOURCE1} locale/ja.po

%build
# build Japanese language file before setup, 
# if Japanese translation file is merged, this command will delete.
msgfmt -o locale/ja.mo locale/ja.po

python setup.py build

%install
rm -rf %{buildroot}
python setup.py install --skip-build --root %{buildroot}

# maybe disused file?
rm -rf %{buildroot}/root/

%find_lang %{name}

desktop-file-install \
	--dir %{buildroot}%{_datadir}/applications data/%{name}.desktop

%clean
rm -rf %{buildroot}

%post
touch --no-create %{_datadir}/icons/hicolor || :
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
update-desktop-database %{_datadir}/applications

%postun
touch --no-create %{_datadir}/icons/hicolor || :
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
update-desktop-database %{_datadir}/applications

%files -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS COPYING ChangeLog NEWS README TODO
%{_bindir}/%{name}
#%{_libdir}/python2.*/site-packages/*
%{python_sitelib}/
%{_datadir}/applications/*.desktop
%{_datadir}/icons/*

%changelog
* Fri Jan 14 2011 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.0.0-2
- added source1 to translate Japanese
- used python macro
- added BuildRequires: gettext
- added Requires: dbus-python, gksu

* Sat Mar 13 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.0.0-1
- initial build for VineSeed
