15
0
Files
python-Twisted/python-Twisted.spec

152 lines
5.7 KiB
RPMSpec

#
# 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-%{**}}
Name: python-Twisted
%global modname Twisted
Version: 16.4.0
Release: 0
Url: http://twistedmatrix.com/
Summary: An asynchronous networking framework written in Python
License: MIT
Group: Development/Languages/Python
Source: https://pypi.io/packages/source/T/%{modname}/%{modname}-%{version}.tar.bz2
# PATCH-FIX-UPSTREAM -- https://twistedmatrix.com/trac/ticket/6280
Patch0: lp1102685.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: %{python_module devel}
BuildRequires: %{python_module pam}
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-pam
Requires: python-pyOpenSSL
Requires: python-pyasn1
Requires: python-pycrypto
Requires: python-pyserial
Requires: python-zope.interface
Provides: python-twisted = %{version}
Obsoletes: python-twisted < %{version}
Provides: python-twisted-core = %{version}
Obsoletes: python-twisted-core < %{version}
Provides: python-twisted-conch = %{version}
Obsoletes: python-twisted-conch < %{version}
Provides: python-twisted-lore = %{version}
Obsoletes: python-twisted-lore < %{version}
Provides: python-twisted-mail = %{version}
Obsoletes: python-twisted-mail < %{version}
Provides: python-twisted-names = %{version}
Obsoletes: python-twisted-names < %{version}
Provides: python-twisted-news = %{version}
Obsoletes: python-twisted-news < %{version}
Provides: python-twisted-runner = %{version}
Obsoletes: python-twisted-runner < %{version}
Provides: python-twisted-web = %{version}
Obsoletes: python-twisted-web < %{version}
Provides: python-twisted-words = %{version}
Obsoletes: python-twisted-words < %{version}
Provides: python-twisted-xish = %{version}
Obsoletes: python-twisted-xish < %{version}
Requires(post): update-alternatives
Requires(postun): update-alternatives
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%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
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 mailmail pyhtmlizer tkconch trial ; do
%python_clone -a %{buildroot}%{_bindir}/$p
gzip %{buildroot}%{_mandir}/man1/$p.1
%python_clone -a %{buildroot}%{_mandir}/man1/$p.1.gz
done
# no manpage for twist yet:
%python_clone -a %{buildroot}%{_bindir}/twist
%post
%{python_install_alternative twistd twistd.1 cftp cftp.1 ckeygen ckeygen.1 conch conch.1 mailmail mailmail.1 pyhtmlizer pyhtmlizer.1 tkconch tkconch.1 trial trial.1 twist}
%postun
%python_uninstall_alternative twistd
%files -n %{name}-doc
%defattr(-,root,root,-)
%doc docs/*
%files %{python_files}
%defattr(-,root,root,-)
%doc LICENSE NEWS README.rst
%python_alternative %{_bindir}/twistd
%python_alternative %{_bindir}/cftp
%python_alternative %{_bindir}/ckeygen
%python_alternative %{_bindir}/conch
%python_alternative %{_bindir}/mailmail
%python_alternative %{_bindir}/pyhtmlizer
%python_alternative %{_bindir}/tkconch
%python_alternative %{_bindir}/trial
%python_alternative %{_bindir}/twist
%python_alternative %{_mandir}/man1/twistd.1.gz
%python_alternative %{_mandir}/man1/cftp.1.gz
%python_alternative %{_mandir}/man1/ckeygen.1.gz
%python_alternative %{_mandir}/man1/conch.1.gz
%python_alternative %{_mandir}/man1/mailmail.1.gz
%python_alternative %{_mandir}/man1/pyhtmlizer.1.gz
%python_alternative %{_mandir}/man1/tkconch.1.gz
%python_alternative %{_mandir}/man1/trial.1.gz
%{python_sitearch}/*
%changelog