%define	pyver		%(python -c 'import sys;print(sys.version[0:3])')

Name:		pyxdg
Summary:	Python library to access freedesktop.org standards
Summary(ja): 	freedesktop.org 標準にアクセスする為の Python ライブラリ
Version:	0.25
Release: 	2%{?_dist_release}

License:	LGPL
Group:		System Environment/Libraries
URL:		http://freedesktop.org/Software/pyxdg

Source0:	http://www.freedesktop.org/~lanius/%{name}-%{version}.tar.gz

# https://bugs.freedesktop.org/show_bug.cgi?id=61817
Patch0:		pyxdg-0.25-find-first-mimetype-match.patch
# https://bugs.freedesktop.org/show_bug.cgi?id=73878
Patch1:		pyxdg-0.25-CVE-2014-1624.patch

BuildArch:	noarch
BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires:	python
BuildRequires:	python-devel
BuildRequires:	python3
BuildRequires:	python3-devel
BuildRequires:	hicolor-icon-theme
BuildRequires:	shared-mime-info
BuildRequires:  python-rpm-macros
BuildRequires:  python3-rpm-macros
Requires:	python


%description
PyXDG is a Python library to access freedesktop.org standards.

%description -l ja
PyXDG は freedesktop.org のデスクトップ標準にアクセスする為の
Python ライブラリです。

%package -n python3-pyxdg
Summary:	Python library to access freedesktop.org standards
Summary(ja): 	freedesktop.org 標準にアクセスする為の Python ライブラリ
Requires:	python3

%description -n python3-pyxdg
PyXDG is a Python library to access freedesktop.org standards.

%description -n python3-pyxdg -l ja
PyXDG は freedesktop.org のデスクトップ標準にアクセスする為の
Python ライブラリです。


%prep
%setup -q
%patch0 -p1 -b .pngfix
%patch1 -p1 -b .CVE-2014-1624


%build
%py_build
%py3_build


%install
%{__rm} -rf %{buildroot}
%py3_install
%py_install


%clean
%{__rm} -rf ${RPM_BUILD_ROOT}


%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog INSTALL PKG-INFO README TODO
%license COPYING
%doc AUTHORS ChangeLog README TODO
%{python_sitelib}/xdg
%{python_sitelib}/pyxdg-*.egg-info

%files -n python3-pyxdg
%license COPYING
%doc AUTHORS ChangeLog README TODO
%{python3_sitelib}/xdg
%{python3_sitelib}/pyxdg-*.egg-info

%changelog
* Sun Dec 17 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.25-2
- added Patch0,1.
- added a sub-package for python3.
- made to use python{,3}-rpm-macros.

* Fri Oct  3 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 0.25-1
- updated to 0.25

* Sun Feb 19 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.19-2
- rebuild with python-2.7.2

* Sat Jan 28 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> 0.19-1
- new upstream release
- added patch0 from Debian

* Wed Feb 03 2010 Shu KONNO <owa@bg.wakwak.com> 0.17-2
- rebuilt with python-2.6.4
- fixed site-packages directory

* Fri Nov 07 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.17-1
- initial build for Vine Linux
