File python-tornado.spec of Package python-tornado

#
# spec file for package python-tornado
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%global with_python3 1
%global pkgname tornado

Name:           python-%{pkgname}
Version:        4.2.1
Release:        1%{?dist}
Summary:        Scalable, non-blocking web server and tools
License:        Apache-2.0
Group:          Development/Libraries

URL:            http://www.tornadoweb.org
Source0:        https://pypi.python.org/packages/source/t/tornado/tornado-%{version}.tar.gz
# Patch to use system CA certs instead of certifi
Patch0:         python-tornado-cert.patch

BuildRequires:  python2-devel
%if 0%{?fedora} < 22
BuildRequires:  python2-backports-ssl_match_hostname
Requires:       python2-backports-ssl_match_hostname
%endif
Requires:       python2-pycurl
%if 0%{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
%endif

%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.

%package doc
Summary:        Examples for python-tornado
Group:          Documentation
Requires:       python-tornado = %{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.

%if 0%{?with_python3}
%package -n python3-tornado
Summary:        Scalable, non-blocking web server and tools
Group:          Development/Libraries

%description -n python3-tornado
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.

%package -n python3-tornado-doc
Summary:        Examples for python-tornado
Group:          Documentation
Requires:       python3-tornado = %{version}-%{release}

%description -n python3-tornado-doc
Tornado is an open source version of the scalable, non-blocking web
server and and tools. This package contains some example applications.

%endif # with_python3

%prep 
%setup -q -n %{pkgname}-%{version}
%patch0 -p1 -b .cert
# remove shebang from files
%{__sed} -i.orig -e '/^#!\//, 1d' *py tornado/*.py tornado/*/*.py

%build
%if 0%{?with_python3}
%py3_build
%endif # with_python3
%py2_build

%install
%if 0%{?with_python3}
%py3_install
%endif # with_python3
%py2_install

##%check
##%if 0%{?with_python3}
##PYTHONPATH=%{python3_sitearch} %{__python3} -m tornado.test.runtests --verbose
##%endif # with_python3
##PYTHONPATH=%{python2_sitearch} %{__python2} -m tornado.test.runtests --verbose

%files
%doc README.rst

%{python2_sitearch}/%{pkgname}/
%{python2_sitearch}/%{pkgname}-%{version}-*.egg-info

%files doc
%doc demos

%if 0%{?with_python3}
%files -n python3-tornado
%doc README.rst

%{python3_sitearch}/%{pkgname}/
%{python3_sitearch}/%{pkgname}-%{version}-*.egg-info

%files -n python3-tornado-doc
%doc demos
%endif

%changelog
openSUSE Build Service is sponsored by