File python3-doc.spec of Package python3.16830

#
# spec file for package python3-doc
#
# Copyright (c) 2020 SUSE LLC
#
# 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/
#


#
# 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/
#

Name:           python3-doc
URL:            http://www.python.org/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  xz
Summary:        Additional Package Documentation for Python
License:        Python-2.0
Group:          Development/Languages/Python
Version:        3.4.10
Release:        0
BuildArch:      noarch
%define         tarversion     %{version}
%define         tarname        Python-%{tarversion}
Source0:        http://www.python.org/ftp/python/%{tarversion}/%{tarname}.tar.xz

# For Patch 34
Source34:       recursion.tar

BuildRequires:  python-Sphinx
%if 0%{?is_opensuse} && 0%{?sle_version} >= 120300
BuildRequires:  python-Sphinx-latex
%endif
BuildRequires:  texlive-cmap
BuildRequires:  texlive-collection-fontsrecommended
BuildRequires:  texlive-fancybox
BuildRequires:  texlive-fancyvrb
BuildRequires:  texlive-framed
BuildRequires:  texlive-mdwtools
BuildRequires:  texlive-multirow
BuildRequires:  texlive-parskip
BuildRequires:  texlive-scheme-basic
BuildRequires:  texlive-threeparttable
BuildRequires:  texlive-titlesec
BuildRequires:  texlive-ucs
BuildRequires:  texlive-upquote
BuildRequires:  texlive-wrapfig

# for consistency:
### COMMON-PATCH-BEGIN ###

# implement "--record-rpm" option for distutils installations
Patch01:        Python-3.0b1-record-rpm.patch
# support lib-vs-lib64 distinction
Patch02:        Python-3.3.0b2-multilib.patch
# support finding packages in /usr/local, install to /usr/local by default
Patch04:        python-3.3.0b1-localpath.patch
# replace DATE, TIME and COMPILER by fixed definitions to aid reproducible builds
Patch06:        python-3.3.0b1-fix_date_time_compiler.patch
# fix wrong include path in curses-panel module
Patch07:        python-3.3.0b1-curses-panel.patch
# POSIX_FADV_WILLNEED throws EINVAL. Use a different constant in test
Patch09:        python-3.3.0b1-test-posix_fadvise.patch
# Add missing bits for aarch64 in libffi
Patch10:        ctypes-libffi-aarch64.patch
# Disable global and distutils sysconfig comparison test, we deviate from the default depending on optflags
Patch12:        python-3.3.3-skip-distutils-test_sysconfig_module.patch
# Raise timeout value for test_subprocess
Patch15:        subprocess-raise-timeout.patch
# PATCH-FIX-UPSTREAM Fix argument passing in libffi for aarch64
Patch18:        python-2.7-libffi-aarch64.patch
# PATCH-FIX-UPSTREAM Prefer lowercase proxy environment variables
Patch19:        python3-urllib-prefer-lowercase-proxies.patch
# PATCH-FIX-UPSTREAM python-3.6-CVE-2017-18207.patch psimons@suse.com -- Add check for channels of wav file in Lib/wave.py
# Suggested in https://github.com/python/cpython/pull/4437.
Patch20:        python-3.6-CVE-2017-18207.patch
# PATCH-FIX-UPSTREAM https://bugs.python.org/issue30693
Patch21:        python-sorted_tar.patch
# PATCH-FIX-UPSTREAM CVE-2019-10160-netloc-port-regression.patch bsc#1138459 mcepl@suse.com
# Fix regression introduced by fix for CVE-2019-9636
Patch26:        CVE-2019-10160-netloc-port-regression.patch
# PATCH-FIX-UPSTREAM CVE-2018-1000802-shutil_use_subprocess_no_spawn.patch bsc#1109663 mcepl@suse.com
# Command injection in the shutil module
Patch28:        CVE-2018-1000802-shutil_use_subprocess_no_spawn.patch
# PATCH-FIX-UPSTREAM CVE-2019-16056-email-parse-addr.patch bsc#1149955 mcepl@suse.com
# bpo#34155 The email module wrongly parses email addresses
Patch29:        CVE-2019-16056-email-parse-addr.patch
# PATCH-FIX-UPSTREAM CVE-2020-8492-urllib-ReDoS.patch bsc#1162367 mcepl@suse.com
# Fixes Python urrlib allowed an HTTP server to conduct Regular
# Expression Denial of Service (ReDoS)
Patch30:        CVE-2020-8492-urllib-ReDoS.patch
# PATCH-FIX-UPSTREAM CVE-2019-9674-zip-bomb.patch bsc#1162825 mcepl@suse.com
# Improve documentation warning against the possible zip bombs
Patch31:        CVE-2019-9674-zip-bomb.patch
# PATCH-FIX-SLE skip-failing-tests.patch mcepl@suse.com
# test_write_filtered_python_package just wants to fail, and I have no idea why.
Patch32:        skip-failing-tests.patch
# PATCH-FIX-UPSTREAM CVE-2019-18348-CRLF_injection_via_host_part.patch bsc#1155094
# disallow control characters in hostnames in httplib
Patch33:        CVE-2019-18348-CRLF_injection_via_host_part.patch
# PATCH-FIX-UPSTREAM CVE-2019-20907_tarfile-inf-loop.patch bsc#1174091 mcepl@suse.com
# avoid possible infinite loop in specifically crafted tarball (CVE-2019-20907)
# REQUIRES SOURCE 34
Patch34:        CVE-2019-20907_tarfile-inf-loop.patch
# PATCH-FIX-UPSTREAM bpo37614-race_test_docxmlrpc_srv_setup.patch bpo#27614 mcepl@suse.com
# avoid race in test_docxmlrpc (REQUIRED for Patch #36)
Patch35:        bpo37614-race_test_docxmlrpc_srv_setup.patch
# PATCH-FIX-UPSTREAM CVE-2019-16935-xmlrpc-doc-server_title.patch bsc#1153238 mcepl@suse.com
# XSS vulnerability in the documentation XML-RPC server in server_title field
Patch36:        CVE-2019-16935-xmlrpc-doc-server_title.patch
# PATCH-FIX-UPSTREAM CVE-2019-9947-no-ctrl-char-http.patch bsc#1130840 mcepl@suse.com
# avoid CRLF injenction
Patch37:        CVE-2019-9947-no-ctrl-char-http.patch
# PATCH-FIX-UPSTREAM CVE-2020-14422-ipaddress-hash-collision.patch bsc#1173274 mcepl@suse.com
# oversimplicstic computation of hash values leads to conflicts and potential for DOS
Patch38:        CVE-2020-14422-ipaddress-hash-collision.patch
# PATCH-FIX-UPSTREAM CVE-2020-26116-httplib-header-injection.patch bsc#1177211
# Fixes httplib to disallow control characters in method to avoid header
# injection
Patch39:        CVE-2020-26116-httplib-header-injection.patch
# Update SSL certificates due to certificates shipped with the package expiring
Patch40:        update-ssl-certs.patch
### COMMON-PATCH-END ###
### COMMON-DEF-BEGIN ###

