All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] support/scripts/pkg-stats: fix running on older python versions
@ 2024-02-28 22:44 Yann E. MORIN
  2024-02-29 16:05 ` Peter Korsgaard
  2024-02-29 16:05 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: Yann E. MORIN @ 2024-02-28 22:44 UTC (permalink / raw)
  To: buildroot; +Cc: Yann E. MORIN

Commit f71d9f49e546 (support/scripts/pkg-stats: fix datetime deprecation
warning) forgot to consider that the datetime.UTC suggested by python
3.12, was only introduced with python 3.11.

However, we are still generating the daily report on a python 3.8
version, which fails at runtime:
    AttributeError: module 'datetime' has no attribute 'UTC'

It turns out that datetime.UTC is just an alias for datetime.timezone.utc,
which seems to have existed since before python3...

Use datetime.timezone.utc instead of its alias.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
 support/scripts/pkg-stats | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
index 9a4a3ccad5..53898a36f2 100755
--- a/support/scripts/pkg-stats
+++ b/support/scripts/pkg-stats
@@ -1290,7 +1290,7 @@ def __main__():
         package_list = set([v["name"] for v in show_info_js.values() if 'name' in v])
     else:
         package_list = None
-    date = datetime.datetime.now(datetime.UTC)
+    date = datetime.datetime.now(datetime.timezone.utc)
     commit = subprocess.check_output(['git', '-C', brpath,
                                       'rev-parse',
                                       'HEAD']).splitlines()[0].decode()
-- 
2.43.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH] support/scripts/pkg-stats: fix running on older python versions
  2024-02-28 22:44 [Buildroot] [PATCH] support/scripts/pkg-stats: fix running on older python versions Yann E. MORIN
@ 2024-02-29 16:05 ` Peter Korsgaard
  2024-02-29 16:05 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2024-02-29 16:05 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: buildroot

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > Commit f71d9f49e546 (support/scripts/pkg-stats: fix datetime deprecation
 > warning) forgot to consider that the datetime.UTC suggested by python
 > 3.12, was only introduced with python 3.11.

 > However, we are still generating the daily report on a python 3.8
 > version, which fails at runtime:
 >     AttributeError: module 'datetime' has no attribute 'UTC'

 > It turns out that datetime.UTC is just an alias for datetime.timezone.utc,
 > which seems to have existed since before python3...

 > Use datetime.timezone.utc instead of its alias.

 > Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>

Committed, thanks.

> ---
 >  support/scripts/pkg-stats | 2 +-
 >  1 file changed, 1 insertion(+), 1 deletion(-)

 > diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
 > index 9a4a3ccad5..53898a36f2 100755
 > --- a/support/scripts/pkg-stats
 > +++ b/support/scripts/pkg-stats
 > @@ -1290,7 +1290,7 @@ def __main__():
 >          package_list = set([v["name"] for v in show_info_js.values() if 'name' in v])
 >      else:
 >          package_list = None
 > -    date = datetime.datetime.now(datetime.UTC)
 > +    date = datetime.datetime.now(datetime.timezone.utc)
 >      commit = subprocess.check_output(['git', '-C', brpath,
 >                                        'rev-parse',
 >                                        'HEAD']).splitlines()[0].decode()
 > -- 

 > 2.43.2

 > _______________________________________________
 > buildroot mailing list
 > buildroot@buildroot.org
 > https://lists.buildroot.org/mailman/listinfo/buildroot


-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH] support/scripts/pkg-stats: fix running on older python versions
  2024-02-28 22:44 [Buildroot] [PATCH] support/scripts/pkg-stats: fix running on older python versions Yann E. MORIN
  2024-02-29 16:05 ` Peter Korsgaard
@ 2024-02-29 16:05 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2024-02-29 16:05 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: buildroot

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > Commit f71d9f49e546 (support/scripts/pkg-stats: fix datetime deprecation
 > warning) forgot to consider that the datetime.UTC suggested by python
 > 3.12, was only introduced with python 3.11.

 > However, we are still generating the daily report on a python 3.8
 > version, which fails at runtime:
 >     AttributeError: module 'datetime' has no attribute 'UTC'

 > It turns out that datetime.UTC is just an alias for datetime.timezone.utc,
 > which seems to have existed since before python3...

 > Use datetime.timezone.utc instead of its alias.

 > Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>

Committed, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-29 16:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-28 22:44 [Buildroot] [PATCH] support/scripts/pkg-stats: fix running on older python versions Yann E. MORIN
2024-02-29 16:05 ` Peter Korsgaard
2024-02-29 16:05 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.