[packages/python3-2to3] - last version of 2to3 (from Python 3.12.x) as separate package
qboosh
qboosh at pld-linux.org
Thu Mar 13 20:48:35 CET 2025
commit 9554c8550b2d573c12f674c7adf9dd0b1cbd0c14
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Thu Mar 13 20:38:44 2025 +0100
- last version of 2to3 (from Python 3.12.x) as separate package
python3-2to3.spec | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 83 insertions(+)
---
diff --git a/python3-2to3.spec b/python3-2to3.spec
new file mode 100644
index 0000000..e4efaa9
--- /dev/null
+++ b/python3-2to3.spec
@@ -0,0 +1,83 @@
+#
+# Conditional build:
+%bcond_without default_python # build as from default system Python
+
+Summary: Automated Python 2 to 3 code translation
+Summary(pl.UTF-8): Automatyczne tłumaczenie kodu Pythona 2 do 3
+Name: python3-2to3
+Version: 3.12.9
+Release: 1
+Epoch: 1
+License: PSF
+Group: Development/Languages/Python
+Source0: https://www.python.org/ftp/python/3.12.9/Python-%{version}.tar.xz
+# Source0-md5: 880942124f7d5c01e7b65cbad62dc873
+URL: https://docs.python.org/3.12/library/2to3.html
+BuildRequires: rpm-pythonprov
+BuildRequires: tar >= 1:1.22
+BuildRequires: xz
+%if %{with default_python}
+Conflicts: python-2to3 < 1:2.7.18-10
+%endif
+BuildArch: noarch
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+2to3 is a Python program that reads Python 2.x source code and applies
+a series of fixers to transform it into valid Python 3.x code. The
+standard library contains a rich set of fixers that will handle almost
+all code. 2to3 supporting library lib2to3 is, however, a flexible and
+generic library, so it is possible to write your own fixers for 2to3.
+lib2to3 could also be adapted to custom applications in which Python
+code needs to be edited automatically.
+
+%description -l pl.UTF-8
+2to3 to program w Pythonie czytający od źródłowy w Pythonie 2.x i
+aplikujący serię poprawek przekształcających go w poprawny kod w
+Pythonie 3.x. Biblioteka standardowa zawiera duży zbiór poprawek
+obsługujących większość kodu. Biblioteka wspierająca 2to3 (lib2to3)
+jest jednak elastyczną i ogólną biblioteką, więc można pisać własne
+poprawki dla 2to3. lib2to3 można także zaadaptować na potrzeby
+własnych zastosowań, w których kod w Pythonie musi być modyfikowany
+automatycznie.
+
+%prep
+%setup -q -n Python-%{version}
+
+%{__sed} -i -e '1s,/usr/bin/env python3$,%{__python3},' Tools/scripts/2to3
+
+# remove bogus shebang, not a program
+%{__sed} -i -e '/^#! \/usr\/bin\/env python3/d' Lib/lib2to3/pgen2/token.py
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_bindir},%{py3_sitescriptdir}}
+
+cp -pr Lib/lib2to3 $RPM_BUILD_ROOT%{py3_sitescriptdir}
+%py3_comp $RPM_BUILD_ROOT%{py3_sitescriptdir}
+%py3_ocomp $RPM_BUILD_ROOT%{py3_sitescriptdir}
+
+install -Dp Tools/scripts/2to3 $RPM_BUILD_ROOT%{_bindir}/2to3-3
+# it's actually 3.12, but for compatibility with 2to3-%{py3_ver} used in some specs
+ln -s 2to3-3 $RPM_BUILD_ROOT%{_bindir}/2to3-%{py3_ver}
+%if %{with default_python}
+ln -s 2to3-3 $RPM_BUILD_ROOT%{_bindir}/2to3
+%endif
+
+# generate grammar pickles
+PYTHONPATH=$RPM_BUILD_ROOT%{py3_sitescriptdir} \
+%{__python3} -m lib2to3.pgen2.driver $RPM_BUILD_ROOT%{py3_sitescriptdir}/lib2to3/Grammar.txt
+PYTHONPATH=$RPM_BUILD_ROOT%{py3_sitescriptdir} \
+%{__python3} -m lib2to3.pgen2.driver $RPM_BUILD_ROOT%{py3_sitescriptdir}/lib2to3/PatternGrammar.txt
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/2to3-%{py3_ver}
+%attr(755,root,root) %{_bindir}/2to3-3
+%if %{with default_python}
+%attr(755,root,root) %{_bindir}/2to3
+%endif
+%{py3_sitescriptdir}/lib2to3
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python3-2to3.git/commitdiff/9554c8550b2d573c12f674c7adf9dd0b1cbd0c14
More information about the pld-cvs-commit
mailing list