# the versions are autogenerated from pre_checkin.sh
# based on the current source tarball
%define         python_version  3.4

%define         python_version_abitag   34
%define         python_version_soname   3_4

%define         sitedir         %{_libdir}/python%{python_version}

# three possible ABI kinds: m - pymalloc, d - debug build
# see PEP 3149
%define         abi_kind m
# python ABI version - used in some file names
%define         python_abi %{python_version}%{abi_kind}
# soname ABI tag defined in PEP 3149
%define         abi_tag %{python_version_abitag}%{abi_kind}

%define         so_version %{python_version_soname}%{abi_kind}1_0

%define dynlib() %{sitedir}/lib-dynload/%{1}.cpython-%{abi_tag}.so
### COMMON-DEF-END ###

Enhances:       python3 = %{python_version}

%description
Tutorial, Global Module Index, Language Reference, Library Reference,
Extending and Embedding Reference, Python/C API Reference, Documenting
Python, and Macintosh Module Reference in HTML format.



%package pdf
Summary:        Python PDF Documentation
Group:          Development/Languages/Python

%description pdf
Tutorial, Global Module Index, Language Reference, Library Reference,
Extending and Embedding Reference, Python/C API Reference, Documenting
Python, and Macintosh Module Reference in PDF format.



Authors:
--------
    Guido van Rossum <guido@python.org>

%prep
%setup -q -n %{tarname}

# for consistency
### COMMON-PREP-BEGIN ###

%patch01 -p1
%patch02 -p1
#%%patch03
#- canonicalize disabled, needs testing whether the exploit still works
%patch04 -p1
%patch06 -p1
%patch07
%patch09 -p1
%patch10 -p1
%patch12 -p1
%patch15 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch26 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
%patch40 -p1

# For patch 34
cp -v %{SOURCE34} Lib/test/recursion.tar

# drop Autoconf version requirement
sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac

# fix shebangs - convert /usr/local/bin/python and /usr/bin/env/python to /usr/bin/python3
for dir in Lib Tools; do
    # find *.py, filter to files that contain bad shebangs
    find $dir -name '*.py' -type f -print0 \
        | xargs -0 grep -lE '^#! *(/usr/.*bin/(env +)?)?python' \
        | xargs sed -r -i -e '1s@^#![[:space:]]*(/usr/(local/)?bin/(env +)?)?python([0-9]+(\.[0-9]+)?)?@#!/usr/bin/python3@'
done

### COMMON-PREP-END ###

%build
TODAY_DATE=`date -r %{S:0} "+%B %d, %Y"`
# TODO use not date of tarball but date of latest patch

cd Doc
sed -i "s/^today = .*/today = '$TODAY_DATE'/" conf.py
make html
make latex PAPER=a4
( cd build/latex; make all-pdf )
mv build/latex build/paper-a4
make latex PAPER=letter
( cd build/latex; make all-pdf )
mv build/latex build/paper-letter

%install
export PDOCS=${RPM_BUILD_ROOT}%{_docdir}/python3
mkdir -p $PDOCS
# generated docs
pushd Doc
rm build/html/.buildinfo
cp -r build/html $PDOCS
install -d -m 755 $PDOCS/paper-a4
cp build/paper-a4/*.pdf $PDOCS/paper-a4
install -d -m 755 $PDOCS/paper-letter
cp build/paper-letter/*.pdf $PDOCS/paper-letter
popd
# misc
install -d -m 755 $PDOCS/Misc
rm Misc/README.AIX
rm -vf Misc/*.orig
for i in Misc/* ; do
  [ -f $i ] && install -c -m 644 $i $PDOCS/Misc/
done

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(644, root, root, 755)
%dir %{_docdir}/python3
%doc %{_docdir}/python3/Misc
%doc %{_docdir}/python3/html

%files pdf
%defattr(644, root, root, 755)
%doc %{_docdir}/python3/paper-a4
%doc %{_docdir}/python3/paper-letter

%changelog
openSUSE Build Service is sponsored by