%define install_pip 1 # if you wanna test, add " --define '_run_test 1' " option to rpmbuild command %define run_test %{?_run_test:1}%{!?_run_test:0} %define libvers 3.11 %define binsuffix 3.11 %define python_lib %{_libdir}/python%{libvers} #%#define python_lib /Library/Python/%{libvers} %define config_htmldir /var/www/html/python Summary: An interpreted, interactive, object-oriented programming language. Name: python3 Version: 3.11.8 Release: 2%{?_dist_release} License: PSF Group: Development/Languages URL: http://www.python.org/download/releases/%{version} Source0: http://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz Source1: http://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz.asc #Source1: https://docs.python.org/3.8/archives/python-%{version}-docs-html.tar.bz2 # The release manager for Python 3.11 is pablogsal Source2: https://keybase.io/pablogsal/pgp_keys.asc # A simple script to check timestamps of bytecode files # Run in check section with Python that is currently being built # Originally written by bkabrda Source8: check-pyc-timestamps.py # Desktop menu entry for idle3 Source10: idle3.desktop # AppData file for idle3 Source11: idle3.appdata.xml # 00001 # # Fixup distutils/unixccompiler.py to remove standard library path from rpath: # Was Patch0 in ivazquez' python3000 specfile: Patch1: 00001-rpath.patch # 00111 # # Patch the Makefile.pre.in so that the generated Makefile doesn't try to build # a libpythonMAJOR.MINOR.a # See https://bugzilla.redhat.com/show_bug.cgi?id=556092 # Downstream only: not appropriate for upstream Patch111: 00111-no-static-lib.patch # 00189 # # Instead of bundled wheels, use our RPM packaged wheels from # /usr/share/python-wheels Patch189: 00189-use-rpm-wheels.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 # 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 #Patch1: python-3.5.2-lib64.patch #Patch2: python3-3.4.4-revert-makefile.patch Patch1000: python-osx.patch Patch1001: python3-sslv3.patch BuildRoot: %{_tmppath}/%{name}-%{version}-root #BuildRequires: gzip tar gcc-c++ pkgconfig sed findutils #BuildRequires: bzip2-devel #BuildRequires: expat-devel #BuildRequires: gdbm-devel BuildRequires: gmp-devel #BuildRequires: gnupg2 #BuildRequires: libdb-devel BuildRequires: libffi-devel #BuildRequires: libnsl2-devel #BuildRequires: libtirpc-devel #BuildRequires: libxcrypt-devel BuildRequires: ncurses-devel BuildRequires: openssl-devel BuildRequires: readline-devel #BuildRequires: sqlite3-devel #BuildRequires: valgrind-devel BuildRequires: tcl-devel BuildRequires: tix-devel BuildRequires: tk-devel BuildRequires: zlib-devel Requires: bzip2 #Requires: gdbm Requires: ncurses Requires: openssl Requires: readline #Requires: sqlite3 Requires: zlib BuildArch: fat Vendor: OSX WorkShop Distribution: OSX WorkShop %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: Development/Libraries 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 tkinter Summary: A graphical user interface for the Python scripting language. Group: Development/Languages Requires: %{name} = %{version}-%{release} Requires: tcl, tk, tix #Requires: libX11, libxcb, libXau, libXdmcp BuildRequires: tcl-devel, tk-devel, tix-devel #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 tools Summary: A collection of development tools included with Python. Group: Development/Tools Requires: %{name} = %{version}-%{release} Requires: %{name}-tkinter = %{version} %description tools The Python package includes several development tools that are used to build python programs. %package docs Summary: Documentation for the Python programming language. 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. %if %{?install_pip} %package pip Summary: pip commands for python modules Group: Development/Tools Requires: %{name} = %{version}-%{release} %description pip Th pip command for python module manipulations %endif %prep %setup -q -n Python-%{version} %patch 1 -p1 #%patch 111 -p1 %if %{with rpmwheels} %patch 189 -p1 rm Lib/ensurepip/_bundled/*.whl %endif %patch 251 -p1 %patch 371 -p1 %patch 1000 -p0 %patch 1001 -p1 -b .sslv3 #cp -f LICENSE .. #cp -a Misc .. sed -i -e "s,^#zlib.*,zlib zlibmodule.c -lz," Modules/Setup # dirty hack to work around compilation error ssl3 methods sed -e 's;-Werror=implicit-function-declaration;;' configure > configure.mod mv configure.mod configure chmod 755 configure %build #export CFLAGS="-O3 -arch arm64 -I%{_includedir} -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/" export CFLAGS="-O3 -I%{_includedir} -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/ -Wno-implicit-function-declaration" #export CPPFLAGS="-arch arm64 -I%{_includedir}" export CPPFLAGS="-I%{_includedir}" export CXXFLAGS="$CFLAGS" export FFLAGS="$CFLAGS" export FCFLAGS="$CFLAGS" #export LDFLAGS="-arch arm64 $LDFLAGS -L%{_libdir}" export LDFLAGS="$LDFLAGS -L%{_libdir}" export CXX="clang++" export CC="clang" if pkg-config libtirpc ; then export CFLAGS="$CFLAGS $(pkg-config --cflags libtirpc)" export CXXFLAGS="$CXXFLAGS $(pkg-config --cflags libtirpc)" export LDFLAGS="$LDFLAGS $(pkg-config --libs-only-L libtirpc)" export LIBS="$LIBS $(pkg-config --libs-only-l libtirpc)" fi #--host=%{_rpm_platform_arm64} \ #--build=%{_rpm_platform_arm64} \ #--target=%{_rpm_platform_arm64} \ ./configure \ --prefix=%{_prefix} \ --libdir=%{_libdir} \ --enable-shared \ --enable-ipv6 \ --with-doc-strings \ --with-pymalloc \ --with-system-ffi \ --with-ssl-default-suites=openssl \ --without-valgrind \ --enable-universalsdk=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/ \ --with-universal-archs=universal2 \ %if %{?install_pip} --with-ensurepip=install \ %else --without-ensurepip \ %endif CXX=g++; cat <> Modules/Setup.local _socket socketmodule.c SSL=%{_prefix} _ssl _ssl.c \ -DUSE_SSL -I%{_includedir} -I%{_includedir}/openssl \ -L%{_libdir} -lssl -lcrypto EOF make %{?_smp_mflags} %if %{run_test} make test %endif %if %{run_test} make test %endif %install [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT echo '[install_scripts]' >setup.cfg echo 'install_dir='"${RPM_BUILD_ROOT}%{_bindir}" >> setup.cfg mkdir -p ${PWD}-root%{python_lib}/lib-dynload make DESTDIR=%{buildroot} LIBDIR=%{_libdir} install # if --with-wide-unicode at configure #ln -s python%{libvers}m $RPM_BUILD_ROOT%{_includedir}/python%{libvers} # 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}", "%{python_lib}/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%{python_lib} cp -a Tools $RPM_BUILD_ROOT%{python_lib} # make file lists rm -f mainpkg.files find "$RPM_BUILD_ROOT"%{python_lib} -type f | sed "s|^${RPM_BUILD_ROOT}||" | grep -v \ -e '/python%{libvers}/config$' \ -e '_tkinter.so$' \ -e '_tkinter.cpython-' | grep -v 'launcher manifest.xml' | grep -v 'script (dev).tmpl' \ >> mainpkg.files %if %{?install_pip} rm -f pip.files find "$RPM_BUILD_ROOT" -name 'pip3*' | sed "s|^${RPM_BUILD_ROOT}||" | grep '/bin/pip3' \ > pip.files %endif rm -f $RPM_BUILD_ROOT%{_prefix}/bin/2to3 find "$RPM_BUILD_ROOT""%{_prefix}"/bin -type f -o -type l | sed "s|^${RPM_BUILD_ROOT}||" | grep -v -e '/bin/2to3%{binsuffix}$' | grep -v -e '/bin/pydoc%{binsuffix}$' | grep -v -e '/bin/smtpd.py%{binsuffix}$' | grep -v -e '/bin/idle%{binsuffix}$' \ %if 0%{?install_pip} | grep -v '/bin/pip3' \ %endif >> mainpkg.files rm -f tools.files find "$RPM_BUILD_ROOT"%{python_lib}/idlelib \ "$RPM_BUILD_ROOT"%{python_lib}/Tools -type f | sed "s|^${RPM_BUILD_ROOT}||" > tools.files echo %{_bindir}/2to3-%{binsuffix} >> tools.files echo %{_bindir}/pydoc%{binsuffix} >> tools.files ##echo %{_bindir}/smtpd.py%{binsuffix} >> tools.files echo %{_bindir}/idle%{binsuffix} >> tools.files # docs mkdir -p "$RPM_BUILD_ROOT"%{config_htmldir} ( cd "$RPM_BUILD_ROOT"%{config_htmldir} bunzip2 < %{SOURCE1} | tar x ) rm -f docs.files find "$RPM_BUILD_ROOT"%{config_htmldir} -type f -o -type l -o -type d | sed "s|^${RPM_BUILD_ROOT}||" > docs.files # fix the #! line in installed files find "$RPM_BUILD_ROOT" -type f -print0 | xargs -0 grep -l /usr/local/bin/python | while read file do FIXFILE="$file" sed 's|^#!.*python|#!%{_bindir}/env python'"%{binsuffix}"'|' \ "$FIXFILE" >/tmp/fix-python-path.$$ cat /tmp/fix-python-path.$$ > "$FIXFILE" rm -f /tmp/fix-python-path.$$ done # check to see if there are any straggling #! lines find "$RPM_BUILD_ROOT" -type f | xargs egrep -n '^#! */usr/local/bin/python' \ | grep ':1:#!' >/tmp/python-rpm-files.$$ || true if [ -s /tmp/python-rpm-files.$$ ] then echo '*****************************************************' cat /tmp/python-rpm-files.$$ cat <<@EOF ***************************************************** There are still files referencing /usr/local/bin/python in the install directory. They are listed above. Please fix the .spec file and try again. If you are an end-user, you probably want to report this to jafo-rpms@tummy.com as well. ***************************************************** @EOF rm -f /tmp/python-rpm-files.$$ exit 1 fi rm -f /tmp/python-rpm-files.$$ #%%post -p /sbin/ldconfig #%%postun -p /sbin/ldconfig %clean rm -fr $RPM_BUILD_ROOT %files -f mainpkg.files %defattr(-, root, wheel) %license LICENSE %doc Misc/ACKS Misc/HISTORY Misc/NEWS Misc/Porting Misc/README %attr(755,root,wheel) %dir %{python_lib}/ %{_libdir}/libpython* %{_mandir}/man1/python%{libvers}.1* %{_mandir}/man1/%{name}.1* %files devel %defattr(-,root,wheel) #%%dir %{_includedir}/python%{libvers}m %dir %{_includedir}/python%{libvers} #%%{_includedir}/python%{libvers}m/*.h %{_includedir}/python%{libvers}/*.h %{_includedir}/python%{libvers} %{_libdir}/pkgconfig/*.pc %files -f tools.files tools %defattr(-,root,wheel) %files tkinter %defattr(-,root,wheel) #%{python_lib}/tkinter %{python_lib}/lib-dynload/_tkinter.*.so* %files docs -f docs.files %defattr(-,root,wheel) %if %{?install_pip} %files pip -f pip.files %defattr(-,root,wheel) %endif %changelog * Fri Dec 13 2024 Keisuke FUJII 3.11.8-2 - rebuilt with sslv3 patch * Mon Mar 18 2024 KOBAYASHI Taizo 3.11.8-1 - new upstream release * Thu Feb 23 2023 KOBAYASHI Taizo 3.11.2-1 - new upstream release * Sat Mar 12 2022 KOBAYASHI Taizo 3.8.12-4 - build fat - divide pip stuff into the python-pip package * Thu Mar 10 2022 Keisuke Fujii 3.8.12-3 - added pip package added - built on MacOS 12 for Intel Macs * Sun Feb 27 2022 Keisuke Fujii 3.8.12-3 - added pip package added - built on MacOS 12 for M1 Macs * Thu Jan 20 2022 KOBAYASHI Taizo 3.8.12-2 - set --enable-universalsdk --with-universal-archs=universal2 * Wed Dec 08 2021 KOBAYASHI Taizo 3.8.12-1 - new upstream release * Thu Jan 07 2021 KOBAYASHI Taizo 3.8.7-1 - new upstream release - macOSWS 11.1 fat * Fri Nov 22 2019 KOBAYASHI Taizo 3.8.0-1 - new upstream release * Fri Nov 22 2019 KOBAYASHI Taizo 3.5.7-1 - modified for OSXWS * 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