File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77#
88
99import os
10- from datetime import datetime
10+ from datetime import datetime , timezone
1111
1212from commoncode .system import on_posix
1313from commoncode .functional import memoize
@@ -164,7 +164,10 @@ def get_last_modified_date(location):
164164 yyyymmdd = ''
165165 if is_file (location ):
166166 utc_date = datetime .isoformat (
167- datetime .utcfromtimestamp (os .path .getmtime (location ))
167+ datetime .fromtimestamp (
168+ os .path .getmtime (location ),
169+ tz = timezone .utc ,
170+ )
168171 )
169172 yyyymmdd = utc_date [:10 ]
170173 return yyyymmdd
Original file line number Diff line number Diff line change @@ -94,8 +94,10 @@ def is_on_ubuntu_22(os_release_location='/etc/os-release'):
9494 os_release_info = parse_os_release (os_release_location )
9595 return os_release_info ['ID' ] == 'ubuntu' and '22' in os_release_info ['VERSION_ID' ]
9696
97-
98- on_ubuntu_22 = is_on_ubuntu_22 ()
97+ try :
98+ on_ubuntu_22 = is_on_ubuntu_22 ()
99+ except FileNotFoundError :
100+ on_ubuntu_22 = False
99101
100102del is_on_ubuntu_22
101103
You can’t perform that action at this time.
0 commit comments