Closed
Description
I've been going through the tuf dependency chain with an eye on integrating tuf with pip: The issue with pip is that it's a package manager so needs to vendor everything it needs -- so being conservative with dependencies is a good idea. The good news is that tuf does not have many direct or indirect dependencies that would be a problem (good work!).
The one that possibly sticks out is "iso8601". The module is currently used in two places:
- repository_tool: Metadata.expiration property getter uses it to return a datetime object
- updater.py: Updater::_ensure_not_expired()
I'm mostly interested in that last one. it's used to compare the expiration stamp to current time and to format the error message:
expires_datetime = iso8601.parse_date(expires)
expires_timestamp = tuf.formats.datetime_to_unix_timestamp(expires_datetime)
if expires_timestamp < current_time:
message = 'Metadata '+repr(metadata_rolename)+' expired on ' + \
expires_datetime.ctime() + ' (UTC).'
logger.error(message)
raise tuf.exceptions.ExpiredMetadataError(message)
I'm not familiar with date handling in python so my question is: Is this dependency valid or could this code be replaced with something that did not depend on iso8601?