File python3-python-mpd2.spec of Package python3-python-mpd2

#
# spec file for package python3-python-mpd2
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/


%define modname python-mpd2
Name:           python3-%{modname}
Version:        0.5.5
Release:        0
License:        LGPL-3.0
Summary:        A Python MPD client library
Url:            https://github.com/Mic92/python-mpd2
Group:          Development/Languages/Python
Source:         https://files.pythonhosted.org/packages/source/p/python-mpd2/python-mpd2-%{version}.tar.bz2
Source1:        tox.ini
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
# test requirements
BuildRequires:  python3-tox
BuildRequires:  python3-pluggy
BuildRequires:  python3-mock
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
python-mpd2 is a Python library which provides a client interface for
the Music Player Daemon <http://musicpd.org>.

Difference with python-mpd
--------------------------

python-mpd2 is a fork of `python-mpd`_.  While 0.4.x was backwards compatible
with python-mpd, starting with 0.5 provides enhanced features which are *NOT*
backward compatibles with the original `python-mpd`_ package.  (see PORTING.txt
for more information)

The following features were added:

-  Python 3 support (but you need at least Python 2.6)
-  support for the upcoming client-to-client protocol
-  support for new commands from MPD (seekcur, prio, prioid,
   config, searchadd, searchaddpl, listfiles, rangeid, addtagid, cleartagid,
   mount, umount, listmounts, listneighbors)
-  remove deprecated commands (volume)
-  explicitly declared MPD commands (which is handy when using for
   example IPython <http://ipython.org>)
-  a test suite
-  API documentation to add new commands (see Future Compatible <http://pythonhosted.org/python-mpd2/topics/advanced.html#future-compatible>)
-  support for Unicode strings in all commands (optionally in python2,
   default in python3 - see Unicode Handling <http://pythonhosted.org/python-mpd2/topics/advanced.html#unicode-handling>)
-  configureable timeouts
-  support for logging <http://pythonhosted.org/python-mpd2/topics/logging.html>
-  improved support for sticker
-  improved support for ranges

%prep
%setup -q -n %{modname}-%{version}
cp %{S:1} .

%build
python3 setup.py build

%install
python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}

%check
# Set the encoding
export LC_CTYPE=C.UTF8

# We only want to test one environment, what we're packaging for
sed -ie "s/^envlist = .*/envlist = py%{py3_ver}/" tox.ini
# And we don't want to declare the mock dependency, so it's not installed from pipy
sed -ie "s/^deps = mock/deps =/" tox.ini

# We need a partially build environment in order to link system packages
# to the test environment so we don't care if the first time it fails.
# We just want the .tox directory structure to be created.
python3 setup.py test || true

# We want to use the system modules in the test environment, so we link
# them in the test environment
pushd .tox/py%{py3_ver}/lib/python%{py3_ver}/site-packages/
ln -s %{python3_sitelib}/mock .
ln -s %{python3_sitelib}/mock-*.egg-info .
ln -s %{python3_sitelib}/six.py .
ln -s %{python3_sitelib}/pbr .
popd

# Now we can run the test
python3 setup.py test

%files
%defattr(-,root,root,-)
%doc README.rst LICENSE.txt
%{python3_sitelib}/__pycache__/*
%{python3_sitelib}/mpd.py
%{python3_sitelib}/mpd_test.py
%{python3_sitelib}/python_mpd2-%{version}-py%{py3_ver}.egg-info


%changelog
openSUSE Build Service is sponsored by