Skip to content

Commit

Permalink
Merge pull request #682 from wimglenn/utcfromtimestamp
Browse files Browse the repository at this point in the history
datetime.utcfromtimestamp is deprecated in Python 3.12, avoid using it
  • Loading branch information
takluyver authored May 18, 2024
2 parents 6ba8c7e + 4ea699e commit e6b564b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions flit_core/flit_core/wheel.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import argparse
from base64 import urlsafe_b64encode
import contextlib
from datetime import datetime
from datetime import datetime, timezone
import hashlib
import io
import logging
Expand Down Expand Up @@ -42,7 +42,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 e6b564b

Please sign in to comment.