File python-Twisted.spec of Package python-Twisted.openSUSE_Leap_15.0_Update
#
# spec file for package python-Twisted
#
# Copyright (c) 2017 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 http://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define oldpython python
%define modname Twisted
Name: python-Twisted
Version: 17.9.0
Release: 0
Summary: An asynchronous networking framework written in Python
License: MIT
Group: Development/Languages/Python
Url: http://twistedmatrix.com/
Source: https://files.pythonhosted.org/packages/source/T/Twisted/%{modname}-%{version}.tar.bz2
# PATCH-FIX-UPSTREAM -- https://twistedmatrix.com/trac/ticket/6280
Patch0: lp1102685.diff
# PATCH-FIX-UPSTREAM 0001-Prevent-CRLF-injections-described-in-CVE-2019-12387.patch -- https://github.com/twisted/twisted/commit/6c61fc4503ae39ab8ecee52d10f10ee2c371d7e2
Patch1: 0001-Prevent-CRLF-injections-described-in-CVE-2019-12387.patch
# PATCH-FIX-UPSTREAM PR-1147.patch -- https://github.com/twisted/twisted/pull/1147
Patch2: PR-1147.patch
BuildRequires: %{python_module constantly}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module hyperlink}
BuildRequires: %{python_module incremental}
BuildRequires: %{python_module pyOpenSSL}
BuildRequires: %{python_module pyserial}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module zope.interface}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-Automat
Requires: python-constantly
Requires: python-hyperlink
Requires: python-incremental
Requires: python-pyOpenSSL
Requires: python-pyasn1
Requires: python-pycrypto
Requires: python-pyserial
Requires: python-zope.interface
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%ifpython2
Provides: %{oldpython}-twisted = %{version}
Obsoletes: %{oldpython}-twisted < %{version}
Provides: %{oldpython}-twisted-core = %{version}
Obsoletes: %{oldpython}-twisted-core < %{version}
Provides: %{oldpython}-twisted-conch = %{version}
Obsoletes: %{oldpython}-twisted-conch < %{version}
Provides: %{oldpython}-twisted-lore = %{version}
Obsoletes: %{oldpython}-twisted-lore < %{version}
Provides: %{oldpython}-twisted-mail = %{version}
Obsoletes: %{oldpython}-twisted-mail < %{version}
Provides: %{oldpython}-twisted-names = %{version}
Obsoletes: %{oldpython}-twisted-names < %{version}
Provides: %{oldpython}-twisted-news = %{version}
Obsoletes: %{oldpython}-twisted-news < %{version}
Provides: %{oldpython}-twisted-runner = %{version}
Obsoletes: %{oldpython}-twisted-runner < %{version}
Provides: %{oldpython}-twisted-web = %{version}
Obsoletes: %{oldpython}-twisted-web < %{version}
Provides: %{oldpython}-twisted-words = %{version}
Obsoletes: %{oldpython}-twisted-words < %{version}
Provides: %{oldpython}-twisted-xish = %{version}
Obsoletes: %{oldpython}-twisted-xish < %{version}
%endif
%python_subpackages
%description
An extensible framework for Python programming, with special focus
on event-based network programming and multiprotocol integration.
%package -n %{name}-doc
Summary: An asynchronous networking framework written in Python - Documentation
Group: Development/Languages/Python
%description -n %{name}-doc
An extensible framework for Python programming, with special focus
on event-based network programming and multiprotocol integration.
This package contains the documentation for python-Twisted
%prep
%setup -q -n %{modname}-%{version}
#%%patch0 -p1
%patch1 -p1
%patch2 -p1
#sed -i "1d" twisted/{mail/test/pop3testserver,trial/test/scripttest}.py
%build
%python_build
%install
%python_install
find %{buildroot} -regex '.*\.[ch]' -exec rm {} ";" # Remove leftover C sources
install -dm0755 %{buildroot}%{_mandir}/man1/
install -m0644 docs/*/man/*.1 %{buildroot}%{_mandir}/man1/ # Install man pages
find docs -type f -print0 | xargs -0 chmod a-x # Fix doc-file dependency by removing x flags
#sed -i "s/\r//" docs/core/howto/listings/udp/{MulticastClient,MulticastServer}.py
%fdupes %{buildroot}%{_prefix}
# Prepare for update-alternatives usage
for p in twistd cftp ckeygen conch pyhtmlizer tkconch trial ; do
%python_clone %{buildroot}%{_bindir}/$p
%python_clone %{buildroot}%{_mandir}/man1/$p.1
done
# update alternatives for parts supported only in python2
%ifpython2
%python_clone %{buildroot}%{_bindir}/mailmail
%python_clone %{buildroot}%{_mandir}/man1/mailmail.1
%endif
# no manpage for twist yet:
%python_clone %{buildroot}%{_bindir}/twist
%files -n %{name}-doc
%defattr(-,root,root,-)
%doc docs/*
%files %{python_files}
%defattr(-,root,root,-)
%doc LICENSE NEWS.rst README.rst
%{_bindir}/*-%{python_bin_suffix}
%{_mandir}/man1/*-%{python_bin_suffix}.1%{?ext_man}
%python3_only %{_bindir}/twistd
%python3_only %{_bindir}/cftp
%python3_only %{_bindir}/ckeygen
%python3_only %{_bindir}/conch
# Supported only in python2
%python2_only %{_bindir}/mailmail
%python3_only %{_bindir}/pyhtmlizer
%python3_only %{_bindir}/tkconch
%python3_only %{_bindir}/trial
%python3_only %{_bindir}/twist
%python3_only %{_mandir}/man1/twistd.1%{?ext_man}
%python3_only %{_mandir}/man1/cftp.1%{?ext_man}
%python3_only %{_mandir}/man1/ckeygen.1%{?ext_man}
%python3_only %{_mandir}/man1/conch.1%{?ext_man}
%python3_only %{_mandir}/man1/mailmail.1%{?ext_man}
%python3_only %{_mandir}/man1/pyhtmlizer.1%{?ext_man}
%python3_only %{_mandir}/man1/tkconch.1%{?ext_man}
%python3_only %{_mandir}/man1/trial.1%{?ext_man}
%{python_sitearch}/*
%changelog