From be4323846244608c0cb4374e2d83b71db55e501c Mon Sep 17 00:00:00 2001 From: slava86 Date: Tue, 19 May 2020 03:39:37 +0000 Subject: [PATCH] package py38 rosa20190* --- python3.spec | 115 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 93 insertions(+), 22 deletions(-) diff --git a/python3.spec b/python3.spec index c47e607..a6f864b 100644 --- a/python3.spec +++ b/python3.spec @@ -3,9 +3,9 @@ %define familyver 3 %define lib_major %{dirver} -%define lib_name_orig libpython%{familyver} +%define lib_name_orig libpython%{sub_ver} %define lib_name %mklibname python %{lib_major} -%define develname %mklibname python3 -d +%define develname %mklibname python%{sub_ver} -d %ifarch %{ix86} x86_64 ppc %bcond_with valgrind @@ -15,6 +15,24 @@ %bcond_without rewheel +####### python38 rosa201905 ############### + +%bcond_without py38 + +%if %{with py38} +%define py3_name python38 +%else +%define py3_name python3 +%endif + +%if %{with py38} +%define sub_ver 38 +%else +%define sub_ver %{familyver} +%endif + +########################################### + # We want to byte-compile the .py files within the packages using the new # python3 binary. # @@ -31,7 +49,7 @@ %define _python_bytecompile_build 0 Summary: An interpreted, interactive object-oriented programming language -Name: python3 +Name: %{py3_name} Version: 3.8.2 Release: 1 License: Modified CNRI Open Source License @@ -41,7 +59,7 @@ Source0: https://www.python.org/ftp/python/%{version}/Python-%{version}. Source1: https://docs.python.org/3/archives/python-%{docver}-docs-html.tar.bz2 Source2: python3.macros Source3: pybytecompile.macros -Source100: %{name}.rpmlintrc +Source100: python3.rpmlintrc # 00001 # # Fixup distutils/unixccompiler.py to remove standard library path from rpath: @@ -131,9 +149,11 @@ BuildRequires: python3-pip Provides: python(abi) = %{dirver} Provides: /usr/bin/python%{dirver}m Provides: /usr/bin/python%{dirver} +%if %{without py38} Provides: /usr/bin/python Provides: /usr/bin/python%{familyver} Provides: python = %{version}-%{release} +%endif %description Python is an interpreted, interactive, object-oriented programming @@ -197,26 +217,26 @@ 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 +%package -n tkinter%{sub_ver} Summary: A graphical user interface for the Python scripting language Group: Development/Python Requires: %{name} = %{version} Requires: tcl tk -Provides: python3-tkinter +Provides: python%{sub_ver}-tkinter -%description -n tkinter3 +%description -n tkinter%{sub_ver} 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 -n tkinter3-apps +%package -n tkinter%{sub_ver}-apps Summary: Various applications written using tkinter Group: Development/Python -Requires: tkinter3 +Requires: tkinter%{sub_ver} -%description -n tkinter3-apps +%description -n tkinter%{sub_ver}-apps Various applications written using tkinter @@ -321,7 +341,6 @@ ln -sf python%{dirver} python%{familyver} popd (cd %{buildroot}%{_libdir}; ln -sf `ls libpython%{lib_major}*.so.*` libpython%{lib_major}.so) - # install pynche as pynche3 cat << EOF > %{buildroot}%{_bindir}/pynche3 #!/bin/bash @@ -339,13 +358,13 @@ install Misc/valgrind-python.supp -D %{buildroot}%{_libdir}/valgrind/valgrind-py %endif mkdir -p %{buildroot}%{_datadir}/applications -cat > %{buildroot}%{_datadir}/applications/rosa-tkinter3.desktop << EOF +cat > %{buildroot}%{_datadir}/applications/rosa-tkinter%{sub_ver}.desktop << EOF [Desktop Entry] Name=IDLE Name[ru]=IDLE Comment=IDE for Python3 Comment[ru]=IDE для Python3 -Exec=%{_bindir}/idle3 +Exec=%{_bindir}/idle%{dirver} Icon=development_environment_section Terminal=false Type=Application @@ -372,8 +391,9 @@ find %{buildroot} -type f \( -name "test_binascii.py*" -o -name "test_grp.py*" - # fix python library not stripped chmod u+w %{buildroot}%{_libdir}/libpython%{lib_major}*.so.1.0 %{buildroot}%{_libdir}/libpython3.so - +%if %{without py38} %install_macro python3 %{SOURCE2} +%endif %install_macro pybytecompile %{SOURCE3} ln -s python3 %{buildroot}%{_bindir}/python @@ -384,6 +404,36 @@ ln -s python3-config %{buildroot}%{_bindir}/python-config # See https://github.com/fedora-python/python-rpm-porting/issues/24 cp -p Tools/scripts/pathfix.py %{buildroot}%{_bindir}/ +%if %{with py38} +mv %{buildroot}%{_bindir}/pynche3 \ + %{buildroot}%{_bindir}/pynche%{sub_ver} + +# 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.8 ################## + +find %{buildroot} -type f -print | while read -r line ; do + if file "$line" | grep -q ELF ; then continue ; fi + if head -n 1 "$line" | grep -v python3.8 | grep -q python3 ; then + sed -i -e '1s,python3,python3.8,g' "$line" + fi +done + +### warning!!! replaced only python3 with python3.8, macros are still the same ### +%if %{mdvver} > 20190 +cp -fr %{S:2} %{buildroot}%{_rpmmacrodir}/python38.macros +%else +cp -fr %{S:2} %{buildroot}%{_rpmmacrodir}/macros.python38 + %endif + sed -i -e "1s|/usr/bin/python3|/usr/bin/python3.8|" %{buildroot}%{_rpmmacrodir}/*python38* +%endif + %check # (misc) if the home is nfs mounted, rmdir fails export TMP="/tmp" TMPDIR="/tmp" @@ -439,13 +489,23 @@ export TMP="/tmp" TMPDIR="/tmp" %{_bindir}/pathfix.py %{_bindir}/pydoc3* %{_bindir}/python3* -%{_bindir}/pydoc -%{_bindir}/python +%if %{with py38} +%exclude %{_bindir}/pydoc +%exclude %{_bindir}/pydoc3 +%exclude %{_bindir}/python +%exclude %{_bindir}/python3 +%exclude %{_bindir}/2to3 +%else %{_bindir}/2to3 +%endif %{_bindir}/2to3-%{dirver} # do not exclude it # requires by systemtap +%if %{with py38} +%exclude %{_bindir}/python*config +%else %{_bindir}/python*config +%endif #%{_datadir}/emacs/site-lisp/* %{_mandir}/man*/* %if %{with valgrind} @@ -456,13 +516,19 @@ export TMP="/tmp" TMPDIR="/tmp" %{_libdir}/libpython*.so.1* %files -n %{develname} +%if %{with py38} +%exclude %{_libdir}/libpython3.so +%exclude %{_libdir}/pkgconfig/python3.pc +%endif %{_libdir}/libpython*.so +%{_libdir}/pkgconfig/python*.pc %{_includedir}/python* %{_libdir}/python*/config-* -%{_libdir}/python*/test/ %{_bindir}/python%{dirver}*-config +%if %{without py38} %{_bindir}/python%{familyver}-config -%{_libdir}/pkgconfig/python*.pc +%endif +%{_libdir}/python*/test/ #%{_libdir}/python*/config-* %exclude %{_includedir}/python*/pyconfig.h %exclude %{_libdir}/python*/config*/Makefile @@ -471,13 +537,18 @@ export TMP="/tmp" TMPDIR="/tmp" %doc html/*/* %{_datadir}/applications/rosa-%{name}-docs.desktop -%files -n tkinter3 +%files -n tkinter%{sub_ver} %{_libdir}/python*/tkinter/ %{_libdir}/python*/idlelib %{_libdir}/python*/site-packages/pynche %{_libdir}/python*/lib-dynload/_tkinter.*.so -%files -n tkinter3-apps +%files -n tkinter%{sub_ver}-apps +%if %{with py38} +%exclude %{_bindir}/idle3 +%endif %{_bindir}/idle3* -%{_bindir}/pynche3 -%{_datadir}/applications/rosa-tkinter3.desktop +%{_bindir}/pynche%{sub_ver} +%{_datadir}/applications/rosa-tkinter%{sub_ver}.desktop + +