Compare commits

..

2 commits

Author SHA1 Message Date
Adam Williamson
a2f7037c18 Fix the fix for _parse_optional changing (awilliam) 2024-10-02 23:16:10 -07:00
Brian C. Lane
f2fbfba277 - options: adjust to behavior change in upstream _parse_optional (awilliam) 2024-10-02 14:11:31 -07:00
5 changed files with 107 additions and 100 deletions

20
.gitignore vendored
View file

@ -270,23 +270,3 @@ pykickstart-1.78.tar.gz
/pykickstart-3.57.tar.gz.asc
/pykickstart-3.58.tar.gz
/pykickstart-3.58.tar.gz.asc
/pykickstart-3.59.tar.gz
/pykickstart-3.59.tar.gz.asc
/pykickstart-3.60.tar.gz
/pykickstart-3.60.tar.gz.asc
/pykickstart-3.61.tar.gz
/pykickstart-3.61.tar.gz.asc
/pykickstart-3.62.tar.gz
/pykickstart-3.62.tar.gz.asc
/pykickstart-3.63.tar.gz
/pykickstart-3.63.tar.gz.asc
/pykickstart-3.64.tar.gz
/pykickstart-3.64.tar.gz.asc
/pykickstart-3.65.tar.gz
/pykickstart-3.65.tar.gz.asc
/pykickstart-3.66.tar.gz
/pykickstart-3.66.tar.gz.asc
/pykickstart-3.67.tar.gz
/pykickstart-3.67.tar.gz.asc
/pykickstart-3.68.tar.gz
/pykickstart-3.68.tar.gz.asc

View file

@ -0,0 +1,28 @@
From faf6a88a1be4558ebd26f5d52c0990f5dd3ca592 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Wed, 2 Oct 2024 17:54:33 -0700
Subject: [PATCH] Fix the fix for _parse_optional changing
Whoops. Don't know how this slipped through testing.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
pykickstart/options.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pykickstart/options.py b/pykickstart/options.py
index ca0e18af..f0803039 100644
--- a/pykickstart/options.py
+++ b/pykickstart/options.py
@@ -185,7 +185,7 @@ class KSOptionParser(ArgumentParser):
# deprecated. we can only safely do this if there's exactly
# one matching action
if isinstance(option_tuple_or_tuples, list):
- if len(option_tuple_or_tuples == 1):
+ if len(option_tuple_or_tuples) == 1:
option_tuple = option_tuple_or_tuples[0]
else:
return option_tuple_or_tuples
--
2.46.2

View file

@ -0,0 +1,67 @@
From f753d4d6ad1f4846d14735beb3d1b157b9914b51 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Wed, 2 Oct 2024 09:48:39 -0700
Subject: [PATCH] options: adjust to behavior change in upstream
_parse_optional
In Python 3.13 and 3.12.7, the behavior of _parse_optional has
changed. It used to raise an error on multiple matching actions
itself, and only ever return None or an option tuple. Now the
"raise error on multiple matching actions" code was moved out
into consume_optional, and _parse_optional returns either None
or a *list* of option tuples, which contains more than one if
multiple actions match. See:
https://github.com/python/cpython/pull/124631
https://github.com/python/cpython/issues/58573
This adapts to the change in a way that should work on both older
and newer Pythons.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
pykickstart/options.py | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/pykickstart/options.py b/pykickstart/options.py
index 2e3a0721..ca0e18af 100644
--- a/pykickstart/options.py
+++ b/pykickstart/options.py
@@ -177,9 +177,23 @@ class KSOptionParser(ArgumentParser):
self.lineno = None
def _parse_optional(self, arg_string):
- option_tuple = ArgumentParser._parse_optional(self, arg_string)
+ # Before 3.13 and 3.12.7, this returned None or a single
+ # option tuple. From 3.13 / 3.12.7 onwards it returns None
+ # or a *list* of option tuples
+ option_tuple_or_tuples = ArgumentParser._parse_optional(self, arg_string)
+ # all we want to do here is a custom warning if the action is
+ # deprecated. we can only safely do this if there's exactly
+ # one matching action
+ if isinstance(option_tuple_or_tuples, list):
+ if len(option_tuple_or_tuples == 1):
+ option_tuple = option_tuple_or_tuples[0]
+ else:
+ return option_tuple_or_tuples
+ else:
+ option_tuple = option_tuple_or_tuples
+
if option_tuple is None or option_tuple[0] is None:
- return option_tuple
+ return option_tuple_or_tuples
action = option_tuple[0]
option = action.option_strings[0]
@@ -191,7 +205,7 @@ class KSOptionParser(ArgumentParser):
"kickstart. Please modify your kickstart file to remove this option.")
% {"lineno": self.lineno, "option": option}, KickstartDeprecationWarning)
- return option_tuple
+ return option_tuple_or_tuples
def add_argument(self, *args, **kwargs):
if "introduced" in kwargs:
--
2.46.2

