Bug 1275409: move taskcluster_graph.from_now to taskgraph.util.time; r?wcosta draft
authorDustin J. Mitchell <dustin@mozilla.com>
Sat, 04 Jun 2016 19:20:07 +0000
changeset 376700 c51efa5b58107106349f6769620daf0286a3df73
parent 376699 f75814b82cc857ae345a90fbd9e2aad11053e8fd
child 376701 29c48dfa679e325b8eaea6d85187c9189eeedbc8
push id20643
push userdmitchell@mozilla.com
push dateWed, 08 Jun 2016 13:31:04 +0000
reviewerswcosta
bugs1275409
milestone50.0a1
Bug 1275409: move taskcluster_graph.from_now to taskgraph.util.time; r?wcosta MozReview-Commit-ID: 3GFO4f34dg8
taskcluster/taskgraph/kind/docker_image.py
taskcluster/taskgraph/kind/legacy.py
taskcluster/taskgraph/test/test_util_time.py
taskcluster/taskgraph/util/time.py
testing/taskcluster/taskcluster_graph/from_now.py
testing/taskcluster/tests/test_from_now.py
--- a/taskcluster/taskgraph/kind/docker_image.py
+++ b/taskcluster/taskgraph/kind/docker_image.py
@@ -13,17 +13,17 @@ import tarfile
 import time
 
 from . import base
 from ..types import Task
 from taskgraph.util.docker import docker_image
 import taskcluster_graph.transform.routes as routes_transform
 import taskcluster_graph.transform.treeherder as treeherder_transform
 from taskgraph.util.templates import Templates
-from taskcluster_graph.from_now import (
+from taskgraph.util.time import (
     json_time_from_now,
     current_json_time,
 )
 
 logger = logging.getLogger(__name__)
 GECKO = os.path.realpath(os.path.join(__file__, '..', '..', '..', '..'))
 ARTIFACT_URL = 'https://queue.taskcluster.net/v1/task/{}/artifacts/{}'
 INDEX_URL = 'https://index.taskcluster.net/v1/task/{}'
--- a/taskcluster/taskgraph/kind/legacy.py
+++ b/taskcluster/taskgraph/kind/legacy.py
@@ -23,17 +23,17 @@ from taskcluster_graph.mach_util import 
     configure_dependent_task,
     set_interactive_task,
     remove_caches_from_task,
     query_vcs_info
 )
 import taskcluster_graph.transform.routes as routes_transform
 import taskcluster_graph.transform.treeherder as treeherder_transform
 from taskcluster_graph.commit_parser import parse_commit
-from taskcluster_graph.from_now import (
+from taskgraph.util.time import (
     json_time_from_now,
     current_json_time,
 )
 from taskgraph.util.templates import Templates
 import taskcluster_graph.build_task
 from taskgraph.util.docker import docker_image
 
 # TASKID_PLACEHOLDER is the "internal" form of a taskid; it is substituted with
rename from testing/taskcluster/tests/test_from_now.py
rename to taskcluster/taskgraph/test/test_util_time.py
--- a/testing/taskcluster/tests/test_from_now.py
+++ b/taskcluster/taskgraph/test/test_util_time.py
@@ -1,12 +1,18 @@
+# -*- coding: utf-8 -*-
+
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
 import unittest
 import mozunit
 from datetime import datetime
-from taskcluster_graph.from_now import (
+from taskgraph.util.time import (
     InvalidString,
     UnknownTimeMeasurement,
     value_of,
     json_time_from_now
 )
 
 class FromNowTest(unittest.TestCase):
 
rename from testing/taskcluster/taskcluster_graph/from_now.py
rename to taskcluster/taskgraph/util/time.py
--- a/testing/taskcluster/taskcluster_graph/from_now.py
+++ b/taskcluster/taskgraph/util/time.py
@@ -1,8 +1,12 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
 # Python port of the ms.js node module this is not a direct port some things are
 # more complicated or less precise and we lean on time delta here.
 
 import re
 import datetime
 
 PATTERN=re.compile(
     '((?:\d+)?\.?\d+) *([a-z]+)'
@@ -83,8 +87,9 @@ def json_time_from_now(input_str, now=No
     return time.isoformat() + 'Z'
 
 def current_json_time():
     '''
     :returns: JSON string representation of the current time.
     '''
 
     return datetime.datetime.utcnow().isoformat() + 'Z'
+