%global pname pykwalify # Python3 support in OpenStack starts with version 3.5, # which is only in Fedora 24+ %if 0%{?fedora} >= 24 %global with_python3 1 %global default_python 3 %else %global default_python 2 %endif Name: python-%{pname} Version: 1.5.1 Release: 2%{?dist} Summary: Python lib/cli for JSON/YAML schema validation License: MIT URL: http://github.com/grokzen/pykwalify Source0: https://files.pythonhosted.org/packages/source/p/%{pname}/%{pname}-%{version}.tar.gz BuildArch: noarch BuildRequires: python2-devel BuildRequires: python-setuptools BuildRequires: python3-devel BuildRequires: python3-setuptools %description It is a YAML/JSON validation library. This framework is a port with a lot added functionality of the java version of the framework kwalify that can be found at: http://www.kuwata-lab.com/kwalify/ %package -n python2-%{pname} Summary: Python lib/cli for JSON/YAML schema validation %{?python_provide:%python_provide python2-%{pname}} Requires: python-docopt Requires: PyYAML Requires: python-dateutil Requires: python-setuptools %description -n python2-%{pname} It is a YAML/JSON validation library. This framework is a port with a lot added functionality of the java version of the framework kwalify that can be found at: http://www.kuwata-lab.com/kwalify/ %if 0%{?with_python3} %package -n python3-%{pname} Summary: Python lib/cli for JSON/YAML schema validation %{?python_provide:%python_provide python3-%{pname}} Requires: python3-docopt Requires: python3-PyYAML Requires: python3-dateutil Requires: python3-setuptools %description -n python3-%{pname} It is a YAML/JSON validation library. This framework is a port with a lot added functionality of the java version of the framework kwalify that can be found at: http://www.kuwata-lab.com/kwalify/ %endif %prep %autosetup -n %{pname}-%{version} rm -rf *.egg-info %build %py2_build %if 0%{?with_python3} %py3_build %endif %install %py2_install mv %{buildroot}%{_bindir}/%{pname} %{buildroot}%{_bindir}/python2-%{pname} %if 0%{?with_python3} %py3_install mv %{buildroot}%{_bindir}/%{pname} %{buildroot}%{_bindir}/python3-%{pname} %endif %if 0%{?default_python} >= 3 ln -s %{_bindir}/python3-%{pname} %{buildroot}%{_bindir}/%{pname} %else ln -s %{_bindir}/python2-%{pname} %{buildroot}%{_bindir}/%{pname} %endif %files -n python2-%{pname} %license docs/License.txt %doc README.md %if 0%{?default_python} <= 2 %{_bindir}/%{pname} %endif %{_bindir}/python2-%{pname} %{python2_sitelib}/%{pname} %{python2_sitelib}/%{pname}-%{version}-py?.?.egg-info %if 0%{?with_python3} %files -n python3-%{pname} %license docs/License.txt %doc README.md %if 0%{?default_python} >= 3 %{_bindir}/%{pname} %endif %{_bindir}/python3-%{pname} %{python3_sitelib}/%{pname} %{python3_sitelib}/%{pname}-%{version}-py?.?.egg-info %endif %changelog * Mon Oct 17 2016 Chandan Kumar - 1.5.1-2 - Removed versions of BR - Removed unnecessary files * Thu Oct 13 2016 Chandan Kumar - 1.5.1-1 - Initial package.