# sitelib for noarch packages, sitearch for others (remove the unneeded one) %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %global summ Interactive “data cursors” for matplotlib %global srcname mpldatacursor Name: python-%srcname Version: 0.6.2 Release: 1%{?dist} Summary: %summ License: MIT URL: https://pypi.python.org/pypi/%srcname Source0: https://files.pythonhosted.org/packages/source/e/%srcname/%srcname-%version.tar.gz BuildArch: noarch BuildRequires: python2-devel python%{?fedora:2}-matplotlib %{?fedora:BuildRequires: python3-devel python3-matplotlib} %global desc \ mpldatacursor provides interactive “data cursors” (clickable\ annotation boxes) for matplotlib. %description %desc %package -n python2-%srcname Summary: %summ Requires: python%{?fedora:2}-matplotlib %{?python_provide:%python_provide python2-%srcname} %description -n python2-%srcname %desc %if 0%{?fedora} %package -n python3-%srcname Summary: summ Requires: python3-matplotlib %{?python_provide:%python_provide python3-%srcname} %description -n python3-%srcname An python module which provides a convenient example. %endif %prep %setup -q -n %srcname-%version %build %py2_build %{?fedora:%py3_build} %install %py2_install %{?fedora:%py3_install} %check %__python2 setup.py test %if 0 # failing with # TypeError: calling returned , not a test %{?fedora:%__python3 setup.py test} %endif %files -n python2-%srcname %license LICENSE %doc README.rst changelog.rst examples %python2_sitelib/* %if 0%{?fedora} %files -n python3-%srcname %license LICENSE %doc README.rst changelog.rst examples %python3_sitelib/* %endif %changelog * Sat Feb 17 2018 - 0.6.2-1 - Initial packaging