From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 64B343858D38 for ; Wed, 10 Jan 2024 10:41:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 64B343858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 64B343858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704883302; cv=none; b=Dwd+glGBMpX0JJU+EDkN9RUTYeoRgPREdPdzupPEOf1f90jbrw4+ds625NKEHI6MJ3NAdAceUHjm5LKeftLY4siIZnOEOxmsFjxu9rGgR0aCZVjfpeL8AF0FRtbgO8GhH/WCHLN/Uo8gRZlmzLtRsj5vsv/xD/MuEFiBYtwuZ+w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704883302; c=relaxed/simple; bh=ckbhgUgQRmTKzoIWPkM0hB/a2yM6LnNC/4l0SYW2OsE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=jxERlxcvPLaOcoNzpsofTFIe4jHLw8iOj6wd1bB4iBesSM0IVyLQHMBnzap7SGy8nwF6JuSU7NuN4zDPpNFfE4+tAH4bQYJ7gAa1lFkaWvgLznBMhzQr+6u54Y16rEyY0GpgtokuONNad2Sj28NNSFzks8Fvbr/IIpTiDdf9ZA4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704883298; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bSLk+LYQ10C/vET8yRscRk9u1CNOJSGXCtuoKWhVpFc=; b=b1hS/MCd18lnPmECNZaUDJvGUm7f5UWhi495gEU1lmP4OsgzN1JUNYn/bPEnzrI9arjzM6 dgkl/KYOaNcxQsO6IetyGYiNrMgN70/v0oAH5VUOX0XHgh2xuU5wQytWtYwctMj6EiuMDl JSmf69kETstkLsivbga5AmdpQPSCETc= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-301-iKyNPYudNpOgjhRuhRy0Ng-1; Wed, 10 Jan 2024 05:41:36 -0500 X-MC-Unique: iKyNPYudNpOgjhRuhRy0Ng-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C648438212C8 for ; Wed, 10 Jan 2024 10:41:35 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.162]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4E160C15E6A; Wed, 10 Jan 2024 10:41:35 +0000 (UTC) From: Florian Weimer To: Joseph Myers Cc: libc-alpha@sourceware.org Subject: Re: Fix deprecated utcnow() usage in build-many-glibcs.py References: Date: Wed, 10 Jan 2024 11:41:33 +0100 In-Reply-To: (Joseph Myers's message of "Tue, 9 Jan 2024 21:39:32 +0000 (UTC)") Message-ID: <87a5pd79nm.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * Joseph Myers: > 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 = () Double-checked that this works with Python 3.6, looks good, thanks. Florian