%if 0%{?rhel} && 0%{?rhel} <= 6 %{!?__python2: %global __python2 /usr/bin/python2} %{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %endif %if 0%{?fedora} > 12 # Disable the python3 subpackage for the moment as it doesn't compile %global with_python3 0 %endif %global modname schema Name: python-schema Version: 0.3.1 Release: 2%{?dist} Summary: Simple data validation library Group: Development/Libraries License: MIT URL: http://pypi.python.org/pypi/schema Source0: http://pypi.python.org/packages/source/s/%{modname}/%{modname}-%{version}.tar.gz BuildArch: noarch BuildRequires: python2-devel BuildRequires: python-setuptools %if 0%{?with_python3} BuildRequires: python3-devel BuildRequires: python3-setuptools %endif # if with_python3 %description Schema validation just got Pythonic schema is a library for validating Python data structures, such as those obtained from config-files, forms, external services or command-line parsing, converted from JSON/YAML (or something else) to Python data-types. %if 0%{?with_python3} %package -n python3-schema Summary: Simple data validation library %description -n python3-schema Schema validation just got Pythonic schema is a library for validating Python data structures, such as those obtained from config-files, forms, external services or command-line parsing, converted from JSON/YAML (or something else) to Python data-types. %endif # with_python3 %prep %setup -q -n %{modname}-%{version} # Remove bundled egg-info in case it exists rm -rf %{modname}.egg-info %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' %endif # with_python3 find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|' %build %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py build popd %endif # with_python3 %{__python2} setup.py build %install %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install -O1 --skip-build --root=%{buildroot} popd %endif # with_python3 %{__python2} setup.py install -O1 --skip-build --root=%{buildroot} %check %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py test popd %endif # with_python3 %{__python2} setup.py test %files %doc README.rst LICENSE-MIT %{python2_sitelib}/%{modname}.py* %{python2_sitelib}/%{modname}-%{version}* %if 0%{?with_python3} %files -n python3-schema %doc README.rst LICENSE-MIT %{python3_sitelib}/%{modname}.py* %{python3_sitelib}/%{modname}-%{version}* %{_bindir}/easy_install-3.1 %endif # with_python3 %changelog * Mon Sep 01 2014 Pierre-Yves Chibon - 0.3.1-2 - Clean python macro at the top - Add the python3- subpackage * Tue Aug 26 2014 Pierre-Yves Chibon - 0.3.1-1 - initial package for Fedora