View file

@ -4,8 +4,8 @@
%bcond_with signed
Name: pykickstart
Version: 3.68
Release: 1%{?dist}
Version: 3.58
Release: 3%{?dist}
License: GPL-2.0-only
Summary: Python utilities for manipulating kickstart files.
Url: http://fedoraproject.org/wiki/pykickstart
@ -14,15 +14,17 @@ Source0: https://github.com/pykickstart/%{name}/releases/download/r%{version}/
Source1: https://github.com/pykickstart/%{name}/releases/download/r%{version}/%{name}-%{version}.tar.gz.asc
%endif
# Fix for python 3.12.7 and 3.13
Patch0001: 0001-options-adjust-to-behavior-change-in-upstream-_parse.patch
Patch0002: 0001-Fix-the-fix-for-_parse_optional-changing.patch
BuildArch: noarch
BuildRequires: gettext
BuildRequires: python3-devel
BuildRequires: python3-pip
BuildRequires: python3-requests
BuildRequires: python3-setuptools
BuildRequires: make
BuildRequires: python3-pytest
# Only required when building with runtests
%if %{with runtests}
@ -43,7 +45,7 @@ Python 3 library for manipulating kickstart files. The binaries are found in
the pykickstart package.
%prep
%setup -q
%autosetup -p1
%build
make PYTHON=%{__python3}
@ -74,84 +76,14 @@ LC_ALL=C make PYTHON=%{__python3} test-no-coverage
%doc docs/programmers-guide
%doc docs/kickstart-docs.txt
%{python3_sitelib}/pykickstart
%{python3_sitelib}/pykickstart-%{version}.dist-info
%{python3_sitelib}/pykickstart*.egg-info
%changelog
* Tue Dec 02 2025 Brian C. Lane <bcl@redhat.com> - 3.68-1
- rhsm: Add Flatpak registry option for RHEL10 (bciconel)
- commands: bootc: remove 'experimental' warning (k.koukiou)
* Fri Sep 19 2025 Python Maint <python-maint@redhat.com> - 3.67-2
- Rebuilt for Python 3.14.0rc3 bytecode
* Mon Aug 18 2025 Brian C. Lane <bcl@redhat.com> - 3.67-1
- spec: Add python3-pytest to BuildRequires (bcl)
- tests: Use pytest module instead of unittest (bcl)
- workflows: Use py3.14 rc.1 (bcl)
- Add Fedora 44 support (bcl)
- spec: drop python3-build dependency (yselkowi)
* Fri Aug 15 2025 Python Maint <python-maint@redhat.com> - 3.66-4
- Rebuilt for Python 3.14.0rc2 bytecode
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org> - 3.66-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Tue Jul 22 2025 Brian C. Lane <bcl@redhat.com> - 3.66-2
- Drop python3-build, it is not needed to install the package
* Tue Jul 15 2025 Brian C. Lane <bcl@redhat.com> - 3.66-1
- workflows: Use py3.14 beta.4 (bcl)
- pylint: Ignore files in .git (bcl)
- pyproject: Bump setuptools to 77 or later (bcl)
- Makefile: Stop running setup.py directly (bcl)
* Mon Jun 16 2025 Brian C. Lane <bcl@redhat.com> - 3.65-1
- workflows: Add python 3.14 to the test matrix (bcl)
- Add support for RDP (jkonecny)
- Deprecate VNC (jkonecny)
- docs: Fix chapter numbering after adding certificate (bcl)
* Tue Jun 03 2025 Python Maint <python-maint@redhat.com> - 3.64-2
- Rebuilt for Python 3.14
* Fri Apr 25 2025 Brian C. Lane <bcl@redhat.com> - 3.64-1
- workflow: Add python 3.13 testing (bcl)
- tests: Remove unused import of constants (bcl)
- realm: Clean up documentation (bcl)
- Add support for new bootc kickstart command (ppolawsk)
- Update documentation for clearpart --initlabel option. (rvykydal)
- Update the %certificate section documentation (rvykydal)
* Mon Feb 24 2025 Brian C. Lane <bcl@redhat.com> - 3.63-1
- Do not remove "md" prefix from RAID names (vtrefny)
- Add Fedora 43 support (bcl)
- workflows: Switch to ubuntu-latest (bcl)
- Update formatting of certificate section documentation (rvykydal)
- Update %certificate documentation with not about bundles (rvykydal)
- Fix formatting of %certificate documentation example (rvykydal)
- Update %certificate section documentation (rvykydal)
* Wed Jan 29 2025 Brian C. Lane <bcl@redhat.com> - 3.62-1
- Make %%certificate section option --dir mandatory. (rvykydal)
Resolves: rhbz#2342762
* Sat Jan 18 2025 Fedora Release Engineering <releng@fedoraproject.org> - 3.61-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Thu Jan 09 2025 Brian C. Lane <bcl@redhat.com> - 3.61-1
- runpylint: Log astroid version (bcl)
- tests: Limit the python versions used in testing (bcl)
- Add support for inline certificates with `%certificate` section (k.koukiou)
* Thu Oct 03 2024 Brian C. Lane <bcl@redhat.com> - 3.60-1
- module: Remove unused warnings import (bcl)
- tox: Add py313 to tox and 3.12.7 to workflow (bcl)
* Wed Oct 02 2024 Adam Williamson <awilliam@redhat.com> - 3.58-3
- Fix the fix for _parse_optional changing (awilliam)
* Wed Oct 02 2024 Brian C. Lane <bcl@redhat.com> - 3.59-1
* Wed Oct 02 2024 Brian C. Lane <bcl@redhat.com> - 3.58-2
- options: adjust to behavior change in upstream _parse_optional (awilliam)
- Add Fedora 42 support (jkonecny)
* Mon Aug 19 2024 Brian C. Lane <bcl@redhat.com> - 3.58-1
- DeprecatedCommand: Return empty list for dataList (bcl)

View file

@ -1,2 +1,2 @@
SHA512 (pykickstart-3.68.tar.gz) = 103034f2ad47afa470066b4c98092ac634c5c5ed21c1c98a65170c78cc86e95f5565bb4c29a24a890836e45d2094b529fcdb02f8a004875cc13db505bd2ba51e
SHA512 (pykickstart-3.68.tar.gz.asc) = 33d2e3ea50bdffdb7bc4939b68c3069d6fce6087cd186ac57773981928a090608f7509fd8f63bacbbd6544d828da3eb1e1fb785f5ff7e547364c9cd360eaf106
SHA512 (pykickstart-3.58.tar.gz) = e52d77c9cac3958eaa2d6cf238f885f2ca5ca9e0a1cf8d5a990adbf07d45c9abb789c08713a7e68f4256af8b2f2feb4bd76240bd8dce9080d518e7cd4051f26f
SHA512 (pykickstart-3.58.tar.gz.asc) = 3ed3f4aa962e88b4c52651c6da12e039b3eaaa951dfc05db656088176f3a630cb0bf07fdeed76d9ee4509be1ad243027c805ad7fa979704b1219a549c47df3da