%global name3 python3-mpd2 # RHEL-7 doesn't have python 3 %if 0%{?rhel} == 7 %global with_python3 0 %else %global with_python3 1 %endif Name: python-mpd2 Version: 0.5.5 Release: 1%{?dist} Summary: It is a Python library which provides a client interface for MPD Group: Development/Languages License: LGPLv2+ URL: https://github.com/Mic92/python-mpd2 Source0: https://pypi.python.org/packages/45/1b/7d547aa74c0dc6573a069dcc3bd4c4a000725f1f0121472948d0ef3f3ab3/python-mpd2-0.5.5.tar.gz BuildArch: noarch BuildRequires: python2-devel, python-setuptools %if %{with_python3} BuildRequires: python3-devel BuildRequires: python3-setuptools %endif Provides: python2-mpd2 = %{version}-%{release} # Has the same Python module name in Python2 namespace. Conflicts: python-mpd %description It is a Python library which provides a client interface for MPD. %if %{with_python3} %package -n %{name3} Summary: Python 3 mpd2 module Provides: python3-mpd2 = %{version}-%{release} %description -n %{name3} Python3 module which provides a client interface for MPD. %endif %prep %setup -q -n python-mpd2-%{version} %if %{with_python3} # Create Python 3 source tree rm -rf %{py3dir} cp -a . %{py3dir} %endif %build %{__python} setup.py build %if %{with_python3} # Build Python 3 modules pushd %{py3dir} %{__python3} setup.py build %endif %install rm -rf $RPM_BUILD_ROOT %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT rm $RPM_BUILD_ROOT/%{python_sitelib}/mpd_test.py* %if %{with_python3} # Install Python 3 modules pushd %{py3dir} %{__python3} setup.py install --skip-build --root %{buildroot} rm $RPM_BUILD_ROOT/%{python3_sitelib}/mpd_test.py* rm $RPM_BUILD_ROOT/%{python3_sitelib}/__pycache__/mpd_test* popd %endif %files %defattr(-,root,root,-) %doc LICENSE.txt # For noarch packages: sitelib %{python_sitelib}/mpd* %{python_sitelib}/*.egg-info* %if %{with_python3} %files -n %{name3} %doc LICENSE.txt %{python3_sitelib}/mpd* %{python3_sitelib}/__pycache__/* %{python3_sitelib}/*.egg-info* %endif %changelog * Sun Aug 21 2016 Kushal Das 0.5.5-1 - Initial package