%bcond_with run_test %define libvers 3.8 %define binsuffix 3.8 %define python_lib %{_libdir}/python%{libvers} %define config_htmldir /var/www/html/python Summary: An interpreted, interactive, object-oriented programming language. Summary(ja): オブジェクト指向 Python3 インタプリタ Name: python3 Version: 3.8.6 Release: 1%{?_dist_release} Group: programming Vendor: Project Vine Distribution: Vine Linux License: Python URL: http://www.python.org/download/releases/%{version} Source0: https://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz Source1: https://docs.python.org/ftp/python/doc/%{version}/python-%{version}-docs-html.tar.bz2 # (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 # 00102 # ec4353c0f646eb567cc0d63e1e41eb5e29cc3e81 # Change the various install paths to use /usr/lib64/ instead or /usr/lib/ # # Only used when "%%{_lib}" == "lib64". Patch102: 00102-lib64.patch # 00111 # 03918d404a40a50c9f5f93dc748b52e613d70d31 # Don't try to build a libpythonMAJOR.MINOR.a # # Downstream only: not appropriate for upstream. # # See https://bugzilla.redhat.com/show_bug.cgi?id=556092 Patch111: 00111-no-static-lib.patch # 00189 # adf51ed04ac74fd6fc39c642af35b87680c71dab # Instead of bundled wheels, use our RPM packaged wheels # # We keep them in /usr/share/python-wheels # # Downstream only: upstream bundles # We might eventually pursuit upstream support, but it's low prio Patch189: 00189-use-rpm-wheels.patch # 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 20.1.1 %global setuptools_version 47.1.0 # 00251 # 2eabd04356402d488060bc8fe316ad13fc8a3356 # Change user install 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 pip and distutils install into separate location. # # Fedora Change: https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe # Downstream only: Awaiting resources to work on upstream PEP Patch251: 00251-change-user-install-location.patch # 00274 # 1e9258f6e8f70e86d5130113d3eed22993cf3da9 # Upstream uses Debian-style architecture naming, change to match Fedora Patch274: 00274-fix-arch-names.patch # 00328 # 367fdcb5a075f083aea83ac174999272a8faf75c # 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 BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildRequires: autoconf BuildRequires: bzip2-devel BuildRequires: expat-devel 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 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 tools Summary: A collection of development tools included with Python. Group: programming 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. 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 -q -n Python-%{version} # 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 # # Apply patches: # %patch1 -p1 %if "%{_lib}" == "lib64" %patch102 -p1 %endif %patch111 -p1 %if %{with rpmwheels} %patch189 -p1 rm Lib/ensurepip/_bundled/*.whl %endif %patch251 -p1 %patch274 -p1 %patch328 -p1 # 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 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)" ./configure \ --prefix=%{_prefix} \ --libdir=%{_libdir} \ --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 \ --with-valgrind \ --without-ensurepip \ --enable-optimizations \ %{nil} make %{?_smp_mflags} CFLAGS_NODIST="$CFLAGS_NODIST" \ regen-all PYTHON_FOR_REGEN="python%{binsuffix}" make %{?_smp_mflags} CFLAGS_NODIST="$CFLAGS_NODIST" %install [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT 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}", "%{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} # 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-' \ >> mainpkg.files 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}$' >> 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 ) # 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.$$ %if %{with run_test} %check make test %endif %clean rm -fr $RPM_BUILD_ROOT %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files -f mainpkg.files %defattr(-, root, root) %license LICENSE %doc Misc/ACKS Misc/HISTORY Misc/NEWS Misc/Porting Misc/README %attr(755,root,root) %dir %{python_lib}/ %{_libdir}/libpython* %{_mandir}/man1/python%{libvers}.1* %{_mandir}/man1/%{name}.1* %files devel %defattr(-,root,root) %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 %files -f tools.files tools %defattr(-,root,root) %files tkinter %defattr(-,root,root) %{python_lib}/tkinter %{python_lib}/lib-dynload/_tkinter.*.so* %files docs %defattr(-,root,root) %{config_htmldir}/* %changelog * 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