File python3-doc.spec of Package python3.14042

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


### COMMON-DEF-BEGIN ###
%define         tarversion %{version}
%define         tarname    Python-%{tarversion}
# the versions are autogenerated from pre_checkin.sh
# based on the current source tarball
%define         python_version          3.6
%define         python_version_abitag   36
%define         python_version_soname   3_6
%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}
# version part of "libpython" package
%define         so_major 1
%define         so_minor 0
%define         so_version %{python_version_soname}%{abi_kind}%{so_major}_%{so_minor}
# rpm and python have different ideas about what is an arch-dependent name, so:
%if %{__isa_name} == ppc
%define archname %(echo %{_arch} | sed s/ppc/powerpc/)
%else
%define archname %{_arch}
%endif
# our arm has Hardware-Floatingpoint
%if %{_arch} == arm
%define armsuffix hf
%endif
# pyexpat.cpython-35m-x86_64-linux-gnu
# pyexpat.cpython-35m-powerpc64le-linux-gnu
# pyexpat.cpython-35m-armv7-linux-gnueabihf
%define dynlib() %{sitedir}/lib-dynload/%{1}.cpython-%{abi_tag}-%{archname}-%{_os}%{?_gnu}%{?armsuffix}.so
### COMMON-DEF-END ###
#
Name:           python3-doc
Version:        3.6.10
Release:        0
Summary:        Additional Package Documentation for Python 3
License:        Python-2.0
Group:          Documentation/HTML
URL:            http://www.python.org/
Source0:        http://www.python.org/ftp/python/%{tarversion}/%{tarname}.tar.xz
BuildRequires:  libqt5-qttools
BuildRequires:  python3-Sphinx >= 1.2
BuildRequires:  xz
Enhances:       python3 = %{python_version}
BuildArch:      noarch
# 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.6.0-multilib-new.patch
# support finding packages in /usr/local, install to /usr/local by default
Patch04:        python-3.3.0b1-localpath.patch
# PATCH-FEATURE-UPSTREAM pep538_coerce_legacy_c_locale.patch bpo#28180 mcepl@suse.com
# This patches coerces locale to be C.UTF-8 irrespective to the system locale
Patch05:        pep538_coerce_legacy_c_locale.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
# 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 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 bmwiedemann@suse.de -- https://github.com/python/cpython/pull/296
Patch21:        0001-allow-for-reproducible-builds-of-python-packages.patch
# PATCH-FEATURE-OPENSUSE order files for compilation until the underlying cause of bsc#1049186 is resolved
Patch22:        distutils-reproducible-compile.patch
# skip some tests only for PowerPC
Patch23:        skip_random_failing_tests.patch
# PATCH-FIX-UPSTREAM sorted tar https://github.com/python/cpython/pull/2263
Patch24:        python3-sorted_tar.patch
# PATCH-FIX-UPSTREAM bpo23395-PyErr_SetInterrupt-signal.patch boo#1094814 mcepl@suse.com
# handle situation when the SIGINT signal is ignored or not handled
Patch29:        bpo23395-PyErr_SetInterrupt-signal.patch
# PATCH-FIX-OPENSUSE aarch64-prolong-timeout.patch bsc#1149121 mcepl@suse.com
# Our buildbots are apparently too busy on aarch64 to make time right
Patch30:        aarch64-prolong-timeout.patch
# PATCH-FIX-UPSTREAM bpo-36576-skip_tests_for_OpenSSL-111.patch bsc#1149792 mcepl@suse.com
# Skip tests failing with OpenSSL 1.1.1
Patch32:        bpo-36576-skip_tests_for_OpenSSL-111.patch
# PATCH-FIX-OPENSUSE bpo36263-Fix_hashlib_scrypt.patch boo#1151490 mcepl@suse.com
# There is a regression in OpenSSL, which causes bpo#36263, and until it
# is fixed in OpenSSL, we need to protect against it.
Patch33:        bpo36263-Fix_hashlib_scrypt.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)
Patch34:        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
Patch35:        CVE-2019-9674-zip-bomb.patch
### COMMON-PATCH-END ###

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

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

# for consistency
### COMMON-PREP-BEGIN ###
%patch01 -p1
%patch02 -p1
%patch04
%patch05 -p1
%patch06 -p1
%patch07
%patch09 -p1
%patch12 -p1
%patch15 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%ifarch ppc ppc64 ppc64le
%patch23 -p1
%endif
%patch24 -p1
%patch29 -p1
%patch30 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1

# 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
    # break up "/""usr" like this to prevent replacing with %{_prefix}
    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]+)?)?@#!%{_bindir}/python3@'
done

# drop in-tree libffi and expat
rm -r Modules/_ctypes/libffi* Modules/_ctypes/darwin
rm -r Modules/expat

# drop duplicate README from site-packages
rm Lib/site-packages/README.txt

### COMMON-PREP-END ###

%build
TODAY_DATE=`date -r %{SOURCE0} "+%%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 -j1 html
# create a .qch file that can be used in QtAssistant or KDevelop
sphinx-build -a -b qthelp . build/qthelp
qhelpgenerator-qt5 build/qthelp/Python.qhp -o build/qthelp/Python.qch

%install
export PDOCS=%{buildroot}%{_docdir}/python3
mkdir -p $PDOCS
# generated docs
rm Doc/build/html/.buildinfo
cp -r Doc/build/html $PDOCS
install -m 644 Doc/build/qthelp/Python.qch $PDOCS
# misc
install -d -m 755 $PDOCS/Misc
rm Misc/README.AIX
for i in Misc/* ; do
  [ -f $i ] && install -c -m 644 $i $PDOCS/Misc/
done

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

%changelog
openSUSE Build Service is sponsored by