]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix deprecated utcnow() usage in build-many-glibcs.py
authorJoseph Myers <josmyers@redhat.com>
Wed, 10 Jan 2024 13:02:16 +0000 (13:02 +0000)
committerJoseph Myers <josmyers@redhat.com>
Wed, 10 Jan 2024 13:02:16 +0000 (13:02 +0000)
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).

scripts/build-many-glibcs.py

index 9a929a6430dc9e213c74fbaff15b67423c489648..ec2ded6e566e6d6f998cf76bd438fa5edc3c6100 100755 (executable)
@@ -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 = ()