From 1b8d3bb9ff170a533ac5015d27562257ba169148 Mon Sep 17 00:00:00 2001 From: YellowJacketLinux Date: Wed, 10 May 2023 02:37:48 -0700 Subject: [PATCH] Python3 --- SOURCES/rpm-macros-python-3.11 | 19 ++++ SPECS/python3-pip.spec | 83 ++++++++++++++ SPECS/python3.spec | 199 +++++++++++++++++++++++++++++++++ 3 files changed, 301 insertions(+) create mode 100644 SOURCES/rpm-macros-python-3.11 create mode 100644 SPECS/python3-pip.spec create mode 100644 SPECS/python3.spec diff --git a/SOURCES/rpm-macros-python-3.11 b/SOURCES/rpm-macros-python-3.11 new file mode 100644 index 0000000..a85f498 --- /dev/null +++ b/SOURCES/rpm-macros-python-3.11 @@ -0,0 +1,19 @@ +##### Begin Python3 Macros +# This file should be owned by the python3-devel package +# and should not be modified. +# +# Version definitions +%python3_version 3.11 +%python3_nodots 311 +# General macros +%__python3 /usr/bin/python3 +%python3 %__python3 +%python3_sitelib /usr/lib/python%{python3_version}/site-packages +%python3_sitearch /usr/lib/python%{python3_version}/site-packages +%python3_platform linux-%{_arch} +# YJL specific macros +%python3_os_platform %{_arch}-linux-gnu +%python3_API Python-%{python3_version} +%python3_ABI %{python3_API}-%{python3_os_platform} +# +#### End Python3 Macros diff --git a/SPECS/python3-pip.spec b/SPECS/python3-pip.spec new file mode 100644 index 0000000..9b7fef6 --- /dev/null +++ b/SPECS/python3-pip.spec @@ -0,0 +1,83 @@ +%global gittag 23.1.2 + +Name: python3-pip +Version: %{gittag} +Release: %{?repo}0.rc1%{?dist} +Summary: Package Installer for Python +BuildArch: noarch + +Group: Development/Python +License: MIT +URL: https://pip.pypa.io/en/stable/ +Source0: https://github.com/pypa/pip/archive/refs/tags/%{gittag}.tar.gz + +BuildRequires: python3-devel +Requires: python3-devel +Requires: make-ca +%if 0%{?python3_API:1} == 1 +# Non-Standard Macro +Requires: %{python3_API} +%endif + +%description +pip is the package installer for Python. You can use it to install +packages from the Python Package Index and other indexes. + +%prep +%setup -q -n pip-%{gittag} + + +%build +CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" \ +%{python3} setup.py build --executable="%{python3} -s" + +%check +%if 0%{?runtestsBROKEN:1} == 1 +%{python3} setup.py test > %{name}-setup.py.test.log 2>&1 +%else +echo "setup.py test not run during package build" > %{name}-setup.py.test.log +%endif + +%install +CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" \ +%{python3} setup.py install -O1 --skip-build --root %{buildroot} + +# PIP3 certs +[ ! -d %{buildroot}%{_sysconfdir}/profile.d ] && mkdir -p %{buildroot}%{_sysconfdir}/profile.d +cat > %{buildroot}%{_sysconfdir}/profile.d/pythoncerts.sh << "EOF" +# Begin /etc/profile.d/pythoncerts.sh + +export _PIP_STANDALONE_CERT=/etc/pki/tls/certs/ca-bundle.crt + +# End /etc/profile.d/pythoncerts.sh +EOF + +cat > %{buildroot}%{_sysconfdir}/pip.conf << EOF +[global] +root-user-action = ignore +disable-pip-version-check = true +EOF + +%files +%defattr(-,root,root,-) +%attr(0755,root,root) %{_bindir}/pip +%attr(0755,root,root) %{_bindir}/pip3 +%attr(0755,root,root) %{_bindir}/pip3.11 +%dir %{python3_sitelib}/pip +%attr(0644,root,root) %{python3_sitelib}/pip/*.py +%attr(0644,root,root) %{python3_sitelib}/pip/py.typed +%{python3_sitelib}/pip/_internal +%{python3_sitelib}/pip/_vendor +%{python3_sitelib}/pip/__pycache__ +%{python3_sitelib}/pip-%{gittag}-py%{python3_version}.egg-info +%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/pip.conf +%attr(0644,root,root) %{_sysconfdir}/profile.d/pythoncerts.sh +%license LICENSE.txt +%doc AUTHORS.txt LICENSE.txt NEWS.rst README.rst SECURITY.md docs/html +%doc %{name}-setup.py.test.log + + + +%changelog +* Wed May 10 2023 Michael A. Peters - 23.1.2-0.rc1 +- Initial spec file for YJL. diff --git a/SPECS/python3.spec b/SPECS/python3.spec new file mode 100644 index 0000000..5f1d3ee --- /dev/null +++ b/SPECS/python3.spec @@ -0,0 +1,199 @@ +%define specrel 0.rc2 + +%if 0%{?!__sed:1} == 1 +%global __sed %{_bindir}/sed +%endif +%if 0%{?!__tar:1} == 1 +%global __tar %{_bindir}/tar +%endif + +# Version definitions +%define python3_version 3.11 +%define python3_nodots 311 +# General macros +%define __python3 /usr/bin/python3 +%define python3 %__python3 +%define python3_sitelib /usr/lib/python%{python3_version}/site-packages +%define python3_sitearch /usr/lib/python%{python3_version}/site-packages +%define python3_platform linux-%{_arch} +# YJL specific macros +%define python3_os_platform %{_arch}-linux-gnu +%define python3_API Python-%{python3_version} +%define python3_ABI %{python3_API}-%{python3_os_platform} +# + +Name: python3 +Version: %{python3_version}.3 +Release: %{?repo}%{specrel}%{?dist} +Summary: Python3 interpreter + +Group: Programming/Languages +License: PSF-2.0 +URL: https://www.python.org +Source0: https://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz +Source1: https://www.python.org/ftp/python/doc/%{version}/python-%{version}-docs-html.tar.bz2 +Source2: rpm-macros-python-%{python3_version} +Provides: %{name}-libs = %{version}-%{release} +Provides: %{python3_API} +Provides: %{python3_ABI} + +BuildRequires: %{__sed} +BuildRequires: %{__tar} +# This is very incomplete +BuildRequires: pkgconfig(expat) +BuildRequires: pkgconfig(libffi) +BuildRequires: pkgconfig(sqlite3) +BuildRequires: libgdbm-devel +# Use OpenSSL, not LibreSSL --- see PEP 644 +# https://peps.python.org/pep-0644/ +BuildRequires: openssl-devel +#Requires: + +%description +Python is an interpreted, interactive, object-oriented programming +language. It incorporates modules, exceptions, dynamic typing, very +high level dynamic data types, and classes. It supports multiple +programming paradigms beyond object-oriented programming, such as +procedural and functional programming. Python combines remarkable power +with very clear syntax. It has interfaces to many system calls and +libraries, as well as to various window systems, and is extensible in +C or C++. It is also usable as an extension language for applications +that need a programmable interface. Finally, Python is portable: it +runs on many Unix variants including Linux and macOS, and on Windows. + + +%package devel +group: Development/Languages +Summary: Developer files for Python3 +Requires: %{name} = %{version} + +%description devel +This package includes the developer files needed to create extensions +to the python language. + +%package documentation +group: documentation +Summary: Python 3 documentation in HTML +BuildArch: noarch + +%description documentation +This package contains the HTML documentation for Python %{version}. + +%prep +%setup -n Python-%{version} + + +%build +%configure \ + --enable-shared \ + --with-system-expat \ + --with-system-ffi \ + --enable-optimizations +make %{?_smp_mflags} + + +%install +make install DESTDIR=%{buildroot} +install -m755 -d %{buildroot}/usr/lib/rpm/macros.d +install -m644 %{SOURCE2} %{buildroot}/usr/lib/rpm/macros.d/macros.python3 + +# fix reference to /usr/local/bin/python +%{__sed} -i 's?/usr/local/bin/python$?%{_bindir}/python%{python3_version}?' \ + %{buildroot}/usr/lib/python%{python3_version}/cgi.py + +ln -sf python%{python3_version} %{buildroot}%{_bindir}/python +install -v -m755 -d %{buildroot}%{_datadir}/doc/python-%{version}/html +%{__tar} --strip-components=1 \ + --no-same-owner \ + --no-same-permissions \ + -C %{buildroot}%{_datadir}/doc/python-%{version}/html \ + -xvf %{SOURCE1} + +%files +%defattr(-,root,root,-) +%{_bindir}/idle3 +%attr(0755,root,root) %{_bindir}/idle%{python3_version} +%{_bindir}/python +%{_bindir}/python3 +%attr(0755,root,root) %{_bindir}/python%{python3_version} +%{_libdir}/libpython3.11.so +%attr(0755,root,root) %{_libdir}/libpython3.11.so.1.0 +%dir /usr/lib/python%{python3_version} +%dir /usr/lib/python%{python3_version}/config-%{python3_version}-%{python3_os_platform} +/usr/lib/python%{python3_version}/LICENSE.txt +/usr/lib/python%{python3_version}/*.py +/usr/lib/python%{python3_version}/__phello__ +/usr/lib/python%{python3_version}/__pycache__ +/usr/lib/python%{python3_version}/asyncio +/usr/lib/python%{python3_version}/collections +/usr/lib/python%{python3_version}/concurrent +/usr/lib/python%{python3_version}/ctypes +/usr/lib/python%{python3_version}/curses +/usr/lib/python%{python3_version}/dbm +/usr/lib/python%{python3_version}/distutils +/usr/lib/python%{python3_version}/email +/usr/lib/python%{python3_version}/encodings +/usr/lib/python%{python3_version}/ensurepip +/usr/lib/python%{python3_version}/html +/usr/lib/python%{python3_version}/http +/usr/lib/python%{python3_version}/idlelib +/usr/lib/python%{python3_version}/importlib +/usr/lib/python%{python3_version}/json +/usr/lib/python%{python3_version}/lib-dynload +/usr/lib/python%{python3_version}/lib2to3 +/usr/lib/python%{python3_version}/logging +/usr/lib/python%{python3_version}/multiprocessing +/usr/lib/python%{python3_version}/pydoc_data +/usr/lib/python%{python3_version}/re +/usr/lib/python%{python3_version}/site-packages +/usr/lib/python%{python3_version}/sqlite3 +/usr/lib/python%{python3_version}/test +/usr/lib/python%{python3_version}/tkinter +/usr/lib/python%{python3_version}/tomllib +/usr/lib/python%{python3_version}/turtledemo +/usr/lib/python%{python3_version}/unittest +/usr/lib/python%{python3_version}/urllib +/usr/lib/python%{python3_version}/venv +/usr/lib/python%{python3_version}/wsgiref +/usr/lib/python%{python3_version}/xml +/usr/lib/python%{python3_version}/xmlrpc +/usr/lib/python%{python3_version}/zoneinfo +%{_mandir}/man1/python3* +%license LICENSE +%doc LICENSE README.rst + +%files devel +%defattr(-,root,root,-) +%{_bindir}/2to3 +%attr(0755,root,root) %{_bindir}/2to3-%{python3_version} +%{_bindir}/python3-config +%attr(0755,root,root) %{_bindir}/python%{python3_version}-config +%{_includedir}/python%{python3_version} +%{_libdir}/libpython3.so +%{_libdir}/pkgconfig/*.pc +/usr/lib/rpm/macros.d/macros.python3 +/usr/lib/python%{python3_version}/config-%{python3_version}-%{python3_os_platform} + +%files documentation +%defattr(-,root,root,-) +%{_bindir}/pydoc3 +%attr(0755,root,root) %{_bindir}/pydoc%{python3_version} +%{_datadir}/doc/python-%{version}/html + +%changelog +* Wed May 10 2023 Michael A. Peters - 3.11.3-0.rc2 +- Build against OpenSSL instead of LibreSSL + +* Tue Apr 25 2023 Michael A. Peters - 3.11.3-0.rc1 +- Update to 3.11.3 + +* Mon Apr 03 2023 Michael A. Peters - 3.11.2-0.rc2 +- Make /usr/bin/python symbolic link +- NEEDS from 2023-03-22 still apply + +* Wed Mar 22 2023 Michael A. Peters - 3.11.2-0.rc1 +- Initial spec file for YJL (RPM bootstrapping LFS/BLFS 11.3) +- Need to make multilib capable +- Need to split off libs into separate package +- Need more complete Summary/Descriptions +- Need build deps