Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit be3dbb2a authored by Krzysztof Kosiński's avatar Krzysztof Kosiński
Browse files

Fix deprecated utcfromtimestamp() usage.

Fixes the following build warning:

build_image.py:53: 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).

Bug: 402676308
Test: presubmit
Change-Id: I5fe76402231a43aedf5ff5b3ad945fc117d64ffa
parent e13bd368
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -49,8 +49,8 @@ BYTES_IN_MB = 1024 * 1024
# Use a fixed timestamp (01/01/2009 00:00:00 UTC) for files when packaging
# images. (b/24377993, b/80600931)
FIXED_FILE_TIMESTAMP = int((
    datetime.datetime(2009, 1, 1, 0, 0, 0, 0, None) -
    datetime.datetime.utcfromtimestamp(0)).total_seconds())
    datetime.datetime(2009, 1, 1, 0, 0, 0, 0, datetime.UTC) -
    datetime.datetime.fromtimestamp(0, datetime.UTC)).total_seconds())


class BuildImageError(Exception):
+1 −1
Original line number Diff line number Diff line
@@ -2993,7 +2993,7 @@ def ZipWrite(zip_file, filename, arcname=None, perms=0o644,
    os.chmod(filename, perms)

    # Use a fixed timestamp so the output is repeatable.
    # Note: Use of fromtimestamp rather than utcfromtimestamp here is
    # Note: Use of fromtimestamp without specifying a timezone here is
    # intentional. zip stores datetimes in local time without a time zone
    # attached, so we need "epoch" but in the local time zone to get 2009/01/01
    # in the zip archive.