Thanks for the feedback Bruce. To clarify:
*
Yes, the hosttools Python version is being used for the get_build_time_vars
function in xen.inc.
*
The warning in particular I'm seeing
*
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)
*
I have only truly tested the backwards compatibility with Ubuntu 22.04, which
provides python 3.10. A brief look also shows that python 3.2 contained
datetime.timezone, which is the API used in the patch.
I will send a v2 of this patch describing this information.
Thanks,
Stanley
________________________________
From: Bruce Ashfield <[email protected]>
Sent: Tuesday, November 19, 2024 3:40 PM
To: [email protected] <[email protected]>
Cc: Stanley Stanton <[email protected]>;
[email protected]
<[email protected]>
Subject: Re: [meta-virtualization] [PATCH] xen.inc: python 3.12: fix datetime
deprecation warning
You don't often get email from [email protected]. Learn why this is
important<https://aka.ms/LearnAboutSenderIdentification>
On Mon, Nov 18, 2024 at 9:30 PM Bruce Ashfield via
lists.yoctoproject.org<http://lists.yoctoproject.org/>
<[email protected]<mailto:[email protected]>>
wrote:
On Mon, Nov 18, 2024 at 5:32 PM Stanley Stanton via
lists.yoctoproject.org<http://lists.yoctoproject.org/>
<[email protected]<mailto:[email protected]>>
wrote:
Datetime.UTC seems is a wrapper for datetime.timezone.utc,
which is available on both python 3.10, and python 3.12 (Ubuntu 24.04)
so, opt to use that instead.
No objection to the patch, but this commit log doesn't actually tell me what
the problem is, so I can't tell what this is fixing.
Sorry, what I meant to say (and I said it badly), is that we should capture the
warning that is being thrown, since that is what someone will search for if
they are having the same issue.
We also need to make sure that all of the versions of python (and hosts)
supported by OE core / yocto have the function in question (or does this just
get executed by python3-native and not the host python ? .. I'll have to check
on that tomorrow, I can't recall right now). Your current commit log makes me
think that it is the host distro python, otherwise, the version of python in
ubuntu 24.04 isn't relevant.
Bruce
Bruce
Signed-off-by: Stanley Stanton
<[email protected]<mailto:[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
www.taitcommunications.com/email_disclaimer<http://www.taitcommunications.com/email_disclaimer>
<http://www.taitcommunications.com/email_disclaimer>
--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at
its end
- "Use the force Harry" - Gandalf, Star Trek II
--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at
its end
- "Use the force Harry" - Gandalf, Star Trek II
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8975):
https://lists.yoctoproject.org/g/meta-virtualization/message/8975
Mute This Topic: https://lists.yoctoproject.org/mt/109654730/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-