%define python_version 3.7.12 Version: %{python_version} Summary: Python %{python_version} from straightforward source build Name: clean_python37 Release: 1 License: Python Group: Development/Languages Source0: https://www.python.org/ftp/python/%{version}/Python-%{version}.tgz AutoReqProv: no requires: bzip2 requires: gdbm requires: glibc requires: gmp requires: libgcc requires: libstdc++ requires: ncurses requires: openssl requires: readline requires: xz-libs requires: zlib BuildRequires: bzip2-devel BuildRequires: gdbm-devel BuildRequires: libffi-devel BuildRequires: ncurses-devel BuildRequires: openssl-devel BuildRequires: readline-devel BuildRequires: sqlite-devel BuildRequires: xz-devel BuildRequires: zlib-devel BuildRoot: /tmp/%{name} %description A clean python %prep %setup -n Python-%{version} %build rm -rf %{buildroot} ./configure --enable-ipv6 --enable-unicode=ucs2 --enable-shared \ --prefix=/opt/%{name}/%{version} make LDFLAGS="$LDFLAGS -Wl,-rpath=/opt/%{name}/%{version}/lib" make install DESTDIR=$RPM_BUILD_ROOT find %{buildroot}/opt/%{name}/%{version}/lib -name '*.py[oc]' -exec rm {} \; mkdir -p %{buildroot}/etc/ld.so.conf.d cat << EOF | tee %{buildroot}/etc/ld.so.conf.d/%{name}.conf /opt/%{name}/%{version}/lib EOF %post alternatives \ --install /usr/bin/python3 python3 /opt/%{name}/%{version}/bin/python3 1 \ --slave /usr/bin/pip3 pip3 /opt/%{name}/%{version}/bin/pip3 ldconfig -v %postun alternatives \ --remove python3 /opt/%{name}/%{version}/bin/python3 ldconfig -v %files %attr(-, root, root) /opt/%{name}/%{version} %attr(-, root, root) /etc/ld.so.conf.d/%{name}.conf