Python 3: move to recent ciso8601 2.x branch
authorchapmanb <chapmanb@50mail.com>
Sun, 24 Feb 2019 10:46:26 +0000 (05:46 -0500)
committerchapmanb <chapmanb@50mail.com>
Sun, 24 Feb 2019 10:46:26 +0000 (05:46 -0500)
Older ciso8601 versions are not built for Python 3.7 which
prevents migration to latest Python on conda packaging. This
swaps over usage to match the breaking 2.x changes:

https://github.com/closeio/ciso8601/blob/master/CHANGELOG.md#v1xx---200-migration-guide

Arvados-DCO-1.1-Signed-off-by: Brad Chapman <chapmanb@fastmail.com>

sdk/python/arvados/collection.py
sdk/python/arvados/commands/keepdocker.py
sdk/python/setup.py

index 7ad07cc607206fe32f46fe0c94cf9ea34e115224..5b1f1a2a677fa15dad5801635ff0e6f639985584 100644 (file)
@@ -1347,7 +1347,10 @@ class Collection(RichCollectionBase):
 
     def get_trash_at(self):
         if self._api_response and self._api_response["trash_at"]:
-            return ciso8601.parse_datetime(self._api_response["trash_at"])
+            try:
+                return ciso8601.parse_datetime(self._api_response["trash_at"])
+            except ValueError:
+                return None
         else:
             return None
 
index ac387a6f6c7a29ea56e143279f20aca5c166947f..ec2a9942a6794153ea69138ba467a20f8b1ae6a6 100644 (file)
@@ -230,12 +230,15 @@ def docker_link_sort_key(link):
     Docker metadata links to sort them from least to most preferred.
     """
     try:
-        image_timestamp = ciso8601.parse_datetime_unaware(
+        image_timestamp = ciso8601.parse_datetime_as_naive(
             link['properties']['image_timestamp'])
     except (KeyError, ValueError):
         image_timestamp = EARLIEST_DATETIME
-    return (image_timestamp,
-            ciso8601.parse_datetime_unaware(link['created_at']))
+    try:
+        created_timestamp = ciso8601.parse_datetime_as_naive(link['created_at'])
+    except ValueError:
+        created_timestamp = None
+    return (image_timestamp, created_timestamp)
 
 def _get_docker_links(api_client, num_retries, **kwargs):
     links = arvados.util.list_all(api_client.links().list,
index aaa07103381ccb8dd78d321cb90907bec727ec75..f4b4012a0b177cddddf1f0972b2e253627b4303f 100644 (file)
@@ -46,7 +46,7 @@ setup(name='arvados-python-client',
           ('share/doc/arvados-python-client', ['LICENSE-2.0.txt', 'README.rst']),
       ],
       install_requires=[
-          'ciso8601 >=1.0.6, <2.0.0',
+          'ciso8601 >=2.0.0',
           'future',
           'google-api-python-client >=1.6.2, <1.7',
           'httplib2 >=0.9.2',