mirror of
https://abf.rosa.ru/djam/python3.11.git
synced 2025-02-24 02:32:53 +00:00
453 lines
15 KiB
RPMSpec
453 lines
15 KiB
RPMSpec
%define _duplicate_files_terminate_build 0
|
|
|
|
#define docver 3.11.4
|
|
%define dirver 3.11
|
|
%define familyver 3
|
|
|
|
%define lib_major %{dirver}
|
|
%define lib_name_orig libpython%{familyver}.11
|
|
%define lib_name %mklibname python %{lib_major}
|
|
%define develname %mklibname python3.11 -d
|
|
|
|
%ifarch %{ix86} %{x86_64} ppc
|
|
%bcond_with valgrind
|
|
%else
|
|
%bcond_with valgrind
|
|
%endif
|
|
|
|
%bcond_without rewheel
|
|
|
|
# We want to byte-compile the .py files within the packages using the new
|
|
# python3 binary.
|
|
#
|
|
# Unfortunately, rpmbuild's infrastructure requires us to jump through some
|
|
# hoops to avoid byte-compiling with the system python 2 version:
|
|
# /usr/lib/rpm/mandriva/macros sets up build policy that (amongst other things)
|
|
# defines __os_install_post. In particular, "brp-python-bytecompile" is
|
|
# invoked without an argument thus using the wrong version of python
|
|
# (/usr/bin/python, rather than the freshly built python), thus leading to
|
|
# numerous syntax errors, and incorrect magic numbers in the .pyc files. We
|
|
# thus remove the invocation of brp-python-bytecompile, whilst keeping the
|
|
# invocation of brp-python-hardlink (since this should still work for python3
|
|
# pyc/pyo files)
|
|
%define _python_bytecompile_build 0
|
|
|
|
Summary: An interpreted, interactive object-oriented programming language
|
|
Name: python3.11
|
|
Version: 3.11.4
|
|
Release: 3
|
|
License: Modified CNRI Open Source License
|
|
Group: Development/Python
|
|
|
|
Source0: https://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz
|
|
Source1: https://docs.python.org/3/archives/python-%{version}-docs-html.tar.bz2
|
|
Source2: python3.11.macros
|
|
Source4: import_all_modules.py
|
|
Source5: python3.11-shebang-sanity.sh
|
|
Source100: %{name}.rpmlintrc
|
|
|
|
# 00001 #
|
|
# Fixup distutils/unixccompiler.py to remove standard library path from rpath:
|
|
# Was Patch0 in ivazquez' python3000 specfile:
|
|
Patch1: 00001-rpath.patch
|
|
Patch2: Python-3.8.0-c++.patch
|
|
Patch3: python-3.8.0-c++atomics.patch
|
|
Patch4: 0005-Improve-distutils-C-support.patch
|
|
Patch5: 00201-fix-memory-leak-in-gdbm.patch
|
|
|
|
# 00251
|
|
# Set values of prefix and exec_prefix in distutils install command
|
|
# to /usr/local if executable is /usr/bin/python* and RPM build
|
|
# is not detected to make pip and distutils install into separate location
|
|
# Fedora Change: https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe
|
|
Patch251: 00251-change-user-install-location.patch
|
|
|
|
# 00328 #
|
|
# Restore pyc to TIMESTAMP invalidation mode as default in rpmbubild
|
|
# See https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/57#comment-27426
|
|
Patch328: 00328-pyc-timestamp-invalidation-mode.patch
|
|
|
|
# For more info see:
|
|
# https://bodhi.fedoraproject.org/updates/FEDORA-2021-e152ce5f31
|
|
# https://github.com/GrahamDumpleton/mod_wsgi/issues/730
|
|
Patch371: 00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-gh-28549-gh-28589.patch
|
|
|
|
#
|
|
# Mageia patches
|
|
#
|
|
Patch501: python3-3.5.2-skip-distutils-tests-that-fail-in-rpmbuild.patch
|
|
Patch503: python3-3.5.2-dont-raise-from-py_compile.patch
|
|
Patch506: python3-3.6.2-python3-config-LIBPLUSED-cmp0004-error.patch
|
|
|
|
Patch508: fix-attribute-e2k.patch
|
|
|
|
URL: http://www.python.org/
|
|
Requires: %{lib_name} = %{EVRD}
|
|
BuildRequires: automake
|
|
BuildRequires: autoconf-archive
|
|
BuildRequires: gcc-c++
|
|
BuildRequires: blt
|
|
BuildRequires: db-devel
|
|
BuildRequires: expat-devel
|
|
BuildRequires: gdbm-devel
|
|
BuildRequires: gmp-devel
|
|
BuildRequires: ffi-devel
|
|
BuildRequires: pkgconfig(ncursesw)
|
|
BuildRequires: pkgconfig(libnsl)
|
|
# build ssl module fail with error SSLV3_method not found
|
|
#BuildRequires: pkgconfig(openssl)
|
|
BuildRequires: openssl-devel
|
|
BuildRequires: readline-devel
|
|
BuildRequires: tcl tcl-devel
|
|
BuildRequires: tk tk-devel
|
|
BuildRequires: autoconf
|
|
BuildRequires: bzip2-devel
|
|
BuildRequires: sqlite3-devel
|
|
BuildRequires: xz-devel
|
|
BuildRequires: uuid-devel
|
|
%if %{with valgrind}
|
|
BuildRequires: valgrind-devel
|
|
%endif
|
|
%if %{with rewheel}
|
|
BuildRequires: python3-setuptools
|
|
BuildRequires: python3-pip
|
|
%endif
|
|
Provides: python(abi) = %{dirver}
|
|
|
|
%description
|
|
Python is an interpreted, interactive, object-oriented programming
|
|
language often compared to Tcl, Perl, Scheme or Java. Python includes
|
|
modules, classes, exceptions, very high level dynamic data types and
|
|
dynamic typing. Python supports interfaces to many system calls and
|
|
libraries, as well as to various windowing systems (X11, Motif, Tk,
|
|
Mac and MFC).
|
|
|
|
Programmers can write new built-in modules for Python in C or C++.
|
|
Python can be used as an extension language for applications that
|
|
need a programmable interface. This package contains most of the
|
|
standard Python modules, as well as modules for interfacing to the
|
|
Tix widget set for Tk and RPM.
|
|
|
|
Note that documentation for Python is provided in the python-docs
|
|
package.
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
%package -n %{lib_name}
|
|
Summary: Shared libraries for Python %{version}
|
|
Group: System/Libraries
|
|
|
|
%description -n %{lib_name}
|
|
This packages contains Python shared object library. Python is an
|
|
interpreted, interactive, object-oriented programming language often
|
|
compared to Tcl, Perl, Scheme or Java.
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
%package -n %{develname}
|
|
Summary: The libraries and header files needed for Python development
|
|
Group: Development/Python
|
|
Requires: %{name} = %{EVRD}
|
|
Requires: %{lib_name} = %{EVRD}
|
|
Provides: %{name}-devel = %{EVRD}
|
|
Provides: %{lib_name_orig}-devel = %{EVRD}
|
|
|
|
%description -n %{develname}
|
|
The Python programming language's interpreter can be extended with
|
|
dynamically loaded extensions and can be embedded in other programs.
|
|
This package contains the header files and libraries needed to do
|
|
these types of tasks.
|
|
|
|
Install %{develname} if you want to develop Python extensions. The
|
|
python package will also need to be installed. You'll probably also
|
|
want to install the python-docs package, which contains Python
|
|
documentation.
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
%package docs
|
|
Summary: Documentation for the Python programming language
|
|
Requires: %{name} = %{EVRD}
|
|
Requires: xdg-utils
|
|
Group: Development/Python
|
|
BuildArch: noarch
|
|
|
|
%description docs
|
|
The python-docs package contains documentation on the Python
|
|
programming language and interpreter. The documentation is provided
|
|
in ASCII text files and in LaTeX source files.
|
|
|
|
Install the python-docs package if you'd like to use the documentation
|
|
for the Python language.
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
%package -n tkinter3.11
|
|
Summary: A graphical user interface for the Python scripting language
|
|
Group: Development/Python
|
|
Requires: %{name} = %{EVRD}
|
|
Requires: tcl
|
|
Requires: tk
|
|
Provides: python3.11-tkinter = %{EVRD}
|
|
|
|
%description -n tkinter3.11
|
|
The Tkinter (Tk interface) program is an graphical user interface for
|
|
the Python scripting language.
|
|
|
|
You should install the tkinter package if you'd like to use a graphical
|
|
user interface for Python programming.
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
%package idle
|
|
Summary: IDLE (Python IDE) for Python %{dirver}
|
|
Group: Development/Python
|
|
Requires: tkinter3.11
|
|
Provides: tkinter3.11-apps = %{EVRD}
|
|
|
|
%description idle
|
|
IDLE (Python IDE) for Python %{dirver}
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
%prep
|
|
%setup -qn Python-%{version}
|
|
%autopatch -p1
|
|
|
|
# drop Autoconf version requirement
|
|
sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac
|
|
|
|
# Why we need this in 3.8? Won't work in any case
|
|
rm -f Lib/test/test_importlib/data/example-21.12-py3.6.egg
|
|
|
|
# docs
|
|
mkdir html
|
|
tar xf %{SOURCE1} -C html
|
|
|
|
find . -type f -print0 | xargs -0 perl -p -i -e 's@/usr/local/bin/python@/usr/bin/python3@'
|
|
|
|
|
|
%build
|
|
rm -f Modules/Setup.local
|
|
|
|
export OPT="%{optflags} -g"
|
|
|
|
# to fix curses module build
|
|
export CFLAGS="%{optflags} -I/usr/include/ncursesw"
|
|
export CPPFLAGS="%{optflags} -I/usr/include/ncursesw"
|
|
|
|
autoreconf -vfi
|
|
# Remove -Wl,--no-undefined
|
|
%define _disable_ld_no_undefined 1
|
|
%configure --with-threads \
|
|
--enable-ipv6 \
|
|
--with-dbmliborder=gdbm \
|
|
--with-system-expat \
|
|
--with-system-ffi \
|
|
--enable-shared \
|
|
--without-ensurepip \
|
|
--without-static-libpython \
|
|
--with-platlibdir=%{_lib} \
|
|
--with-ssl-default-suites=openssl \
|
|
%if %{with valgrind}
|
|
--with-valgrind
|
|
%endif
|
|
|
|
|
|
# fix build
|
|
#perl -pi -e 's/^(LDFLAGS=.*)/$1 -lstdc++/' Makefile
|
|
# (misc) if the home is nfs mounted, rmdir fails due to delay
|
|
export TMP="/tmp" TMPDIR="/tmp"
|
|
#%make LN="ln -sf"
|
|
make EXTRA_CFLAGS="$CFLAGS" LN="ln -sf"
|
|
|
|
%install
|
|
mkdir -p %{buildroot}%{_prefix}/lib/python%{dirver}
|
|
|
|
# fix Makefile to get rid of reference to distcc
|
|
perl -pi -e "/^CC=/ and s/distcc/gcc/" Makefile
|
|
|
|
# set the install path
|
|
echo '[install_scripts]' >setup.cfg
|
|
echo 'install_dir='"${RPM_BUILD_ROOT}/usr/bin" >>setup.cfg
|
|
|
|
# python is not GNU and does not know fsstd
|
|
mkdir -p %{buildroot}%{_mandir}
|
|
%makeinstall_std LN="ln -sf"
|
|
|
|
# overwrite the copied binary with a link
|
|
pushd %{buildroot}%{_bindir}
|
|
#ln -sf python%{dirver}m python%{dirver}
|
|
ln -sf python%{dirver} python%{familyver}
|
|
popd
|
|
|
|
(cd %{buildroot}%{_libdir}; ln -sf `ls libpython%{lib_major}*.so.*` libpython%{lib_major}.so)
|
|
|
|
%if %{with valgrind}
|
|
install Misc/valgrind-python.supp -D %{buildroot}%{_libdir}/valgrind/valgrind-python3.supp
|
|
%endif
|
|
|
|
mkdir -p %{buildroot}%{_datadir}/applications
|
|
cat > %{buildroot}%{_datadir}/applications/idle%{dirver}.desktop << EOF
|
|
[Desktop Entry]
|
|
Name=IDLE (Python %{dirver})
|
|
Name[ru]=IDLE (Python %{dirver})
|
|
Comment=IDE for Python %{dirver}
|
|
Comment[ru]=IDE для Python %{dirver}
|
|
Exec=%{_bindir}/idle%{dirver}
|
|
Icon=development_environment_section
|
|
Terminal=false
|
|
Type=Application
|
|
Categories=Development;IDE;
|
|
EOF
|
|
|
|
|
|
cat > %{buildroot}%{_datadir}/applications/rosa-%{name}-docs.desktop << EOF
|
|
[Desktop Entry]
|
|
Name=Python documentation
|
|
Name[ru]=Документация Python %{dirver}
|
|
Comment=Python complete reference
|
|
Comment[ru]=Полное руководство по языку Python %{dirver}
|
|
Exec=%{_bindir}/xdg-open %{_defaultdocdir}/%{name}-docs/index.html
|
|
Icon=documentation_section
|
|
Terminal=false
|
|
Type=Application
|
|
Categories=Documentation;
|
|
EOF
|
|
|
|
# fix non real scripts
|
|
#chmod 644 %{buildroot}%{_libdir}/python*/test/test_{binascii,grp,htmlparser}.py*
|
|
find %{buildroot} -type f \( -name "test_binascii.py*" -o -name "test_grp.py*" -o -name "test_htmlparser.py*" \) -exec chmod 644 {} \;
|
|
# fix python library not stripped
|
|
chmod u+w %{buildroot}%{_libdir}/libpython%{lib_major}*.so.1.0 %{buildroot}%{_libdir}/libpython3.so
|
|
|
|
|
|
%install_macro python311 %{SOURCE2}
|
|
# Script to perform import of each module given to %%py_check_import
|
|
install -D -m644 %{SOURCE4} %{buildroot}%{_rpmconfigdir}/redhat/import_all_modules.py
|
|
|
|
# Install pathfix.py to bindir
|
|
# See https://github.com/fedora-python/python-rpm-porting/issues/24
|
|
cp -p Tools/scripts/pathfix.py %{buildroot}%{_bindir}/pathfix3.11.py
|
|
|
|
|
|
install -m0755 %{SOURCE5} %{buildroot}%{_bindir}/python3.11-shebang-sanity
|
|
|
|
# conflict with main python
|
|
[ -L %{buildroot}%{_mandir}/man1/python3.11 ] && rm -fv %{buildroot}%{_mandir}/man1/python3.11
|
|
|
|
# Build scripts of many packages try to use the highest version of Python that they find
|
|
# That is why we have to relocate python3.8 out of $PATH
|
|
mkdir -p %{buildroot}%{_libexecdir}
|
|
mv %{buildroot}%{_bindir}/python3.11 %{buildroot}%{_libexecdir}/python3.11
|
|
|
|
# Remove shebang lines from .py files that aren't executable, and
|
|
# remove executability from .py files that don't have a shebang line:
|
|
find %{buildroot} -name \*.py \
|
|
\( \( \! -perm /u+x,g+x,o+x -exec sed -e '/^#!/Q 0' -e 'Q 1' {} \; \
|
|
-print -exec sed -i '1d' {} \; \) -o \( \
|
|
-perm /u+x,g+x,o+x ! -exec grep -m 1 -q '^#!' {} \; \
|
|
-exec chmod a-x {} \; \) \)
|
|
|
|
########## shebang py3 > py3.11 ##################
|
|
sh %{SOURCE5}
|
|
|
|
# When packaging a not system version of Python, these files are named like e.g. 2to3-3.11
|
|
# These files must not be packaged to avoid conflicts with system python3
|
|
rm -fr %{buildroot}%{_bindir}/{2to3,idle3,pydoc,pydoc3,python,python3,python3-config,python-config}
|
|
rm -fr %{buildroot}%{_libdir}/libpython3.so
|
|
rm -fr %{buildroot}%{_libdir}/pkgconfig/python3.pc
|
|
rm -fr %{buildroot}%{_libdir}/pkgconfig/python3-embed.pc
|
|
|
|
# Fix permissions on docs
|
|
find html -type d -exec chmod 755 {} +
|
|
find html -type f -exec chmod 644 {} +
|
|
|
|
%check
|
|
# (misc) if the home is nfs mounted, rmdir fails
|
|
export TMP="/tmp" TMPDIR="/tmp"
|
|
|
|
# all tests must pass
|
|
# but we disable network on BS
|
|
#WITHIN_PYTHON_RPM_BUILD= make test TESTOPTS="-u none -x $EXCLUDE"
|
|
# consider use network on local build
|
|
#WITHIN_PYTHON_RPM_BUILD= make test TESTOPTS="-u network -x $EXCLUDE"
|
|
|
|
%files
|
|
%{_rpmmacrodir}/*python311*
|
|
%{_rpmconfigdir}/redhat/import_all_modules.py
|
|
%{_includedir}/python*/pyconfig.h
|
|
%{_libdir}/python*/config*/Makefile
|
|
%exclude %{_libdir}/python*/lib-dynload/_tkinter.*.so
|
|
|
|
%dir %{_libdir}/python*
|
|
%{_libdir}/python*/LICENSE.txt
|
|
%{_libdir}/python%{dirver}/*.py
|
|
%{_libdir}/python%{dirver}/__phello__
|
|
%{_libdir}/python%{dirver}/__pycache__
|
|
%{_libdir}/python%{dirver}/collections
|
|
%{_libdir}/python%{dirver}/concurrent
|
|
%{_libdir}/python%{dirver}/ctypes
|
|
%{_libdir}/python%{dirver}/curses
|
|
%{_libdir}/python%{dirver}/dbm
|
|
%{_libdir}/python%{dirver}/distutils
|
|
%{_libdir}/python%{dirver}/email
|
|
%{_libdir}/python%{dirver}/encodings
|
|
%{_libdir}/python%{dirver}/html
|
|
%{_libdir}/python%{dirver}/http
|
|
%{_libdir}/python%{dirver}/importlib
|
|
%{_libdir}/python%{dirver}/json
|
|
%{_libdir}/python%{dirver}/lib-dynload
|
|
%{_libdir}/python%{dirver}/lib2to3
|
|
%{_libdir}/python%{dirver}/logging
|
|
%{_libdir}/python%{dirver}/multiprocessing
|
|
%{_libdir}/python%{dirver}/pydoc_data
|
|
%{_libdir}/python%{dirver}/re
|
|
%{_libdir}/python%{dirver}/site-packages
|
|
%{_libdir}/python%{dirver}/sqlite3
|
|
%{_libdir}/python%{dirver}/tomllib
|
|
%{_libdir}/python%{dirver}/turtledemo
|
|
%{_libdir}/python%{dirver}/unittest
|
|
%{_libdir}/python%{dirver}/urllib
|
|
%{_libdir}/python%{dirver}/venv
|
|
%{_libdir}/python%{dirver}/wsgiref*
|
|
%{_libdir}/python%{dirver}/xml
|
|
%{_libdir}/python%{dirver}/xmlrpc
|
|
%{_libdir}/python%{dirver}/asyncio
|
|
%{_libdir}/python%{dirver}/ensurepip
|
|
%{_libdir}/python%{dirver}/zoneinfo
|
|
%{_bindir}/pathfix3.11.py
|
|
%{_bindir}/pydoc3*
|
|
%{_bindir}/python%{dirver}-shebang*
|
|
%{_bindir}/2to3-%{dirver}
|
|
%{_mandir}/man*/*
|
|
%if %{with valgrind}
|
|
%{_libdir}/valgrind/valgrind-python3.supp
|
|
%endif
|
|
%{_libexecdir}/python3*
|
|
|
|
%files -n %{lib_name}
|
|
%{_libdir}/libpython*.so.1*
|
|
|
|
%files -n %{develname}
|
|
%{_libdir}/libpython*.so
|
|
%{_includedir}/python*
|
|
%{_libdir}/python*/config-*
|
|
%{_libdir}/python*/test/
|
|
%{_bindir}/python%{dirver}*-config
|
|
%{_libdir}/pkgconfig/*.pc
|
|
%exclude %{_includedir}/python*/pyconfig.h
|
|
%exclude %{_libdir}/python*/config*/Makefile
|
|
|
|
%files docs
|
|
%doc html/*/*
|
|
%{_datadir}/applications/rosa-%{name}-docs.desktop
|
|
|
|
%files -n tkinter3.11
|
|
%{_libdir}/python*/tkinter/
|
|
%{_libdir}/python*/idlelib
|
|
%{_libdir}/python*/lib-dynload/_tkinter.*.so
|
|
|
|
%files idle
|
|
%{_bindir}/idle%{dirver}
|
|
%{_datadir}/applications/idle%{dirver}.desktop
|