Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 934226

Summary: sys-apps/portage: Python deprecation warnings about datetime.datetime.utcnow() with e.g. emerge --sync
Product: Portage Development Reporter: Hanno Böck <hanno>
Component: CoreAssignee: Portage team <dev-portage>
Status: CONFIRMED ---    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=934229
Whiteboard:
Package list:
Runtime testing required: ---

Description Hanno Böck gentoo-dev 2024-06-14 06:48:54 UTC
With python 3.12 and enabed warnings, python complains about the use of datetime.datetime.utcfromtimestamp() in portage. There are warnings both about portage's own code (rsync.py) and in gemato (openpgp.py).

To reproduce:
PYTHONWARNINGS=d emerge --sync -q

Output:

/usr/lib/python3.12/site-packages/gemato/openpgp.py:171: 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).
  return datetime.datetime.utcfromtimestamp(int(ts))
/usr/lib/python3.12/site-packages/portage/sync/modules/rsync/rsync.py:440: 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).
  and (datetime.datetime.utcnow() - ts.ts).days > self.max_age
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-14 06:52:17 UTC
Please file a separate bug for the gemato issue, as it lives in a separate repo and so on.