# ================== # Top-level metadata # ================== %global pybasever 3.10 # pybasever without the dot: %global pyshortver 310 # _libdir=/usr/lib64 got error: # Could not find platform dependent libraries # Consider setting $PYTHONHOME to [:] ##global _libdir /usr/lib #exclude the /usr/local/bin/python dependency from being added. %global __requires_exclude /usr/local/bin/python # RHEL7: Completely disabling bytecompiletion is not supported on RHEL7 and # it's too late/risky to backport it. Therefore we instead force # bytecompilation with Python 3 and stop bytecompilation errors from # terminating the build (due to "bad code" files for testing syntax, and also # during bootstrapping when /usr/bin/python3 is not yet present). %global _python_bytecompile_errors_terminate_build 0 # Disable automatic bytecompilation. The python3 binary is not yet be # available in /usr/bin when Python is built. Also, the bytecompilation fails # on files that test invalid syntax. ##undefine py_auto_byte_compile # disable the default “mangle shebangs” build‐root # policy so our Python scripts keep their original # `#!/usr/bin/python3.10` (and aren’t rewritten to /usr/bin/python) ##undefine __brp_mangle_shebangs # Define __python as /usr/bin/python3 so that the brp-python-bytecompile script # is invoked with it and automatic bytecompilation in __os_install_post is done # with python3 rather than python2 %global __python %{__python3} # ===================== # General global macros # ===================== #global pylibdir #{_libdir}/python#{pybasever} #global dynload_dir_S %{pylibdir}/lib-dynload Name: python3.10 Version: 3.10.20 Release: 1%{?dist} Summary: python3 - Interpreter of the Python programming language Group: System Environment License: Python URL: https://www.python.org/ %undefine _disable_source_fetch Source0: https://www.python.org/ftp/python/%{version}/Python-%{version}.tgz Packager: %packager BuildRequires: gcc gcc-c++ openssl-devel bzip2-devel libffi-devel BuildRequires: /usr/bin/pathfix.py #for py3_shebang_fix BuildRequires: python3-rpm-macros BuildRequires: ncurses-devel expat-devel readline-devel libuuid-devel xz-devel sqlite-devel gdbm-devel tcl-devel tk-devel %define debug_package %nil %description Python is an accessible, high-level, dynamically typed, interpreted programming language, designed with an emphasis on code readability. It includes an extensive standard library, and has a vast ecosystem of third-party libraries. The python3 package provides the "python3" executable: the reference interpreter for the Python language, version 3. The majority of its standard library is provided in the python3-libs package, which should be installed automatically along with python3. The remaining parts of the Python standard library are broken out into the python3-tkinter and python3-test packages, which may need to be installed separately. Documentation for Python is provided in the python3-docs package. Packages containing additional libraries for Python are generally named with the "python3.8-" prefix. %prep %setup -q -n Python-%{version} find -name '*.exe' -print -delete ##py3_shebang_fix Lib %build #--prefix=/usr --libdir=/usr/lib64 #7 #for buiding module #CXX=/usr/bin/g++ \ #https://docs.python.org/3/using/configure.html#performance-options --enable-optimizations # Could not find platform dependent libraries # Consider setting $PYTHONHOME to [:] ./configure --with-lto \ --prefix=%{_prefix} --libdir=%{_libdir} \ --enable-shared --enable-optimizations --with-platlibdir=lib64 #fast test #make profile-gen-stamp; ./python -m test.regrtest --pgo -j8; make build_all_merge_profile; touch profile-run-stamp; make %{?_smp_mflags} %install [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT make DESTDIR=$RPM_BUILD_ROOT altinstall rm $RPM_BUILD_ROOT%{_libdir}/libpython3.so #pathfix.py from python3-devel #fix hashbang /usr/bin/python => /usr/bin/python3.x pathfix.py -i "%{_bindir}/python%{pybasever}" -pn %{buildroot}%{_bindir}/* %{buildroot}%{_libdir}/%{name}/ # Get rid of DOS batch files: find $RPM_BUILD_ROOT -name \*.bat -exec rm {} \; %post if [ $1 == 1 ]; then /usr/sbin/ldconfig fi # %postun # if [ $1 == 0 ]; then # rm -rf /usr/lib/python%{pybasever} # fi %clean [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT %files /usr/bin/2to3-%{pybasever} /usr/bin/idle%{pybasever} /usr/bin/pip%{pybasever} /usr/bin/pydoc%{pybasever} /usr/bin/python%{pybasever} /usr/bin/python%{pybasever}-config %{_libdir}/libpython%{pybasever}.so %{_libdir}/libpython%{pybasever}.so.1.0 %{_libdir}/pkgconfig/python-%{pybasever}-embed.pc %{_libdir}/pkgconfig/python-%{pybasever}.pc %{_libdir}/python%{pybasever}/* /usr/lib/python%{pybasever}/* /usr/include/python%{pybasever}/* /usr/share/man/man1/python%{pybasever}.1.gz