# ================== # Top-level metadata # ================== %global pybasever 3.7 # pybasever without the dot: %global pyshortver 37 # 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 # 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 /usr/bin/python%{pybasever} # ===================== # General global macros # ===================== #%global pylibdir %{_libdir}/python%{pybasever} #%global dynload_dir %{pylibdir}/lib-dynload Name: python37 Version: 3.7.15 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++ openssl11-devel bzip2-devel libffi-devel python3 python3-libs python3-devel BuildRequires: ncurses-devel expat-devel readline-devel libuuid-devel xz-devel tkinter sqlite-devel gdbm-devel tcl-devel tk-devel %define debug_package %nil Provides: /usr/local/bin/python %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.7-" prefix. %prep %setup -q -n Python-%{version} find -name '*.exe' -print -delete %build #--prefix=/usr --libdir=/usr/lib64 export LDFLAGS="${LDFLAGS} -L/usr/lib64/openssl11 -lssl -lcrypto" export CPPFLAGS="${CPPFLAGS} -I/usr/include/openssl11" #for buiding module export OPENSSL_INCLUDES="-I/usr/include/openssl11" export OPENSSL_LDFLAGS="-L/usr/lib64/openssl11" export OPENSSL_LIBS="-lssl -lcrypto" CXX=/usr/bin/g++ \ #https://docs.python.org/3/using/configure.html#performance-options --enable-optimizations --libdir=/usr/lib64 --bindir=/usr/bin ./configure --with-lto \ --prefix=%{_prefix} --includedir=/usr/include/python%{pybasever}m \ --enable-shared #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/usr/lib/libpython3.so #pathfix.py from python3-devel pathfix.py -i "%{_bindir}/python%{pybasever}" -pn \ $RPM_BUILD_ROOT/usr/bin/* # 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/local/lib/python%{pybasever} fi %clean [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT %files /usr/bin/* /usr/include/python%{pybasever}m/* /usr/lib/libpython%{pybasever}m.so /usr/lib/libpython%{pybasever}m.so.1.0 /usr/lib/pkgconfig/python-%{pybasever}.pc /usr/lib/python%{pybasever}/* /usr/share/man/man1/python%{pybasever}.1.gz