File python3-Twisted.spec of Package python3-Twisted
#
# spec file for package python3-Twisted
#
# Copyright (c) 2016 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/
#
Name: python3-Twisted
Version: 16.6.0
Release: 0
Url: http://twistedmatrix.com/
Summary: An asynchronous networking framework written in Python
License: MIT
Group: Development/Languages/Python
Source: https://files.pythonhosted.org/packages/source/T/Twisted/Twisted-%{version}.tar.bz2
# PATCH-FIX-UPSTREAM -- https://twistedmatrix.com/trac/ticket/6280
Patch0: lp1102685.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python3-constantly
BuildRequires: python3-devel >= 3.4
BuildRequires: python3-incremental
BuildRequires: python3-pyOpenSSL
BuildRequires: python3-pyserial
BuildRequires: python3-pytest
BuildRequires: python3-setuptools
BuildRequires: python3-zope.interface
Requires: python3-constantly
Requires: python3-incremental
Requires: python3-pyOpenSSL
Requires: python3-pyasn1
Requires: python3-pycrypto
Requires: python3-pyserial
Requires: python3-zope.interface
Requires(post): update-alternatives
Requires(preun): update-alternatives
%description
An extensible framework for Python programming, with special focus
on event-based network programming and multiprotocol integration.
%package doc
Summary: An asynchronous networking framework written in Python - Documentation
Group: Development/Languages/Python
%description 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 Twisted-%{version}
%patch0 -p1
sed -i "1d" src/twisted/{mail/test/pop3testserver,trial/test/scripttest}.py
%build
CFLAGS="%{optflags}" python3 setup.py build
%install
python3 setup.py install --prefix=%{_prefix} --root=%{buildroot} --install-lib=%{python3_sitearch} --install-data=%{python3_sitearch}
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
# Prepare for update-alternatives usage
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
for p in trial twistd twist ckeygen ; do
mv %{buildroot}%{_bindir}/$p %{buildroot}%{_bindir}/$p-%{py3_ver}
ln -s -f %{_sysconfdir}/alternatives/$p %{buildroot}%{_bindir}/$p
done
for p in cftp ckeygen conch mailmail pyhtmlizer tkconch trial twistd ; do
gzip %{buildroot}%{_mandir}/man1/$p.1
mv %{buildroot}%{_mandir}/man1/$p.1.gz %{buildroot}%{_mandir}/man1/$p-%{py3_ver}.1.gz
ln -s -f %{_sysconfdir}/alternatives/$p.1.gz %{buildroot}%{_mandir}/man1/$p.1.gz
done
%post
%_sbindir/update-alternatives \
--install %{_bindir}/twistd twistd %{_bindir}/twistd-%{py3_ver} 30 \
--slave %{_bindir}/trial trial %{_bindir}/trial-%{py3_ver} \
--slave %{_mandir}/man1/trial.1.gz trial.1.gz %{_mandir}/man1/trial-%{py3_ver}.1.gz \
--slave %{_mandir}/man1/cftp.1.gz cftp.1.gz %{_mandir}/man1/cftp-%{py3_ver}.1.gz \
--slave %{_mandir}/man1/ckeygen.1.gz ckeygen.1.gz %{_mandir}/man1/ckeygen-%{py3_ver}.1.gz \
--slave %{_mandir}/man1/conch.1.gz conch.1.gz %{_mandir}/man1/conch-%{py3_ver}.1.gz \
--slave %{_mandir}/man1/mailmail.1.gz mailmail.1.gz %{_mandir}/man1/mailmail-%{py3_ver}.1.gz \
--slave %{_mandir}/man1/pyhtmlizer.1.gz pyhtmlizer.1.gz %{_mandir}/man1/pyhtmlizer-%{py3_ver}.1.gz \
--slave %{_mandir}/man1/tkconch.1.gz tkconch.1.gz %{_mandir}/man1/ctkconchftp-%{py3_ver}.1.gz \
--slave %{_mandir}/man1/twistd.1.gz twistd.1.gz %{_mandir}/man1/twistd-%{py3_ver}.1.gz
%preun
if [ $1 -eq 0 ] ; then
%_sbindir/update-alternatives --remove twistd %{_bindir}/twistd-%{py3_ver}
fi
%files doc
%defattr(-,root,root,-)
%doc docs/*
%files
%defattr(-,root,root,-)
%doc CONTRIBUTING LICENSE NEWS README.rst
%{_bindir}/trial
%{_bindir}/twist
%{_bindir}/twistd
%{_bindir}/ckeygen
%{_bindir}/trial-%{py3_ver}
%{_bindir}/twist-%{py3_ver}
%{_bindir}/twistd-%{py3_ver}
%{_bindir}/ckeygen-%{py3_ver}
%ghost %{_sysconfdir}/alternatives/trial
%ghost %{_sysconfdir}/alternatives/twist
%ghost %{_sysconfdir}/alternatives/twistd
%ghost %{_sysconfdir}/alternatives/ckeygen
%{_mandir}/man1/cftp.1.gz
%{_mandir}/man1/ckeygen.1.gz
%{_mandir}/man1/conch.1.gz
%{_mandir}/man1/mailmail.1.gz
%{_mandir}/man1/pyhtmlizer.1.gz
%{_mandir}/man1/tkconch.1.gz
%{_mandir}/man1/trial.1.gz
%{_mandir}/man1/twistd.1.gz
%{_mandir}/man1/cftp-%{py3_ver}.1.gz
%{_mandir}/man1/ckeygen-%{py3_ver}.1.gz
%{_mandir}/man1/conch-%{py3_ver}.1.gz
%{_mandir}/man1/mailmail-%{py3_ver}.1.gz
%{_mandir}/man1/pyhtmlizer-%{py3_ver}.1.gz
%{_mandir}/man1/tkconch-%{py3_ver}.1.gz
%{_mandir}/man1/trial-%{py3_ver}.1.gz
%{_mandir}/man1/twistd-%{py3_ver}.1.gz
%ghost %{_sysconfdir}/alternatives/cftp.1.gz
%ghost %{_sysconfdir}/alternatives/ckeygen.1.gz
%ghost %{_sysconfdir}/alternatives/conch.1.gz
%ghost %{_sysconfdir}/alternatives/mailmail.1.gz
%ghost %{_sysconfdir}/alternatives/pyhtmlizer.1.gz
%ghost %{_sysconfdir}/alternatives/tkconch.1.gz
%ghost %{_sysconfdir}/alternatives/trial.1.gz
%ghost %{_sysconfdir}/alternatives/twistd.1.gz
%{python3_sitearch}/*
%changelog