public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/pcs] eln: Replace python-dateutil with stdlib datetime
@ 2026-11-20 18:17 Yaakov Selkowitz
0 siblings, 0 replies; only message in thread
From: Yaakov Selkowitz @ 2026-11-20 18:17 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/pcs
Branch : eln
Commit : da78e49be49eb26e7bca2625a93e6561e185cbb6
Author : Yaakov Selkowitz <yselkowi@redhat.com>
Date : 2026-11-18T18:29:14-05:00
Stats : +203/-2 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/pcs/c/da78e49be49eb26e7bca2625a93e6561e185cbb6?branch=eln
Log:
Replace python-dateutil with stdlib datetime
https://github.com/ClusterLabs/pcs/pull/1171
https://github.com/fedora-eln/eln/issues/431
---
diff --git a/pcs.spec b/pcs.spec
index d579db1..17a168a 100644
--- a/pcs.spec
+++ b/pcs.spec
@@ -126,6 +126,7 @@ Source101: https://github.com/ClusterLabs/pcs-web-ui/releases/download/%{ui_vers
# Patch1: name.patch
Patch1: do-not-support-cluster-setup-with-udp-u-transport.patch
Patch2: show-info-page-instead-of-webui.patch
+Patch3: replace-python-dateutil-with-stdlib-datetime.patch
# ui patches: >200
# Patch201: name-web-ui.patch
@@ -147,7 +148,6 @@ BuildRequires: findutils
# python for pcs
BuildRequires: python3 >= 3.12
BuildRequires: python3-cryptography
-BuildRequires: python3-dateutil >= 2.7.0
BuildRequires: python3-devel
BuildRequires: python3-lxml
BuildRequires: python3-pip
@@ -203,7 +203,6 @@ BuildRequires: libappstream-glib
# python and libraries for pcs, setuptools for pcs entrypoint
Requires: python3-cryptography
-Requires: python3-dateutil >= 2.7.0
Requires: python3-lxml
Requires: python3-pyparsing
Requires: python3-tornado
diff --git a/replace-python-dateutil-with-stdlib-datetime.patch b/replace-python-dateutil-with-stdlib-datetime.patch
new file mode 100644
index 0000000..158c088
--- /dev/null
+++ b/replace-python-dateutil-with-stdlib-datetime.patch
@@ -0,0 +1,202 @@
+From 2fd767a6f306187284d6b8ee372a19d8227e504c Mon Sep 17 00:00:00 2001
+From: Miroslav Lisik <mlisik@redhat.com>
+Date: Fri, 7 Aug 2026 15:25:04 +0200
+Subject: [PATCH] replace python-dateutil with python stdlib datetime module
+
+Assisted-by: Claude Code (Claude Opus 4.6)
+---
+ CHANGELOG.md | 5 ++++
+ README.md | 1 -
+ configure.ac | 7 ------
+ dev_requirements.txt | 1 -
+ pcs/lib/cib/rule/validator.py | 19 +++++++++++----
+ pcs_test/tier0/lib/cib/rule/test_validator.py | 23 +++++++++++++++++++
+ plans.fmf | 2 --
+ rpm/pcs.spec.in | 8 +------
+ 8 files changed, 43 insertions(+), 23 deletions(-)
+
+diff --git a/README.md b/README.md
+index 43fbbf289..8f2480b8d 100644
+--- a/README.md
++++ b/README.md
+@@ -36,7 +36,6 @@ daemon, which operates as a remote server for pcs.
+ These are the runtime dependencies of pcs and pcsd:
+ * python 3.12+
+ * python3-cryptography
+-* python3-dateutil 2.7.0+
+ * python3-lxml
+ * python3-pycurl
+ * python3-pyparsing 3.0.0+
+diff --git a/configure.ac b/configure.ac
+index 0393a86a1..7c85a40de 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -381,14 +381,6 @@ if test "x$tests_only" != "xyes"; then
+ # use them all from the BaseOS or embedded them all as necessary (--enable-local-build)
+ PCS_CHECK_PYMOD([dacite], [], [yes])
+ PCS_CHECK_PYMOD([tornado], [>= 6.0.0], [yes])
+- PCS_CHECK_PYMOD([python-dateutil], [>= 2.7.0], [yes])
+- # setuptoools_scm is needed for bundling dateutil, this uses variables
+- # set by the PCS_CHECK_PYMOD macro, so it must be executed right after it
+- if test "x$bundle_module" = "xyes"; then
+- PCS_CHECK_PYMOD([setuptools-scm])
+- PCS_CHECK_PYMOD([six])
+- PKG_CHECK_MODULES([TZDATA], [tzdata])
+- fi
+ # Pycurl-7.46.0 requires setuptools => 77. However, if pycurl is already
+ # installed on the system, use whatever pycurl is installed and don't limit
+ # its version based on setuptools version.
+diff --git a/dev_requirements.txt b/dev_requirements.txt
+index f5afbddff..fc6ef1416 100644
+--- a/dev_requirements.txt
++++ b/dev_requirements.txt
+@@ -8,4 +8,3 @@ types-dataclasses
+ # error: Call to untyped function "getinfo" in typed context [no-untyped-call]
+ # so we are stuck with this version until there's a fix
+ types-pycurl==7.45.2.20240311
+-types-python-dateutil
+diff --git a/pcs/lib/cib/rule/validator.py b/pcs/lib/cib/rule/validator.py
+index 10d00e84a..8357fd065 100644
+--- a/pcs/lib/cib/rule/validator.py
++++ b/pcs/lib/cib/rule/validator.py
+@@ -1,8 +1,7 @@
+ import dataclasses
++import datetime as dt
+ from collections import Counter, OrderedDict
+
+-from dateutil import parser as dateutil_parser
+-
+ from pcs.common import reports
+ from pcs.common.types import CibRuleExpressionType
+ from pcs.lib import validate
+@@ -23,6 +22,16 @@
+
+
+ class Validator:
++ """
++ This validator uses datetime's fromisoformat() for datetime validation.
++ Currently (up to Python 3.14), fromisoformat() does not support:
++ 1. Reduced precision dates (YYYY-MM, YYYY)
++ 2. Extended date representation (+-YYYYYY-MM-DD)
++ 3. Ordinal dates (YYYY-DDD)
++ Pacemaker only supports ordinal dates (3). If needed, create a wrapper
++ around fromisoformat() to handle them.
++ """
++
+ def __init__(
+ self,
+ parsed_rule: BoolExpr,
+@@ -93,7 +102,7 @@ def _validate_date_inrange_expr(
+
+ if expr.date_start is not None:
+ try:
+- start_date = dateutil_parser.isoparse(expr.date_start)
++ start_date = dt.datetime.fromisoformat(expr.date_start)
+ except ValueError:
+ report_list.append(
+ reports.item.ReportItem.error(
+@@ -104,7 +113,7 @@ def _validate_date_inrange_expr(
+ )
+ if expr.date_end is not None:
+ try:
+- end_date = dateutil_parser.isoparse(expr.date_end)
++ end_date = dt.datetime.fromisoformat(expr.date_end)
+ except ValueError:
+ report_list.append(
+ reports.item.ReportItem.error(
+@@ -208,7 +217,7 @@ def _validate_date_unary_expr(
+ ) -> reports.ReportItemList:
+ report_list: reports.ReportItemList = []
+ try:
+- dateutil_parser.isoparse(expr.date)
++ dt.datetime.fromisoformat(expr.date)
+ except ValueError:
+ report_list.append(
+ reports.item.ReportItem.error(
+diff --git a/pcs_test/tier0/lib/cib/rule/test_validator.py b/pcs_test/tier0/lib/cib/rule/test_validator.py
+index 44260fb10..1fd416a56 100644
+--- a/pcs_test/tier0/lib/cib/rule/test_validator.py
++++ b/pcs_test/tier0/lib/cib/rule/test_validator.py
+@@ -244,6 +244,29 @@ def test_date_bad(self):
+ ],
+ )
+
++ def test_date_ordinal_not_supported(self):
++ """
++ Ordinal dates (YYYY-DDD) are valid ISO 8601 and supported by
++ Pacemaker, but datetime's fromisoformat() cannot parse them.
++ This is not intentional and support should be added once the
++ underlying standard library gains this capability.
++ """
++ assert_report_item_list_equal(
++ Validator(
++ BoolExpr(BOOL_AND, [DateUnaryExpr(DATE_OP_GT, "2020-060")])
++ ).get_reports(),
++ [
++ fixture.error(
++ reports.codes.INVALID_OPTION_VALUE,
++ option_name="date",
++ option_value="2020-060",
++ allowed_values="ISO 8601 date",
++ cannot_be_empty=False,
++ forbidden_characters=None,
++ )
++ ],
++ )
++
+
+ class DateInrangeExpression(TestCase):
+ part_list = {
+diff --git a/plans.fmf b/plans.fmf
+index 7858ef363..cb235e3d5 100644
+--- a/plans.fmf
++++ b/plans.fmf
+@@ -65,7 +65,6 @@ prepare:
+ - python3-wheel
+ # pcs python development requirements
+ - python3-cryptography
+- - python3-dateutil
+ - python3-devel
+ - python3-lxml
+ - python3-pip
+@@ -83,7 +82,6 @@ prepare:
+ - rubygem-test-unit
+ - rubygems
+ # packages required for rpm build
+- - python3-setuptools_scm
+ - redhat-rpm-config
+ - rpm-build
+ - rpmdevtools
+diff --git a/rpm/pcs.spec.in b/rpm/pcs.spec.in
+index 9ab3df335..c78409246 100644
+--- a/rpm/pcs.spec.in
++++ b/rpm/pcs.spec.in
+@@ -15,7 +15,6 @@ Release: 99+git%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty
+ # https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses
+ # GPL-2.0-only: pcs
+ # Apache-2.0: dataclasses, tornado
+-# Apache-2.0 OR BSD-3-Clause: dateutil
+ # MIT: backports, childprocess, dacite, mustermann, rack, rackup,
+ # rack-protection, rack-session, rack-test, sinatra, tilt
+ # MIT AND (BSD-2-Clause OR GPL-2.0-or-later): nio4r
+@@ -41,7 +40,7 @@ Release: 99+git%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty
+ # base64
+ # rexml:
+ # strscan (might be included with Ruby)
+-License: GPL-2.0-only AND Apache-2.0 AND MIT AND BSD-2-Clause AND BSD-3-Clause AND Ruby AND (BSD-2-Clause OR GPL-2.0-or-later) AND (Apache-2.0 OR BSD-3-Clause) AND (BSD-2-Clause OR Ruby) AND (curl OR LGPL-2.1-or-later)
++License: GPL-2.0-only AND Apache-2.0 AND MIT AND BSD-2-Clause AND BSD-3-Clause AND Ruby AND (BSD-2-Clause OR GPL-2.0-or-later) AND (BSD-2-Clause OR Ruby) AND (curl OR LGPL-2.1-or-later)
+ URL: https://github.com/ClusterLabs/pcs
+ Summary: Pacemaker/Corosync Configuration System
+
+@@ -86,11 +85,6 @@ BuildRequires: python%{python3_version}-setuptools >= 66.1
+ # for building wheel during make install
+ BuildRequires: (python%{python3_version}-wheel if python%{python3_version}-setuptools < 71)
+
+-# for bundling dateutil
+-%if "@cirpmworkarounds@" != "yes"
+-BuildRequires: python%{python3_version}-setuptools_scm
+-%endif
+-
+ # for tier0 tests
+ BuildRequires: python%{python3_version}-cryptography
+ %if "@cirpmworkarounds@" != "yes"
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-20 18:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20 18:17 [rpms/pcs] eln: Replace python-dateutil with stdlib datetime Yaakov Selkowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox