Hi Bruce, I'd like to request this patch be cherry-picked to scarthgap.
Thanks, Stan ________________________________ From: Bruce Ashfield <[email protected]> Sent: Thursday, November 21, 2024 5:30 PM To: Stanley Stanton <[email protected]> Cc: [email protected] <[email protected]> Subject: Re: [meta-virtualization] [PATCH v2] xen.inc: python 3.12: fix datetime deprecation warning [You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] v2 is merged to master. Request cherry-picks to any other branches of interest. Bruce In message: [meta-virtualization] [PATCH v2] xen.inc: python 3.12: fix datetime deprecation warning on 19/11/2024 Stanley Stanton via lists.yoctoproject.org wrote: > Parsing xen.inc with a host distro that provides python 3.12 (such as Ubuntu > 24.04) generates the following deprecation warning: > > DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and > scheduled for removal in a future version. > Use timezone-aware objects to represent datetimes in UTC: > datetime.datetime.fromtimestamp(timestamp, datetime.UTC) > > This warning comes from the use of datetime.datetime.utcfromtimestamp() > in get_build_time_vars. > > datetime.UTC seems to be a getter wrapper for datetime.timezone.utc, > which is already available on older host distro python versions > (I have tested only with python 3.10 provided by Ubuntu 22.04) > so, opt to use that instead to prevent a breaking change. > > Signed-off-by: Stanley Stanton <[email protected]> > --- > recipes-extended/xen/xen.inc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/recipes-extended/xen/xen.inc b/recipes-extended/xen/xen.inc > index dcd281b5..63790f73 100644 > --- a/recipes-extended/xen/xen.inc > +++ b/recipes-extended/xen/xen.inc > @@ -151,7 +151,7 @@ def get_build_time_vars(d): > source_date_epoch = d.getVar('SOURCE_DATE_EPOCH') > if source_date_epoch is not None: > import datetime > - utc_datetime = > datetime.datetime.utcfromtimestamp(float(source_date_epoch)) > + utc_datetime = > datetime.datetime.fromtimestamp(float(source_date_epoch), > datetime.timezone.utc) > return " XEN_BUILD_DATE=" + utc_datetime.strftime("%Y-%m-%d") + \ > " XEN_BUILD_TIME=" + utc_datetime.strftime("%H:%M:%S") > return "" > -- > 2.43.0 > > > -- > > This communication is confidential. We only send and receive email on the > basis of the terms set out at > https://aus01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.taitcommunications.com%2Femail_disclaimer&data=05%7C02%7Cstanley.stanton%40taitcommunications.com%7C031f9b33b39345c39da608dd09e550c8%7Cb9ac1691179e406f90a36d5b9a817466%7C0%7C0%7C638677602708905473%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=Tsw5pm4dYCwVwQAEJAVqa6ChRJKHV%2FyOOLkiLFWo8zE%3D&reserved=0<http://www.taitcommunications.com/email_disclaimer> > <https://aus01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.taitcommunications.com%2Femail_disclaimer&data=05%7C02%7Cstanley.stanton%40taitcommunications.com%7C031f9b33b39345c39da608dd09e550c8%7Cb9ac1691179e406f90a36d5b9a817466%7C0%7C0%7C638677602708929015%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=zbqbUs9GZKe3d%2BhWA3U0b4MrfWFqqYzTgpiPJJHsc1I%3D&reserved=0<http://www.taitcommunications.com/email_disclaimer>> > > > >
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#9013): https://lists.yoctoproject.org/g/meta-virtualization/message/9013 Mute This Topic: https://lists.yoctoproject.org/mt/109659338/21656 Group Owner: [email protected] Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
