From nobody Sun Feb 8 15:30:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07DBA24BBE9; Mon, 24 Feb 2025 09:09:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740388144; cv=none; b=i9x4wqtlF0tO+0q+FGZSeRgTKB4rGQyTi/q3IOef3OOhXjsNi4yipTLn0jsfAhidKOH45bEDQEknvLzGONZE4DETBcdTFhmRebnpFvVzXv1To5MxBXmbMFEb1u3yPlXtcukKqTYDaGfugOXBHrlk0+xidWz7sBT5YxmmfZJcrFk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740388144; c=relaxed/simple; bh=7R366oYKmHOPpm8w8SRMstX38EO00rzyOjDKwrc/HvM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nklvPXcZqQLZp5WmF6cRgmlGwwH5Exb9u3hDMD6VgUN6cgBNrMqKMtbpZwmaMHLNI0rvP1qk8tdd6ykksZYgAsjFpGlBWTpM3HVkMiSvVFPBeCRibbV2U/qZUvGddel91QvOV2jKizShVjgSbZRkBzyy6ElXT5ZILW4t1nnmX3g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lSJPSms3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lSJPSms3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87E09C2BCB9; Mon, 24 Feb 2025 09:09:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740388143; bh=7R366oYKmHOPpm8w8SRMstX38EO00rzyOjDKwrc/HvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lSJPSms3Ep2i557KE8/hclS9V7fRG56iKieWL8elcnDGR0cY/XiNgbtKbefz4PcKG l48Rz4GU3chECWP/oFb2TBpF7RU3zAv6fQ70G3x6iXFb2r81GwGkuO48d6sEEQxfhK 95HI2cigsEcFUnyhhxwsIQJ8PILP/gs6FMj7xzVflyBtYaFPRan7+iCA5FaV3wUjR3 FQy2MuampgGzkf1XXSyYlyx+kbZxhnTEdWMxukoxWgFno72a2FdPwI8vtdvDjr0jV5 wFS5DRfvplT+VgUCvXRiJ6hV5+qjYjVlUIi65WKCujzV4vI8HBQGbECCz3JN+iG5mI y/tKhj08I95zg== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tmUST-00000003p5W-2kh5; Mon, 24 Feb 2025 10:09:01 +0100 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Jonathan Corbet Cc: Mauro Carvalho Chehab , "Mauro Carvalho Chehab" , linux-kernel@vger.kernel.org Subject: [PATCH v2 32/39] scripts/kernel-doc.py: properly handle KBUILD_BUILD_TIMESTAMP Date: Mon, 24 Feb 2025 10:08:38 +0100 Message-ID: <8a8b63cfbb14a98d8bd1790d502b73162079789e.1740387599.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" The logic that handles KBUILD_BUILD_TIMESTAMP is wrong, and adds a dependency of a third party module (dateutil). Fix it. Signed-off-by: Mauro Carvalho Chehab --- scripts/lib/kdoc/kdoc_files.py | 9 --------- scripts/lib/kdoc/kdoc_output.py | 28 +++++++++++++++++++++------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/scripts/lib/kdoc/kdoc_files.py b/scripts/lib/kdoc/kdoc_files.py index a2417cafb1c8..19fe9c6f5352 100755 --- a/scripts/lib/kdoc/kdoc_files.py +++ b/scripts/lib/kdoc/kdoc_files.py @@ -12,9 +12,6 @@ import logging import os import re import sys -from datetime import datetime - -from dateutil import tz =20 from kdoc_parser import KernelDoc from kdoc_output import OutputFormat @@ -136,12 +133,6 @@ class KernelFiles(): if out_style is None: out_style =3D OutputFormat() =20 - dt =3D datetime.now() - if os.environ.get("KBUILD_BUILD_TIMESTAMP", None): - # use UTC TZ - to_zone =3D tz.gettz('UTC') - dt =3D dt.astimezone(to_zone) - if not werror: kcflags =3D os.environ.get("KCFLAGS", None) if kcflags: diff --git a/scripts/lib/kdoc/kdoc_output.py b/scripts/lib/kdoc/kdoc_output= .py index 13a74a687f89..166fcabbb4cf 100755 --- a/scripts/lib/kdoc/kdoc_output.py +++ b/scripts/lib/kdoc/kdoc_output.py @@ -18,8 +18,6 @@ import os import re from datetime import datetime =20 -from dateutil import tz - from kdoc_parser import KernelDoc, type_param from kdoc_re import Re =20 @@ -584,6 +582,15 @@ class ManFormat(OutputFormat): ) blankline =3D "" =20 + date_formats =3D [ + "%a %b %d %H:%M:%S %Z %Y", + "%a %b %d %H:%M:%S %Y", + "%Y-%m-%d", + "%b %d %Y", + "%B %d %Y", + "%m %d %Y", + ] + def __init__(self, modulename): """ Creates class variables. @@ -595,11 +602,18 @@ class ManFormat(OutputFormat): super().__init__() self.modulename =3D modulename =20 - dt =3D datetime.now() - if os.environ.get("KBUILD_BUILD_TIMESTAMP", None): - # use UTC TZ - to_zone =3D tz.gettz('UTC') - dt =3D dt.astimezone(to_zone) + dt =3D None + tstamp =3D os.environ.get("KBUILD_BUILD_TIMESTAMP") + if tstamp: + for fmt in self.date_formats: + try: + dt =3D datetime.strptime(tstamp, fmt) + break + except ValueError: + pass + + if not dt: + dt =3D datetime.now() =20 self.man_date =3D dt.strftime("%B %Y") =20 --=20 2.48.1