python2/python2.spec
2019-11-06 19:50:48 +08:00

308 lines
9.4 KiB
RPMSpec

%global pybasever 2.7
%global pylibdir %{_libdir}/python%{pybasever}
%global tools_dir %{pylibdir}/Tools
%global demo_dir %{pylibdir}/Demo
%global dynload_dir %{pylibdir}/lib-dynload
%global site_packages %{pylibdir}/site-packages
%undefine __brp_python_bytecompile
%undefine py_auto_byte_compile
%undefine _debuginfo_subpackages
Name: python2
Version: 2.7.16
Release: 3
Summary: Python is an interpreted, interactive object-oriented programming language suitable
License: Python
URL: https://www.python.org/
Source0: https://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz
#custom modifications
Patch0: python-2.7.1-config.patch
Patch16: python-2.6-rpath.patch
Patch102: 00102-2.7.13-lib64.patch
Patch103: python-2.7-lib64-sysconfig.patch
Patch104: 00104-lib64-fix-for-test_install.patch
Patch121: 00121-add-Modules-to-build-path.patch
Patch165: 00165-crypt-module-salt-backport.patch
Patch187: 00187-add-RPATH-to-pyexpat.patch
Patch189: 00189-use-rpm-wheels.patch
Patch193: 00193-enable-loading-sqlite-extensions.patch
#upstream patches
Patch6035: 0342-bpo-36126-Fix-ref-count-leakage-in-structseq_repr.-G.patch
Patch6036: 0349-2.7-bpo-13096-Fix-memory-leak-in-ctypes-POINTER-hand.patch
Patch6037: 0350-2.7-bpo-36179-Fix-ref-leaks-in-_hashopenssl-GH-12158.patch
Patch6038: 0351-2.7-bpo-36149-Fix-potential-use-of-uninitialized-mem.patch
Patch6039: 0353-2.7-bpo-36186-Fix-linuxaudiodev.linux_audio_device-e.patch
Patch6040: 0354-bpo-36147-Fix-a-memory-leak-in-ctypes-s_get-GH-12102.patch
Patch6041: 0357-bpo-36140-Fix-an-incorrect-check-in-msidb_getsummary.patch
Patch6042: 0358-2.7-IDLE-Fix-typo-in-keybindingDialog.py-GH-2322-GH-.patch
Patch6044: python2-CVE-2019-9948-1.patch
Patch6045: python2-CVE-2019-9948-2.patch
Patch6047: CVE-2019-9740.patch
BuildRequires: libdb-devel libffi-devel valgrind-devel ncurses-devel expat-devel readline-devel
BuildRequires: openssl-devel libtirpc-devel tcl-devel tk-devel glibc-devel libnsl2-devel
BuildRequires: zlib-devel tix-devel gdbm-devel sqlite-devel chrpath
Requires: expat glibc gdbm python-setuptools-wheel python-pip-wheel
Recommends: python2-setuptools python2-pip
Provides: python = %{version}-%{release}
Provides: python27 = %{version}-%{release}
Provides: python(abi) = %{pybasever}
Obsoletes: python-libs < %{version}-%{release}
Obsoletes: python-libs%{?_isa} < %{version}-%{release}
Obsoletes: %{name}-libs < %{version}-%{release}
Obsoletes: %{name}-libs%{?_isa} < %{version}-%{release}
Provides: python-libs = %{version}-%{release}
Provides: python-libs%{?_isa} = %{version}-%{release}
Provides: %{name}-libs = %{version}-%{release}
Provides: %{name}-libs%{?_isa} = %{version}-%{release}
Obsoletes: python-unversioned-command < %{version}-%{release}
Provides: python-unversioned-command = %{version}-%{release}
%description
Python 2.x series is the old version that is incompatible with the 3.x series.
The EOL of Python 2.x upstream is January 2020, there will no updates,
Our suggestions for switching to Python3 as soon as possible.
%package tkinter
Summary: A graphical user interface for the Python 2 scripting language
Requires: %{name} = %{version}-%{release}
Obsoletes: tkinter < %{version}-%{release}
Obsoletes: tkinter%{?_isa} < %{version}-%{release}
Obsoletes: tkinter2 < %{version}-%{release}
Obsoletes: tkinter2%{?_isa} < %{version}-%{release}
Obsoletes: python-tkinter < %{version}-%{release}
Obsoletes: python-tkinter%{?_isa} < %{version}-%{release}
Provides: tkinter = %{version}-%{release}
Provides: tkinter%{?_isa} = %{version}-%{release}
Provides: tkinter2 = %{version}-%{release}
Provides: tkinter2%{?_isa} = %{version}-%{release}
Provides: python-tkinter = %{version}-%{release}
Provides: python-tkinter%{?_isa} = %{version}-%{release}
%description tkinter
The Tkinter (Tk interface) program is an graphical user interface for
the Python 2 scripting language.
%package devel
Summary: Development files for %{name}
Requires: %{name} = %{version}-%{release}
Requires: python-rpm-macros
Requires: python2-rpm-macros
Requires: pkgconfig
Requires: python2-setuptools
Requires: openEuler-rpm-config
Requires: python3-rpm-generators
Provides: python-devel = %{version}-%{release}
Provides: python-devel%{?_isa} = %{version}-%{release}
Obsoletes: python-test < %{version}-%{release}
Obsoletes: python-test%{?_isa} < %{version}-%{release}
Provides: python-test = %{version}-%{release}
Provides: python-test%{?_isa} = %{version}-%{release}
Obsoletes: %{name}-test < %{version}-%{release}
Obsoletes: %{name}-test%{?_isa} < %{version}-%{release}
Provides: %{name}-test = %{version}-%{release}
Provides: %{name}-test%{?_isa} = %{version}-%{release}
%description devel
This package contains libraries and header files used to build applications
with and native libraries for Python2.
%package tools
Summary: A collection of development tools included with Python 2
Requires: %{name} = %{version}-%{release}
Requires: %{name}-tkinter = %{version}-%{release}
Provides: python-tools = %{version}-%{release}
Provides: python-tools%{?_isa} = %{version}-%{release}
%description tools
This package includes several tools to help with the development of Python 2
programs, including IDLE (an IDE with editing and debugging facilities), a
color editor (pynche), and a python gettext program (pygettext.py).
%package help
Summary: Man pages for %{name}
BuildArch: noarch
%description help
%{summary}.
%prep
%autosetup -n Python-%{version} -p1
mv Modules/cryptmodule.c Modules/_cryptmodule.c
%build
%configure \
--enable-ipv6 \
--enable-shared \
--enable-unicode=ucs4 \
--with-dbmliborder=gdbm:ndbm:bdb \
--with-system-expat \
--with-system-ffi \
--with-dtrace \
--with-tapset-install-dir=%{tapsetdir} \
--with-valgrind
%make_build
#Fix "WARNING: mangling shebang"
pybuilddir=$(pwd)
LD_LIBRARY_PATH=$pybuilddir \
./python $pybuilddir/Tools/scripts/pathfix.py -i "%{_bindir}/python2" \
$pybuilddir
%install
%make_install
install -d -m755 %{buildroot}/%{_prefix}/lib/python%{pybasever}/site-packages
mv %{buildroot}%{_bindir}/idle %{buildroot}%{_bindir}/idle%{pybasever}
%{__ln_s} idle%{pybasever} %{buildroot}%{_bindir}/idle2
%{__ln_s} idle2 %{buildroot}%{_bindir}/idle
mv %{buildroot}%{_bindir}/pydoc %{buildroot}%{_bindir}/pydoc%{pybasever}
%{__ln_s} pydoc%{pybasever} %{buildroot}%{_bindir}/pydoc2
%{__ln_s} pydoc2 %{buildroot}%{_bindir}/pydoc
mv %{buildroot}%{_bindir}/smtpd.py %{buildroot}%{_bindir}/smtpd%{pybasever}.py
%{__ln_s} smtpd%{pybasever}.py %{buildroot}%{_bindir}/smtpd2.py
%{__ln_s} smtpd2.py %{buildroot}%{_bindir}/smtpd.py
rm -f %{buildroot}%{pylibdir}/LICENSE.txt
find %{buildroot} -name "*.bat" | xargs rm -f
# Ensure the libs readable
%{__chmod} 755 %{buildroot}%{dynload_dir}/*.so
%{__chmod} 755 %{buildroot}%{_libdir}/libpython%{pybasever}.so.1.0
chrpath -d $(find %{buildroot} -name pyexpat.so)
%check
#make test || :
%files
%defattr(-,root,root)
%license LICENSE
%doc README
%{_bindir}/pydoc*
%{_bindir}/{python,python2,python%{pybasever}}
%dir %{_prefix}/lib/python%{pybasever}
%dir %{_prefix}/lib/python%{pybasever}/site-packages
%{_libdir}/libpython%{pybasever}.so.1.0
%dir %{pylibdir}
%{dynload_dir}/
%exclude %{dynload_dir}/_ctypes_test.so
%exclude %{dynload_dir}/_tkinter.so
%dir %{site_packages}
%{site_packages}/README
%{pylibdir}/*.py*
%{pylibdir}/*.doc
%{pylibdir}/*.egg-info
%dir %{pylibdir}/bsddb
%{pylibdir}/bsddb/*.py*
%dir %{pylibdir}/compiler
%{pylibdir}/compiler/*.py*
%dir %{pylibdir}/ctypes
%{pylibdir}/ctypes/*.py*
%{pylibdir}/ctypes/macholib
%dir %{pylibdir}/curses
%{pylibdir}/curses/*.py*
%dir %{pylibdir}/distutils
%{pylibdir}/distutils/*.py*
%{pylibdir}/distutils/README
%{pylibdir}/distutils/command
%exclude %{pylibdir}/distutils/command/*.exe
%dir %{pylibdir}/email
%{pylibdir}/email/*.py*
%{pylibdir}/email/mime
%{pylibdir}/encodings
%{pylibdir}/hotshot
%{pylibdir}/idlelib
%{pylibdir}/importlib
%dir %{pylibdir}/json
%{pylibdir}/json/*.py*
%{pylibdir}/lib2to3
%exclude %{pylibdir}/lib2to3/tests
%{pylibdir}/logging
%{pylibdir}/multiprocessing
%{pylibdir}/plat-linux2
%{pylibdir}/pydoc_data
%dir %{pylibdir}/sqlite3
%{pylibdir}/sqlite3/*.py*
%{pylibdir}/unittest
%{pylibdir}/wsgiref
%{pylibdir}/xml
%dir %{pylibdir}/ensurepip
%{pylibdir}/ensurepip/*.py*
%exclude %{pylibdir}/ensurepip/_bundled
%dir %{pylibdir}/test
%{pylibdir}/test/__init__.py*
%{pylibdir}/test/support/
%{pylibdir}/test/script_helper.py*
%{pylibdir}/test/test_support.py*
%files tkinter
%defattr(-,root,root)
%{pylibdir}/lib-tk
%{dynload_dir}/_tkinter.so
%files devel
%defattr(-,root,root)
#Development files
%{pylibdir}/config/
%{_includedir}/python%{pybasever}/*.h
%{_libdir}/pkgconfig/python*.pc
%{_libdir}/libpython%{pybasever}.so
%{_bindir}/python*-config
#Tests
%{pylibdir}/bsddb/test
%{pylibdir}/ctypes/test
%{pylibdir}/distutils/tests
%{pylibdir}/email/test
%{pylibdir}/json/tests
%{pylibdir}/lib2to3/tests
%{pylibdir}/sqlite3/test
%{pylibdir}/test/*
%exclude %{pylibdir}/test/__init__.py*
%exclude %{pylibdir}/test/support/
%exclude %{pylibdir}/test/script_helper.py*
%exclude %{pylibdir}/test/test_support.py*
%{dynload_dir}/_ctypes_test.so
%files tools
%{_bindir}/idle*
%{_bindir}/smtpd*.py*
%exclude %{_bindir}/2to3*
%files help
%defattr(-,root,root)
%{_mandir}/man1/python*.1.*
%changelog
* Tue Oct 15 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.7.16-3
- Provides python2-test
* Wed Sep 26 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.7.16-2
- Package init
* Tue Sep 25 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.7.16-1
- Package init