%define name python3-tornado %define srcname tornado %define version 4.5.3 %define release 1 # Tests by default. No tests: rpm -ba --define 'dotests 0' *.spec %{!?dotests: %define dotests 1} # Configure tests for gcc first, so default is GCC if installed on the machine # To force gcc : --define 'gcc_compiler=x' # To use XLC : --define 'gcc_compiler=0' %{!?gcc_compiler: %define gcc_compiler 1} %{!?default_bits: %define default_bits 64} # Needs care because default command python may be linked to 32 or 64 bit python # and compiler/loader options are not the same, e.g. -maix32/-maix64 # Also, although # /usr/bin/python_64 eventually links to /opt/freeware/bin/python2.7_64 # /usr/bin/python_32 links to inexistant /opt/freeware/bin/python2_32 # So, use /opt/freeware/bin/python2.7 and /opt/freeware/bin/python2.7_64 %define is_python %(test -e /opt/freeware/bin/python3_32 && echo 1 || echo 0) %if %{is_python} %define python_sitelib %(/opt/freeware/bin/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 /opt/freeware/bin/python3_64 && echo 1 || echo 0) %if %{is_python_64} %define python_sitelib64 %(/opt/freeware/bin/python3 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))") %endif Name: %{name} Version: %{version} Release: %{release} Summary: Scalable, non-blocking web server and tools Group: Development/Libraries License: ASL 2.0 URL: http://www.tornadoweb.org Source0: https://files.pythonhosted.org/packages/source/t/tornado/tornado-%{version}.tar.gz Patch1: tornado-test-error.patch Prefix: %{_prefix} BuildRequires: python3-devel >= 3.7.3 %description Tornado is an open source version of the scalable, non-blocking web server and tools. The framework is distinct from most mainstream web server frameworks (and certainly most Python frameworks) because it is non-blocking and reasonably fast. Because it is non-blocking and uses epoll, it can handle thousands of simultaneous standing connections, which means it is ideal for real-time web services. %if %{gcc_compiler} == 1 This version has been compiled with GCC. %else This version has been compiled with XLC. %endif %package doc Summary: Examples for python-tornado Group: Documentation Obsoletes: python-%{srcname}-doc < 4.2.1-3 Provides: python-%{srcname}-doc = %{version}-%{release} %description doc Tornado is an open source version of the scalable, non-blocking web server and and tools. This package contains some example applications. %prep %setup -q -n %{srcname}-%{version} %patch1 -p0 echo "dotests=%{dotests}" echo "default_bits=%{default_bits}" echo "gcc_compiler=%{gcc_compiler}" # Filter interpreter string - typically #!/usr/bin/env python sed -i.orig -e '/^#!\//, 1d' *py tornado/*.py tornado/*/*.py %if 0%{?_with_python3} rm -rf %{py3dir} cp -a . %{py3dir} %endif # with_python3 %build # Choose XLC or GCC %if %{gcc_compiler} == 1 export CC__="/opt/freeware/bin/gcc" export FLAG64="-maix64" echo "CC Version:" $CC__ --version %else export CC__="xlc_r" export FLAG32="-q32" export FLAG64="-q64" echo "CC Version:" $CC__ -qversion %endif type $CC__ export CC64=" ${CC__} ${FLAG64}" /opt/freeware/bin/python3 setup.py build %install [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT /opt/freeware/bin/python3 setup.py install --skip-build --root ${RPM_BUILD_ROOT} if [ "%{dotests}" == 1 ] then (/opt/freeware/bin/python3 -m tornado.test.runtests --verbose || true) fi %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files -n python3-%{srcname} %defattr(-,root,system,-) %{python_sitelib64}/* %files doc %doc demos %doc README.rst %changelog * Tue Feb 25 2020 Baanu Tumma - 4.5.3-1 - Updated to 4.5.3 version, built using python3 * Wed Sep 20 2017 Ravi Hirekurabar - 4.5.1-1 - Updated to 4.5.1 * Mon May 22 2017 Michael Wilson - 4.4.2-1 - Update to version 4.4.2 * Fri Nov 21 2014 Gerard Visiedo - 4.0.2-1 - First version for AIX V6.1 and higher