%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %if 0%{?fedora} %global with_python3 1 %{!?python3_version: %global python3_version %(%{__python3} -c "import sys; sys.stdout.write(sys.version[:3])")} %endif # pygments is at 1.1.1 in rhel6 %if 0%{?rhel} == 6 %global skip_tests -pygments %endif %if 0%{?rhel} == 7 %global python3_pkgver 34 %global srcname cfn_flip %else %global python3_pkgver 3 %endif %global pypi_name cfn_flip Name: python-%{pypi_name} Version: 0.3.0 Release: 1%{?dist} Summary: Convert AWS CloudFormation templates between JSON and YAML formats License: Apache2 URL: https://pypi.python.org/pypi/%{pypi_name} Source0: https://pypi.python.org/packages/%{pypi_name}-%{version}.tar.gz # Source0: https://pypi.python.org/pypi/%{pypi_name}/%{version} BuildArch: noarch BuildRequires: python-devel BuildRequires: pytest BuildRequires: libyaml-devel BuildRequires: python%{python3_pkgver}-devel BuildRequires: python%{python3_pkgver}-setuptools %description Convert AWS CloudFormation templates between JSON and YAML formats %package -n python%{python3_pkgver}-%{pypi_name} Summary: Convert AWS CloudFormation templates between JSON and YAML formats %{?python_provide:%python_provide python34-%{srcname}} %description -n python%{python3_pkgver}-%{pypi_name} Convert AWS CloudFormation templates between JSON and YAML formats %prep %setup -qc -n %{pypi_name}-%{version} mv %{pypi_name}-%{version} python2 cp -a python2 python3 %build pushd python2 %py2_build popd pushd python3 %py3_build popd %install pushd python2 %py2_install # remove shebangs and fix permissions find %{buildroot}%{python2_sitelib} \( -name '*.py' -o -name 'py.*' \) \ -exec sed -i '1{/^#!/d}' {} \; \ -exec chmod u=rw,go=r {} \; # rename binary mv %{buildroot}%{_bindir}/cfn-flip{,-%{python2_version}} ln -s cfn-flip-%{python2_version} %{buildroot}%{_bindir}/cfn-flip-2 popd pushd python3 %py3_install # remove shebangs and fix permissions find %{buildroot}%{python3_sitelib} \( -name '*.py' -o -name 'py.*' \) \ -exec sed -i '1{/^#!/d}' {} \; \ -exec chmod u=rw,go=r {} \; # rename binary mv %{buildroot}%{_bindir}/cfn-flip{,-%{python3_version}} ln -s cfn-flip-%{python3_version} %{buildroot}%{_bindir}/cfn-flip-3 popd # 2.X binary is called by default for now ln -s cfn-flip-%{python2_version} %{buildroot}%{_bindir}/cfn-flip %check # %{__python2} setup.py test # %{__python3} setup.py test %files %doc python2/README.md # %license LICENSE %{python2_sitelib}/%{pypi_name} %{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info %{_bindir}/cfn-flip %{_bindir}/cfn-flip-2 %{_bindir}/cfn-flip-%{python2_version} %files -n python%{python3_pkgver}-%{pypi_name} %doc python3/README.md #%license LICENSE %{python3_sitelib}/%{pypi_name} %{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info %{_bindir}/cfn-flip-3 %{_bindir}/cfn-flip-%{python3_version} %changelog * Tue Nov 28 2017 Aram Minasyan - 0.3.0-1 - Update to 0.3.0 version. * Tue Nov 28 2017 Aram Minasyan - 0.2.5-1 - Initial RPM Package.