Skip to content

Commit

Permalink
datetime.utcfromtimestamp is deprecated in Python 3.12, avoid using it
Browse files Browse the repository at this point in the history
  • Loading branch information
wimglenn committed May 14, 2024
1 parent 6ba8c7e commit 915fa61
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion flit_core/flit_core/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from base64 import urlsafe_b64encode
import contextlib
from datetime import datetime
from datetime import timezone
import hashlib
import io
import logging
Expand Down Expand Up @@ -42,7 +43,8 @@ def zip_timestamp_from_env() -> Optional[tuple]:
try:
# If SOURCE_DATE_EPOCH is set (e.g. by Debian), it's used for
# timestamps inside the zip file.
d = datetime.utcfromtimestamp(int(os.environ['SOURCE_DATE_EPOCH']))
t = int(os.environ['SOURCE_DATE_EPOCH'])
d = datetime.fromtimestamp(t, timezone.utc)
except (KeyError, ValueError):
# Otherwise, we'll use the mtime of files, and generated files will
# default to 2016-1-1 00:00:00
Expand Down

0 comments on commit 915fa61

Please sign in to comment.