fix py26 compatibility
This commit is contained in:
parent
d520dce8a2
commit
8acb4a4fd3
1 changed files with 5 additions and 1 deletions
|
|
@ -611,7 +611,11 @@ def download_file(url, relpath, quiet=False, noprogress=False, size=None,
|
|||
if last_modified:
|
||||
mtime = dateutil.parser.parse(last_modified)
|
||||
if mtime:
|
||||
os.utime(relpath, (time.time() ,time.mktime(mtime.astimezone().timetuple())))
|
||||
# py 2.6 modifications, see koji.formatTimeLong
|
||||
if mtime.tzinfo is None:
|
||||
mtime = mtime.replace(tzinfo=dateutil.tz.gettz())
|
||||
mtime = mtime.astimezone(dateutil.tz.gettz())
|
||||
os.utime(relpath, (time.time(), time.mktime(mtime.timetuple())))
|
||||
finally:
|
||||
f.close()
|
||||
if pos == 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue