From: Joseph Myers <josmyers@redhat.com>
To: libc-alpha@sourceware.org
Subject: Fix deprecated utcnow() usage in build-many-glibcs.py
Date: Tue, 9 Jan 2024 21:39:32 +0000 (UTC) [thread overview]
Message-ID: <b591634-55b1-3d7c-81b1-337ed4ed214@redhat.com> (raw)
Running build-many-glibcs.py with Python 3.12 or later produces a
warning:
build-many-glibcs.py:566: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
build_time = datetime.datetime.utcnow()
Replace with datetime.datetime.now(datetime.timezone.utc) (the
datetime.UTC constant is new in 3.11, so not suitable for use in this
script at present).
diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index 7e0b90be89..87a42e4aef 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -563,7 +563,7 @@ class Context(object):
print(config.name, config.compiler.name)
return
self.clear_last_build_state(action)
- build_time = datetime.datetime.utcnow()
+ build_time = datetime.datetime.now(datetime.timezone.utc)
if action == 'host-libraries':
build_components = ('gmp', 'mpfr', 'mpc')
old_components = ()
--
Joseph S. Myers
josmyers@redhat.com
next reply other threads:[~2024-01-09 21:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-09 21:39 Joseph Myers [this message]
2024-01-10 10:41 ` Florian Weimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b591634-55b1-3d7c-81b1-337ed4ed214@redhat.com \
--to=josmyers@redhat.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).