%bcond_with run_test %bcond_without rpmwheels %bcond_without flat %define config_htmldir /var/www/html/python Summary: An interpreted, interactive, object-oriented programming language. Summary(ja): オブジェクト指向 Python3 インタプリタ Name: python3 Version: 3.11.6 Release: 1%{?_dist_release} Group: programming Vendor: Project Vine Distribution: Vine Linux License: Python URL: https://www.python.org/ %define shortver %(echo %{version} | sed -e 's/~//') %define majorver %(echo %{version} | cut -d . -f 1) %define libvers %(echo %{version} | cut -d . -f 1-2) %define binsuffix %{libvers} %ifarch x86_64 %define python3_purelib %{_prefix}/lib/python%{majorver} %define python3_platlib %{_libdir}/python%{libvers} %else %define python3_purelib %{_libdir}/python%{majorver} %define python3_platlib %{_libdir}/python%{libvers} %endif %global py_SOVERSION 1.0 %global py_INSTSONAME libpython%{libvers}.so.%{py_SOVERSION} %global python_wheel_dir %{_datadir}/python3-wheels Provides: python(abi) = 3 # The following versions of setuptools/pip are bundled when this patch is not applied. # The versions are written in Lib/ensurepip/__init__.py, this patch removes them. # When the bundled setuptools/pip wheel is updated, the patch no longer applies cleanly. # In such cases, the patch needs to be amended and the versions updated here: %global pip_version 23.2.1 %global setuptools_version 65.5.0 #Source0: https://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz #Source1: https://www.python.org/ftp/python/doc/%{version}/python-%{version}-docs-html.tar.bz2 Source0: https://www.python.org/ftp/python/%{shortver}/Python-%{shortver}.tar.xz Source1: https://www.python.org/ftp/python/doc/%{shortver}/python-%{shortver}-docs-html.tar.bz2 # Desktop menu entry for idle3 Source10: idle3.desktop # AppData file for idle3 Source11: idle3.appdata.xml # (Patches taken from github.com/fedora-python/cpython) # 00001 # d06a8853cf4bae9e115f45e1d531d2dc152c5cc8 # Fixup distutils/unixccompiler.py to remove standard library path from rpath # Was Patch0 in ivazquez' python3000 specfile Patch1: 00001-rpath.patch # 00251 # af0f1ba72e01cb93371ff21fb7ca889daa43fa7a # Change user install location # # Set values of base and platbase in sysconfig from /usr # to /usr/local when RPM build is not detected # to make pip and similar tools install into separate location. # # 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 distutils and pypa/distutils install into separate location. # # Fedora Change: https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe # Downstream only. # # We've tried to rework in Fedora 36/Python 3.10 to follow https://bugs.python.org/issue43976 # but we have identified serious problems with that approach, # see https://bugzilla.redhat.com/2026979 or https://bugzilla.redhat.com/2097183 # # pypa/distutils integration: https://github.com/pypa/distutils/pull/70 Patch251: 00251-change-user-install-location.patch # 00328 # 318e500c98f5e59eb1f23e0fcd32db69b9bd17e1 # Restore pyc to TIMESTAMP invalidation mode as default in rpmbuild # # Since Fedora 31, the $SOURCE_DATE_EPOCH is set in rpmbuild to the latest # %%changelog date. This makes Python default to the CHECKED_HASH pyc # invalidation mode, bringing more reproducible builds traded for an import # performance decrease. To avoid that, we don't default to CHECKED_HASH # when $RPM_BUILD_ROOT is set (i.e. when we are building RPM packages). # # See https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/57#comment-27426 # Downstream only: only used when building RPM packages # Ideally, we should talk to upstream and explain why we don't want this Patch328: 00328-pyc-timestamp-invalidation-mode.patch # 00371 # c1754d9c2750f89cb702e1b63a99201f5f7cff00 # Revert "bpo-1596321: Fix threading._shutdown() for the main thread (GH-28549) (GH-28589)" # # This reverts commit 38c67738c64304928c68d5c2bd78bbb01d979b94. It # introduced regression causing FreeIPA's tests to fail. # # 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 # security # (none) # vine Patch10000: python3-flatten.patch BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildRequires: autoconf BuildRequires: bzip2-devel BuildRequires: expat-devel BuildRequires: desktop-file-utils BuildRequires: findutils BuildRequires: gcc-c++ BuildRequires: gdbm-devel BuildRequires: glibc-devel BuildRequires: libdb-devel BuildRequires: libffi-devel BuildRequires: libnsl2-devel BuildRequires: libtirpc-devel BuildRequires: libxcrypt-devel BuildRequires: ncurses-devel BuildRequires: openssl-devel BuildRequires: pkgconfig BuildRequires: readline-devel BuildRequires: sqlite3-devel BuildRequires: tar BuildRequires: valgrind-devel BuildRequires: xz-devel BuildRequires: zlib-devel %description Python is an interpreted, interactive, object-oriented programming language. It incorporates modules, exceptions, dynamic typing, very high level dynamic data types, and classes. Python combines remarkable power with very clear syntax. It has interfaces to many system calls and libraries, as well as to various window systems, and is extensible in C or C++. It is also usable as an extension language for applications that need a programmable interface. Finally, Python is portable: it runs on many brands of UNIX, on PCs under Windows, MS-DOS, and OS/2, and on the Mac. %package devel Summary: The libraries and header files needed for Python development. Group: programming Requires: %{name} = %{version}-%{release} Requires: libtirpc-devel %description devel 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 python-devel 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 idle Summary: A basic graphical development environment for Python Requires: %{name} = %{version}-%{release} Requires: %{name}-tkinter = %{version}-%{release} Provides: idle3 = %{version}-%{release} Provides: idle = %{version}-%{release} Provides: python3-tools = %{version}-%{release} Provides: python3-tools%{?_isa} = %{version}-%{release} Obsoletes: python3-tools < 3.10.0 %description idle IDLE is Python’s Integrated Development and Learning Environment. IDLE has the following features: Python shell window (interactive interpreter) with colorizing of code input, output, and error messages; multi-window text editor with multiple undo, Python colorizing, smart indent, call tips, auto completion, and other features; search within any window, replace within editor windows, and search through multiple files (grep); debugger with persistent breakpoints, stepping, and viewing of global and local namespaces; configuration, browsers, and other dialogs. %package tkinter Summary: A graphical user interface for the Python scripting language. Group: programming Requires: %{name} = %{version}-%{release} Requires: tcl, tk, tix Requires: libX11, libxcb, libXau, libXdmcp BuildRequires: tcl-devel, tk-devel, tix BuildRequires: libX11-devel, libxcb-devel, libXau-devel, libXdmcp-devel %description tkinter 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 docs Summary: Documentation for the Python programming language. Summary(ja): Python プログラミング言語のドキュメント Group: documentation %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. %debug_package %prep %setup -n Python-%{shortver} %autopatch -p1 -M 9999 %if %{with flat} %patch10000 -p1 %endif %if %{with rpmwheels} rm Lib/ensurepip/_bundled/pip-%{pip_version}-py3-none-any.whl rm Lib/ensurepip/_bundled/setuptools-%{setuptools_version}-py3-none-any.whl %endif # Remove all exe files to ensure we are not shipping prebuilt binaries # note that those are only used to create Microsoft Windows installers # and that functionality is broken on Linux anyway find -name '*.exe' -print -delete # Remove bundled libraries to ensure that we're using the system copy. rm -r Modules/expat # Remove files that should be generated by the build # (This is after patching, so that we can use patches directly from upstream) rm configure pyconfig.h.in # Regenerate the configure script and pyconfig.h.in autoconf autoheader %build # The build process embeds version info extracted from the Git repository # into the Py_GetBuildInfo and sys.version strings. # Our Git repository is artificial, so we don't want that. # Tell configure to not use git. export HAS_GIT=not-found export CFLAGS="%{?extension_cflags} -D_GNU_SOURCE -fPIC -fwrapv" export CFLAGS_NODIST="%{?build_cflags} -D_GNU_SOURCE -fPIC -fwrapv%{?with_no_semantic_interposition: -fno-semantic-interposition}" export CXXFLAGS="%{?extension_cxxflags} -D_GNU_SOURCE -fPIC -fwrapv" export CPPFLAGS="$(pkg-config --cflags-only-I libffi)" export OPT="%{?extension_cflags} -D_GNU_SOURCE -fPIC -fwrapv" export LINKCC="gcc" export CFLAGS="$CFLAGS $(pkg-config --cflags openssl)" export LDFLAGS="%{?extension_ldflags} -g $(pkg-config --libs-only-L openssl)" export LDFLAGS_NODIST="%{?build_ldflags}%{?with_no_semantic_interposition: -fno-semantic-interposition} -g $(pkg-config --libs-only-L openssl)" export PYTHON=%{__python3} %configure \ --with-platlibdir=%{_lib} \ --enable-ipv6 \ --enable-shared \ --with-computed-gotos=yes \ --with-dbmliborder=gdbm:ndbm:bdb \ --with-system-expat \ --with-system-ffi \ --enable-loadable-sqlite-extensions \ --with-lto \ --with-ssl-default-suites=openssl \ --without-static-libpython \ %if %{with rpmwheels} --with-wheel-pkg-dir=%{python_wheel_dir} \ %endif --with-valgrind \ --without-ensurepip \ --enable-optimizations \ %{nil} %global flags_override CFLAGS_NODIST="$CFLAGS_NODIST" #make %{?_smp_mflags} %{flags_override} regen-all PYTHON_FOR_REGEN="python3" make %{?_smp_mflags} %{flags_override} %install [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT mkdir -p %{buildroot}%{python3_platlib}/site-packages mkdir -p %{buildroot}%{python3_purelib}/site-packages %if 0 ln -sf python%{majorver} %{buildroot}%{_prefix}/lib/python%{binsuffix} %endif make DESTDIR=$RPM_BUILD_ROOT LIBDIR=%{_libdir} install # replace path in pydoc if [ ! -z "%{binsuffix}" ] then ( cd $RPM_BUILD_ROOT%{_bindir} mv pydoc%{libvers} pydoc.old sed 's|#!.*|#!%{_bindir}/env python'%{libvers}'|' \ pydoc.old > pydoc%{libvers} chmod 755 pydoc%{libvers} rm -f pydoc.old ) fi # Tools echo '#!%{_bindir}/env python%{binsuffix}' > ${RPM_BUILD_ROOT}%{_bindir}/idle%{binsuffix} echo 'import os, sys' >> ${RPM_BUILD_ROOT}%{_bindir}/idle%{binsuffix} echo 'os.execvp("%{_bindir}/python%{binsuffix}", ["%{_bindir}/python%{binsuffix}", "%{python3_platlib}/idlelib/idle.py"] + sys.argv[1:])' >> ${RPM_BUILD_ROOT}%{_bindir}/idle%{binsuffix} echo 'print "Failed to exec Idle"' >> ${RPM_BUILD_ROOT}%{_bindir}/idle%{binsuffix} echo 'sys.exit(1)' >> ${RPM_BUILD_ROOT}%{_bindir}/idle%{binsuffix} chmod 755 $RPM_BUILD_ROOT%{_bindir}/idle%{binsuffix} #cp -a Tools $RPM_BUILD_ROOT%{python3_platlib} mkdir -p %{buildroot}%{_prefix}/lib/debug%{_libdir} cp -f Tools/gdb/libpython.py %{buildroot}%{_prefix}/lib/debug%{_libdir}/%{py_INSTSONAME}-%{version}-%{release}.%{_arch}.debug-gdb.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}/pathfix%{binsuffix}.py # Install i18n tools to bindir # They are also in python2, so we version them # https://bugzilla.redhat.com/show_bug.cgi?id=1571474 for tool in pygettext msgfmt; do cp -p Tools/i18n/${tool}.py %{buildroot}%{_bindir}/${tool}%{binsuffix}.py ln -s ${tool}%{binsuffix}.py %{buildroot}%{_bindir}/${tool}3.py done # Switch all shebangs to refer to the specific Python version. # This currently only covers files matching ^[a-zA-Z0-9_]+\.py$, # so handle files named using other naming scheme separately. LD_LIBRARY_PATH=./ ./python \ Tools/scripts/pathfix.py \ -i "%{_bindir}/python%{binsuffix}" -pn \ %{buildroot} \ %{buildroot}%{_bindir}/{2to3-,idle,pydoc}%{binsuffix} \ %{buildroot}%{_bindir}/*%{binsuffix}.py \ %{buildroot}%{_libdir}/python%{binsuffix}/cgi.py \ %{buildroot}%{_prefix}/lib/debug%{_libdir}/*.py # 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 {} \; \) \) # make file lists rm -f mainpkg.files find %{buildroot}%{python3_platlib} -type f | sed "s|^%{buildroot}|/|" | grep -v \ -e '/python%{libvers}/config$' \ -e '_tkinter.so$' \ -e '_tkinter.cpython-' \ -e '/tkinter/' \ -e '/turtledemo/' \ -e '/idlelib/' \ >> mainpkg.files rm -f $RPM_BUILD_ROOT%{_prefix}/bin/2to3 find %{buildroot}%{_prefix}/bin -type f -o -type l | sed "s|^%{buildroot}|/|" | grep -v \ -e '/idlelib/' \ -e '/bin/2to3-%{binsuffix}$' \ -e '/bin/msgfmt%{binsuffix}.py' \ -e '/bin/pathfix%{binsuffix}.py' \ -e '/bin/pygettext%{binsuffix}.py' \ -e '/bin/idle%{binsuffix}$' \ -e '/bin/idle%{majorver}$' \ >> mainpkg.files # docs mkdir -p %{buildroot}%{config_htmldir} ( cd %{buildroot}%{config_htmldir} bunzip2 < %{SOURCE1} | tar x ) # add idle3 to menu install -D -m 0644 Lib/idlelib/Icons/idle_16.png %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/idle3.png install -D -m 0644 Lib/idlelib/Icons/idle_32.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/idle3.png install -D -m 0644 Lib/idlelib/Icons/idle_48.png %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/idle3.png install -D -m 0644 Lib/idlelib/Icons/idle_256.png %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/idle3.png desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE10} # Install and validate appdata file mkdir -p %{buildroot}%{_datadir}/metainfo cp -a %{SOURCE11} %{buildroot}%{_datadir}/metainfo %if %{with run_test} %check make test %endif %clean rm -fr $RPM_BUILD_ROOT %ifarch x86_64 %pre if [ ! -e %{_prefix}/lib/python%{libvers} ]; then ln -sf python%{majorver} %{_prefix}/lib/python%{libvers} fi %endif %files -f mainpkg.files %defattr(-, root, root) %license LICENSE %doc Misc/ACKS Misc/HISTORY Misc/NEWS Misc/Porting Misc/README %{_libdir}/libpython* %{_mandir}/man1/python%{libvers}.1* %{_mandir}/man1/%{name}.1* %attr(755,root,root) %dir %{python3_platlib} %attr(755,root,root) %dir %{python3_platlib}/site-packages %attr(755,root,root) %dir %{python3_purelib} %attr(755,root,root) %dir %{python3_purelib}/site-packages %files devel %defattr(-,root,root) %{_bindir}/2to3-%{binsuffix} %{_bindir}/msgfmt%{binsuffix}.py %{_bindir}/pathfix%{binsuffix}.py %{_bindir}/pygettext%{binsuffix}.py %dir %{_includedir}/python%{libvers} %dir %{_includedir}/python%{libvers}/cpython %dir %{_includedir}/python%{libvers}/internal %{_includedir}/python%{libvers}/*.h %{_includedir}/python%{libvers}/cpython/*.h %{_includedir}/python%{libvers}/internal/*.h %{_libdir}/pkgconfig/*.pc %{_prefix}/lib/debug%{_libdir}/*.py %files idle %{_bindir}/idle* %{python3_platlib}/idlelib %{_datadir}/metainfo/idle3.appdata.xml %{_datadir}/applications/idle3.desktop %{_datadir}/icons/hicolor/*/apps/idle3.* %files tkinter %defattr(-,root,root) %{python3_platlib}/__pycache__/turtle.* %{python3_platlib}/tkinter %{python3_platlib}/turtledemo %{python3_platlib}/lib-dynload/_tkinter.*.so* %files docs %defattr(-,root,root) %{config_htmldir}/* %changelog * Sat Oct 21 2023 Tomohiro "Tomo-p" KATO 3.11.6-1 - new upstream release. * Sat Nov 05 2022 Tomohiro "Tomo-p" KATO 3.11.0-1 - rebuilt. * Fri Oct 28 2022 Tomohiro "Tomo-p" KATO 3.11.0-0 - new upstream release. * Tue Oct 25 2022 Tomohiro "Tomo-p" KATO 3.11.0~rc2-1 - new upstream release. - dropped ldconfig scriptlets. - flatten noarch modules. * Tue Jan 25 2022 Tomohiro "Tomo-p" KATO 3.8.12-1 - new upstream release. * Sat Feb 27 2021 Tomohiro "Tomo-p" KATO 3.8.8-2 - fixed %%files. * Sat Feb 27 2021 Tomohiro "Tomo-p" KATO 3.8.8-1 - new upstream release. - dropped Patch1000: fixed in upstream. * Wed Feb 03 2021 Tomohiro "Tomo-p" KATO 3.8.7-1 - new upstream release. - dropped Patch1000: fixed in upstream. - added Patch1000 to fix CVE-2021-3177. * Tue Nov 03 2020 Tomohiro "Tomo-p" KATO 3.8.6-2 - added Patch1000 to fix CVE-2020-27619. * Fri Oct 09 2020 Tomohiro "Tomo-p" KATO 3.8.6-1 - new upstream release. * Sat Aug 15 2020 Tomohiro "Tomo-p" KATO 3.8.5-1 - new upstream release. * Wed Apr 15 2020 Tomohiro "Tomo-p" KATO 3.5.9-1 - new upstream release. * Sat Oct 26 2019 Tomohiro "Tomo-p" KATO 3.5.7-5 - fixed %%files. * Tue Oct 15 2019 Tomohiro "Tomo-p" KATO 3.5.7-4 - rebuilt with tix-8.4.3-5. * Fri Oct 04 2019 Tomohiro "Tomo-p" KATO 3.5.7-3 - rebuilt with tcl/tk-8.6.9. * Sat Aug 31 2019 Toshiaki Ara 3.5.7-2 - rebuild with readline-8.0 and ncurses-6.1 * Sun May 12 2019 Tomohiro "Tomo-p" KATO 3.5.7-1 - new upstream release. - rebuilt with gdbm-1.18.1. - added R:libtirpc-devel to python3-devel. * Thu Feb 14 2019 Tomohiro "Tomo-p" KATO 3.5.6-3 - added BR:libxcrypt-devel. - added BR:libtirpc-devel. - added BR:libnsl2-devel. * Sat Jan 26 2019 Tomohiro "Tomo-p" KATO 3.5.6-2 - rebuilt with new toolchain. * Mon Nov 19 2018 Tomohiro "Tomo-p" KATO 3.5.6-1 - new upstream release. - really rebuilt with openssl-1.1.1. * Fri Nov 02 2018 Toshiaki Ara 3.5.2-2 - rebuild with openssl-1.1.1 * Tue Jun 28 2016 Yoji TOYODA 3.5.2-1 - new upstream release - update Patch1 (python-3.5.2-lib64.patch) * Sun Mar 27 2016 Yoji TOYODA 3.4.4-2 - rebuild with openssl-1.0.2g * Sat Feb 13 2016 Yoji TOYODA 3.4.4-1 - new upstream release - add Patch2 (python3-3.4.4-revert-makefile.patch) * Sun Apr 12 2015 Yoji TOYODA 3.4.3-1 - new upstream release * Sun Mar 22 2015 Ryoichi INAGAKI 3.4.2-2 - rebuilt with readline 6.3 - changed BuildRequires: tcl-devel, tk-devel instead of tcl, tk respectively - changed BuildRequires: libdb-devel instead of db4-devel * Sun Jan 11 2015 Yoji TOYODA 3.4.2-1 - new upstream release - update Patch1 (python-3.4.2-lib64.patch) * Sun Sep 07 2014 Yoji TOYODA 3.3.3-3 - remove configure option "--enable-profiling" * Sun Jul 06 2014 Yoji TOYODA 3.3.3-2 - rebuild with libffi-3.0.13 * Sun Nov 24 2013 Yoji TOYODA 3.3.3-1 - new upstream release * Sat Oct 26 2013 Yoji TOYODA 3.3.2-1 - updated python to 3.3.2 * Sun Jan 6 2013 IWAI, Masaharu 3.3.0-2 - build with Tcl/Tk 8.5.7-1 * Wed Oct 24 2012 Yoji TOYODA 3.3.0-1 - updated python to 3.3.0 - update Patch1 (python-3.3.0-lib64.patch) - add BuildRequires: valgrind-devel * Sat Apr 16 2011 Shu KONNO 3.2-1 - updated python to 3.2 - updated python-*-docs-html to 3.2 - dropt all patchs - added python-3.2b2-lib64.patch - referred to the review Python-3.2/Misc/RPM/python-3.2.spec * Fri Jan 14 2011 Shu KONNO 3.1.3-2 - rebuilt with openssl-1.0.0c * Mon Nov 29 2010 Shu KONNO 3.1.3-1 - updated python to 3.1.3 - added python-3.1.3-locale.patch - dropt python-3.1.2-lib64.patch - added python-3.1.3-lib64-*.patchs python-3.1.3-lib64-Makefile.patch python-3.1.3-lib64-setup.patch python-3.1.3-lib64-site.patch python-3.1.3-lib64-install.patch python-3.1.3-lib64-sysconfig.patch python-3.1.3-lib64-getpath.patch python-3.1.3-lib64-test_install.patch - added run_test macro to run unit test - added BR: libffi * Sun Sep 26 2010 Shu KONNO 3.1.2-4 - rebuilt with rpm-4.8.1 for pkg-config * Sun Jun 20 2010 Shu KONNO 3.1.2-3 - spec in utf-8 * Sun Jun 20 2010 Shu KONNO 3.1.2-2 - added missings in BuildRequires, Requires * Fri Jun 18 2010 Shu KONNO 3.1.2-1 - initial build for VineSeed