File python-empy.spec of Package python-empy
%if 0%{?fedora} > 12
%global with_python3 1
%else
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif
%global tarname empy
Name: python-empy
Version: 3.3.2
Release: 2%{?dist}
Summary: A powerful and robust template system for Python
Group: Development/Languages
License: LGPLv2+
URL: http://www.alcyone.com/software/empy/
Source: http://www.alcyone.com/software/%{tarname}/%{tarname}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: python2-devel python-setuptools
%if 0%{?with_python3}
BuildRequires: python3-devel python-setuptools
%endif # if with_python3
%description
EmPy is a system for embedding Python expressions and statements in template
text; it takes an EmPy source file, processes it, and produces output.
%if 0%{?with_python3}
%package -n python3-empy
Summary: A powerful and robust template system for Python
Group: Development/Languages
%description -n python3-empy
EmPy is a system for embedding Python expressions and statements in template
text; it takes an EmPy source file, processes it, and produces output.
%endif # with_python3
%prep
%setup -q -n %{tarname}-%{version}
#fix shebang on rpmlint
sed -i -e '1d' em.py
%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|#!%{__python}|'
%build
CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
popd
%endif # with_python3
%install
rm -rf %{buildroot}
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
%endif # with_python3
%{__python2} setup.py install --skip-build --root $RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
%files
%doc COPYING README version.txt
%{python2_sitelib}/*
%if 0%{?with_python3}
%files -n python3-empy
%doc COPYING README version.txt
%{python3_sitelib}/*
%endif # with_python3
%changelog
* Sat Mar 08 2014 Filipe Rosset <rosset.filipe@gmail.com> - 3.3.2-2
- Fix packaging issues, spec cleanup
- Now compatible with python2 and python3 rhbz #1073768
* Fri Mar 07 2014 Filipe Rosset <rosset.filipe@gmail.com> - 3.3.2-1
- Update to 3.3.2
* Fri Jan 24 2014 Orion Poplawski <orion@cora.nwra.com> - 3.3.1-1
- Update to 3.3.1
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.3-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.3-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild