6
6
7
7
import base64
8
8
from copy import deepcopy
9
- import datetime
9
+ from datetime import datetime , timezone
10
10
import os
11
11
from pathlib import Path
12
12
import importlib .resources
@@ -32,7 +32,7 @@ class GitCommit:
32
32
short_sha = ""
33
33
timestamp = None
34
34
35
- def __init__ (self , short_sha : str , timestamp : datetime . datetime ):
35
+ def __init__ (self , short_sha : str , timestamp : datetime ):
36
36
self .short_sha = short_sha
37
37
self .timestamp = timestamp
38
38
@@ -216,7 +216,7 @@ def last_commit(self) -> Optional[GitCommit]:
216
216
git_command = git .cmd .Git (self .path )
217
217
output = git_command .show ("-s" , "--format=%h %ct" , "HEAD" ).split ()
218
218
219
- self ._last_commit = GitCommit (output [0 ], datetime .datetime . fromtimestamp (int (output [1 ]), datetime . timezone .utc ))
219
+ self ._last_commit = GitCommit (output [0 ], datetime .fromtimestamp (int (output [1 ]), timezone .utc ))
220
220
except Exception :
221
221
self ._last_commit = None
222
222
@@ -1017,7 +1017,7 @@ def set_release_timestamp(self) -> None:
1017
1017
"""
1018
1018
1019
1019
if self .metadata_dom .xpath ("/package/metadata/dc:date[text() = '1900-01-01T00:00:00Z']" ):
1020
- now = datetime .datetime . utcnow ( )
1020
+ now = datetime .now ( timezone . utc )
1021
1021
now_iso = regex .sub (r"\.[0-9]+$" , "" , now .isoformat ()) + "Z"
1022
1022
now_iso = regex .sub (r"\+.+?Z$" , "Z" , now_iso )
1023
1023
now_friendly = f"{ now :%B %e, %Y, %l:%M <abbr class=\"eoc\">%p</abbr>} "
0 commit comments