%if 0%{?rhel}
%global with_python3 0
%else
%global with_python3 1
%endif
# Created by pyp2rpm-1.1.1
%global pypi_name anymarkup
%global srcname anymarkup
%global modulename anymarkup
Name: python-%{srcname}
Version: 0.4.3
Release: 2%{?dist}
Summary: Parse or serialize any markup in Python
License: BSD
URL: https://github.com/bkabrda/anymarkup
Source0: https://pypi.python.org/packages/source/a/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: pytest
BuildRequires: python-configobj python-six python-xmltodict PyYAML
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pytest
%endif
Requires: python-configobj python-six python-xmltodict PyYAML
%description
%{summary}
Currently supports ini, json, xml and yaml.
%if 0%{?with_python3}
%package -n python3-%{srcname}
Summary: %{summary}
BuildRequires: python3-configobj
BuildRequires: python3-six
BuildRequires: python3-xmltodict
BuildRequires: python3-PyYAML
Requires: python3
Requires: python3-configobj
Requires: python3-six
Requires: python3-xmltodict
Requires: python3-PyYAML
%description -n python3-%{srcname}
%{summary}
Currently supports ini, json, xml and yaml.
%endif
%prep
%setup -q -n %{pypi_name}-%{version}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info
%if 0%{?with_python3}
echo %{py3dir}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build
%{__python2} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif
%install
%{__python2} setup.py install --skip-build --root %{buildroot}
%if 0%{?with_python3}
%py_byte_compile %{__python2} %{buildroot}%{python_sitelib}/%{srcname}
%else
# py_byte_compile is only defined in python3-devel
%{__python2} -m compileall %{buildroot}%{python_sitelib}/%{srcname}
%endif
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
%py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/%{srcname}
popd
%endif
%check
%{__python2} -m pytest
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} -m pytest
popd
%endif
%files
%if 0%{?fedora}
%license LICENSE
%else
%if 0%{?rhel} < 7
%doc LICENSE
%else
%license LICENSE
%endif
%endif
%doc README.rst
%{python2_sitelib}/%{modulename}
%{python2_sitelib}/%{modulename}-%{version}-py?.?.egg-info
%if 0%{?with_python3}
%files -n python3-%{srcname}
%license LICENSE
%doc README.rst
%{python3_sitelib}/%{modulename}-%{version}-py%{python3_version}.egg-info
%{python3_sitelib}/%{modulename}/
%endif
%changelog
* Mon Jul 27 2015 jchaloup <jchaloup@redhat.com> - 0.4.3-2
- Tests are not shipped in rpm => no need for pytest as a runtime dependency
resolves: #1247079
* Wed Jun 17 2015 jchaloup <jchaloup@redhat.com> - 0.4.3-1
- Update to 0.4.3
resolves: #1232519
* Thu May 21 2015 jchaloup <jchaloup@redhat.com> - 0.4.2-1
- Initial package
resolves: #1223843