%{!?dotests: %define dotests 1} %define name python3-cheetah3 %define srcname Cheetah3 %define version 3.2.4 %define release 1 %define is_python %(test -e /usr/bin/python3_32 && echo 1 || echo 0) %if %{is_python} %define python_sitelib %(python3_32 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))") %endif %define _libdir64 %{_prefix}/lib64 %define is_python_64 %(test -e /usr/bin/python3_64 && echo 1 || echo 0) %if %{is_python_64} %define python_sitelib64 %(python3_64 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))") %endif Summary: Template engine and code generator Name: %{name} Version: %{version} Release: %{release} Source0: http://pypi.python.org/packages/source/C/Cheetah/%{srcname}-%{version}.tar.gz Url: http://cheetahtemplate.org License: MIT Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Prefix: %{_prefix} BuildRequires: python3 >= 3.7.4-1 BuildRequires: python3-devel >= 3.7.4-1 #To run testcases, python-markdown is required. Install the same using following command # python3 -m pip install markdown BuildRequires: python3-pygments >= 2.4.2-1 Requires: python3 >= 3.7.4-1 %description Cheetah is an open source template engine and code generation tool, written in Python. It can be used standalone or combined with other tools and frameworks. Web development is its principal use, but Cheetah is very flexible and is also being used to generate C++ code, Java, SQL, form emails and even Python code. %prep %setup -q -n %{srcname}-%{version} %build export OBJECT_MODE=64 python3_64 setup.py build %install [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT python3_64 setup.py install -O1 --skip-build --root ${RPM_BUILD_ROOT} if [ %{dotests} == 1 ];then export PATH="%{buildroot}/%{_bindir}:$PATH" export PYTHONPATH="%{buildroot}/%{python_sitelib64}" %{buildroot}/%{_bindir}/cheetah test fi ( cd $RPM_BUILD_ROOT%{_bindir} for f in * do mv $f $f-3 done ) %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system,-) %doc README.rst LICENSE PKG-INFO TODO %{_bindir}/* %{python_sitelib64}/* %changelog * Tue Jan 21 2020 Reshma V Kumar - 3.2.4-1 - Update to latest version - Build with python3 * Thu May 11 2016 Ravi Hirekurabar - 2.4.4-1 - Initial Port.