Blob Blame History Raw
%global srcname mpd2

# RHEL-7 doesn't have python 3
%if 0%{?rhel} == 7
  %global with_python3 0
%else
  %global with_python3 1
%endif

Name:           python-%{srcname}
Version:        0.5.5
Release:        4%{?dist}
Summary:        Python library providing a client interface for MPD

License:        LGPLv3+
URL:            https://github.com/Mic92/python-mpd2
Source0:        https://github.com/Mic92/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz

BuildArch:      noarch

%description
Python library providing a client interface for MPD.

%package -n python2-%{srcname}
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
BuildRequires:  python2-sphinx
BuildRequires:  python2-mock
BuildRequires:  python2-tox
BuildRequires:  python2-twisted
# Has the same Python module name in Python2 namespace.
Conflicts:      python-mpd
Summary:        %{summary}
%{?python_provide:%python_provide python2-%{srcname}}

%description -n python2-%{srcname}
Python library providing a client interface for MPD.

%if %{with_python3}
%package -n python3-%{srcname}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-mock
BuildRequires:  python3-tox
BuildRequires:  python3-twisted
Summary:        Python 3 mpd2 module
%{?python_provide:%python_provide python3-%{srcname}}

%description -n python3-%{srcname}
Python3 library providing a client interface for MPD.
%endif


%package doc
Summary:    Documentation for %{name}

%description doc
This package contains documentation for %{name}



%prep
%autosetup -n %{name}-%{version}
rm -frv %{srcname}.egg-info


%build
%py2_build
# only make docs once
pushd doc
    make html
    find . -name ".buildinfo" -exec rm -f '{}' \;
popd

%py3_build


%install
%py2_install
rm $RPM_BUILD_ROOT/%{python_sitelib}/mpd_test.py*


%if %{with_python3}
%py3_install
rm $RPM_BUILD_ROOT/%{python3_sitelib}/mpd_test.py*
rm $RPM_BUILD_ROOT/%{python3_sitelib}/__pycache__/mpd_test*
%endif

%check
TOX_TESTENV_PASSENV=PYTHONPATH TOXENV=py27 %{__python2} setup.py test
%if %{with_python3}
TOX_TESTENV_PASSENV=PYTHONPATH TOXENV=py36 %{__python3} setup.py test
%endif

%files -n python2-%{srcname}
%doc README.rst
%license LICENSE.txt
%{python2_sitelib}/*%{srcname}-%{version}-py2.?.egg-info/
%{python2_sitelib}/mpd.py*

%if %{with_python3}
%files -n python3-%{srcname}
%doc README.rst
%license LICENSE.txt
%{python3_sitelib}/*%{srcname}-%{version}-py3.?.egg-info/
%{python3_sitelib}/mpd.py
%{python3_sitelib}/__pycache__/mpd.*
%endif

%files doc
%doc doc/_build/html


%changelog
* Wed Nov 01 2017 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.5.5-4
- Use versioned python build requires

* Sat Oct 28 2017 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.5.5-3
- Use git tags instead of commit info

* Sat Oct 28 2017 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.5.5-2
- Changes based on suggestions in review ticket #1507235
- Improve summary
- Add tests
- Redo release string

* Sun Aug 21 2016 Kushal Das <kushal@fedoraproject.org> 0.5.5-1
- Initial package