Compare commits

..

2 commits

Author SHA1 Message Date
Adam Williamson
3fa92b83ad Fix the fix for _parse_optional changing (awilliam) 2024-10-02 23:23:33 -07:00
Brian C. Lane
7c663307d9 - options: adjust to behavior change in upstream _parse_optional (awilliam) 2024-10-02 14:23:32 -07:00
5 changed files with 113 additions and 214 deletions

40
.gitignore vendored
View file

@ -250,43 +250,3 @@ pykickstart-1.78.tar.gz
/pykickstart-3.47.tar.gz.asc
/pykickstart-3.48.tar.gz
/pykickstart-3.48.tar.gz.asc
/pykickstart-3.49.tar.gz
/pykickstart-3.49.tar.gz.asc
/pykickstart-3.50.tar.gz
/pykickstart-3.50.tar.gz.asc
/pykickstart-3.51.tar.gz
/pykickstart-3.51.tar.gz.asc
/pykickstart-3.52.tar.gz
/pykickstart-3.52.tar.gz.asc
/pykickstart-3.53.tar.gz
/pykickstart-3.53.tar.gz.asc
/pykickstart-3.54.tar.gz
/pykickstart-3.54.tar.gz.asc
/pykickstart-3.55.tar.gz
/pykickstart-3.55.tar.gz.asc
/pykickstart-3.56.tar.gz
/pykickstart-3.56.tar.gz.asc
/pykickstart-3.57.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,25 +4,30 @@
%bcond_with signed
Name: pykickstart
Version: 3.68
Release: 1%{?dist}
License: GPL-2.0-only
Version: 3.48
Release: 5%{?dist}
License: GPL-2.0-only AND MIT
Summary: Python utilities for manipulating kickstart files.
Url: http://fedoraproject.org/wiki/pykickstart
Source0: https://github.com/pykickstart/%{name}/releases/download/r%{version}/%{name}-%{version}.tar.gz
# This is a Red Hat maintained package which is specific to
# our distribution. Thus the source is only available from
# within this srpm.
Source0: %{name}-%{version}.tar.gz
%if %{with signed}
Source1: https://github.com/pykickstart/%{name}/releases/download/r%{version}/%{name}-%{version}.tar.gz.asc
Source1: %{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 +48,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,175 +79,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.48-5
- 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.48-4
- 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)
* Mon Aug 19 2024 Brian C. Lane <bcl@redhat.com> - 3.57-1
- Add "hw-passphrase" option for autopart and part commands (vtrefny)
- Enhance %onerror section with recommendation (jkonecny)
Resolves: RHEL-47142
- commands: Add missing DeprecatedCommand class to F41_Module (kkoukiou)
* Mon Aug 05 2024 Brian C. Lane <bcl@redhat.com> - 3.56-1
- doc/versionremoved: Update VersionChange import for Sphinx 8.0.0 (bcl)
- Mark the vnc command as deprecated on RHEL 10 (mkolman)
Resolves: RHEL-41219
- pykickstart is supported on python 3.6+ (sgallagh)
- timezone: Remove the --isUtc, --nontp, and --ntpserver arguments (bcl)
Related: RHEL-34009
- packages: Remove the old camel case arguments on RHEL10 (bcl)
Resolves: RHEL-34009
- nvdimm: Remove support for the nvdimm command on RHEL10 (bcl)
Related: RHEL-34009
- Drop the MIT license (bcl)
* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.55-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Fri Jun 07 2024 Python Maint <python-maint@redhat.com> - 3.55-2
- Rebuilt for Python 3.13
* Mon May 13 2024 Brian C. Lane <bcl@redhat.com> - 3.55-1
- Deprecate modularity on Fedora 41 (marusak.matej)
- btrfs: Remove support for the btrfs command on RHEL10 (bcl)
Resolves: RHEL-34009
- Deprecate modularity on RHEL 10 (marusak.matej)
Resolves: RHEL-34829
* Thu Apr 25 2024 Brian C. Lane <bcl@redhat.com> - 3.54-1
- Add a DEFAULT_VERSION variable to version.py (bcl)
- Deprecate network team options on RHEL 10 (rvykydal)
* Wed Apr 03 2024 Brian C. Lane <bcl@redhat.com> - 3.53-1
- Update sources to github release urls
- rhel10: autopart on RHEL does not support --type=btrfs (bcl)
- rhel10: Add test for btrfs command deprecation (bcl)
- rhel10: Add missing rhsm and syspurpose commands (bcl)
- Break out %pre example to kickstart-examples (tasleson)
- Update kickstart-docs.rst (tasleson)
- Add Fedora 41 support (bcl)
- Update RHEL 9 handler (bcl)
- Update RHEL 10 handler classes (bcl)
- Add RHEL 10 handler (bcl)
- workflow: Use python 3.12.2 for tests (bcl)
- workflow: Bump checkout and setup-python actions to new versions (bcl)
* Thu Feb 01 2024 Brian C. Lane <bcl@redhat.com> - 3.52-1
- Deprecate %%packages --instLangs and --excludeWeakdeps kickstart options (vponcova)
- Deprecate timezone --isUtc, --ntpservers and --nontp kickstart options (vponcova)
- Fix the assert_removed check in the unit tests (vponcova)
- Remove the repo --ignoregroups kickstart option in Fedora 40 (vponcova)
- Remove the logging --level kickstart option in Fedora 40 (vponcova)
- Remove the method kickstart command in Fedora 40 (vponcova)
- Remove the autostep kickstart command in Fedora 40 (vponcova)
- requirements: Add setuptools (bcl)
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.51-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.51-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Tue Nov 28 2023 Brian C. Lane <bcl@redhat.com> - 3.51-1
- Deprecate the nvdimm kickstart command (vponcova)
* Fri Nov 10 2023 Brian C. Lane <bcl@redhat.com> - 3.50-1
- Add Fedora 40 support (bcl)
- remove control characters from license (cmdr)
- scripts: Fix wording in documentation (bcl)
- workflow: Fix test for python 3.12.0 version (bcl)
* Wed Oct 25 2023 Brian C. Lane <bcl@redhat.com> - 3.49-1
- tox: Only run unit tests for python 3.6 (bcl)
- workflow: Update to py3.12.0 (bcl)
- pykickstart: Set timeout to 120s on requests.get (bcl)
- translation-canary: Update the subtree with current master (bcl)
- Squashed 'translation-canary/' changes from 840c2d64..5bb81253 (bcl)
- tests: Add python 3.12 support (bcl)
- tests: Update unicode test to remove deprecated resetlocale (bcl)
- rtd: formats is separate, not part of sphinx (bcl)
- rtd: Add the .readthedocs.yaml config file (bcl)
- spec: Update spec with changes from Fedora (bcl)
- Makefile: Update pypi upload command (bcl)
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.48-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

View file

@ -1,2 +1,2 @@
SHA512 (pykickstart-3.68.tar.gz) = 103034f2ad47afa470066b4c98092ac634c5c5ed21c1c98a65170c78cc86e95f5565bb4c29a24a890836e45d2094b529fcdb02f8a004875cc13db505bd2ba51e
SHA512 (pykickstart-3.68.tar.gz.asc) = 33d2e3ea50bdffdb7bc4939b68c3069d6fce6087cd186ac57773981928a090608f7509fd8f63bacbbd6544d828da3eb1e1fb785f5ff7e547364c9cd360eaf106
SHA512 (pykickstart-3.48.tar.gz) = d5f67ab7b9071878be401dd0b230267134b75e5a231492db02bae86a9587f95cf5d6d6c33c40457ebba7d74273941f1146befea372fd8ab4d0ed403df54eb54f
SHA512 (pykickstart-3.48.tar.gz.asc) = 1842e1bc04eee3c1dd6dd40941e2b87e4e1680585295b1aebd6fa997e5dfee1a2a14c3480603aa74cead6921cf51a297f444f55f12b37ddaf3b89458b2953ff2