Prechádzať zdrojové kódy

Remove python 2.5 compatibility code.

R=cmp@chromium.org
BUG=
TEST=


Review URL: http://codereview.chromium.org/10165007

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@133265 0039d316-1c4b-4281-b951-d872f2087c98
maruel@chromium.org 13 rokov pred
rodič
commit
4f6852cca4

+ 0 - 1
checkout.py

@@ -7,7 +7,6 @@
 Includes support for svn, git-svn and git.
 """
 
-from __future__ import with_statement
 import ConfigParser
 import fnmatch
 import logging

+ 1 - 9
gcl.py

@@ -8,6 +8,7 @@ Wrapper script around Rietveld's upload.py that simplifies working with groups
 of files.
 """
 
+import json
 import optparse
 import os
 import random
@@ -20,15 +21,6 @@ import urllib2
 
 import breakpad  # pylint: disable=W0611
 
-try:
-  import simplejson as json  # pylint: disable=F0401
-except ImportError:
-  try:
-    import json  # pylint: disable=F0401
-  except ImportError:
-    # Import the one included in depot_tools.
-    sys.path.append(os.path.join(os.path.dirname(__file__), 'third_party'))
-    import simplejson as json  # pylint: disable=F0401
 
 import fix_encoding
 import gclient_utils

+ 1 - 10
git_cl.py

@@ -7,6 +7,7 @@
 
 """A git-command for integrating reviews on Rietveld."""
 
+import json
 import logging
 import optparse
 import os
@@ -23,16 +24,6 @@ try:
 except ImportError:
   pass
 
-try:
-  import simplejson as json  # pylint: disable=F0401
-except ImportError:
-  try:
-    import json  # pylint: disable=F0401
-  except ImportError:
-    # Fall back to the packaged version.
-    sys.path.append(os.path.join(os.path.dirname(__file__), 'third_party'))
-    import simplejson as json  # pylint: disable=F0401
-
 
 from third_party import upload
 import breakpad  # pylint: disable=W0611

+ 0 - 3
presubmit_canned_checks.py

@@ -695,9 +695,6 @@ def CheckRietveldTryJobExecution(input_api, output_api, host_url, platforms,
 
 def CheckBuildbotPendingBuilds(input_api, output_api, url, max_pendings,
     ignored):
-  if not input_api.json:
-    return [output_api.PresubmitPromptWarning(
-      'Please install simplejson or upgrade to python 2.6+')]
   try:
     connection = input_api.urllib2.urlopen(url)
     raw_data = connection.read()

+ 1 - 10
presubmit_support.py

@@ -17,6 +17,7 @@ import cStringIO  # Exposed through the API.
 import fnmatch
 import glob
 import inspect
+import json  # Exposed through the API.
 import logging
 import marshal  # Exposed through the API.
 import optparse
@@ -33,16 +34,6 @@ import unittest  # Exposed through the API.
 import urllib2  # Exposed through the API.
 from warnings import warn
 
-try:
-  import simplejson as json  # pylint: disable=F0401
-except ImportError:
-  try:
-    import json  # pylint: disable=F0401
-  except ImportError:
-    # Import the one included in depot_tools.
-    sys.path.append(os.path.join(os.path.dirname(__file__), 'third_party'))
-    import simplejson as json  # pylint: disable=F0401
-
 # Local imports.
 import fix_encoding
 import gclient_utils

+ 1 - 12
rietveld.py

@@ -13,23 +13,12 @@ The following hypothesis are made:
   - A patch set cannot be modified
 """
 
+import json
 import logging
-import os
 import re
-import sys
 import time
 import urllib2
 
-try:
-  import simplejson as json  # pylint: disable=F0401
-except ImportError:
-  try:
-    import json  # pylint: disable=F0401
-  except ImportError:
-    # Import the one included in depot_tools.
-    sys.path.append(os.path.join(os.path.dirname(__file__), 'third_party'))
-    import simplejson as json  # pylint: disable=F0401
-
 from third_party import upload
 import patch
 

+ 1 - 2
subprocess2.py

@@ -1,5 +1,5 @@
 # coding=utf8
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 """Collection of subprocess wrapper functions.
@@ -7,7 +7,6 @@
 In theory you shouldn't need anything else in subprocess, or this module failed.
 """
 
-from __future__ import with_statement
 import cStringIO
 import errno
 import logging

+ 1 - 2
tests/checkout_test.py

@@ -1,11 +1,10 @@
 #!/usr/bin/env python
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 """Unit tests for checkout.py."""
 
-from __future__ import with_statement
 import logging
 import os
 import shutil

+ 0 - 1
tests/gclient_test.py

@@ -8,7 +8,6 @@
 See gclient_smoketest.py for integration tests.
 """
 
-from __future__ import with_statement
 import Queue
 import logging
 import os

+ 1 - 2
tests/scm_unittest.py

@@ -1,11 +1,10 @@
 #!/usr/bin/env python
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 """Unit tests for scm.py."""
 
-from __future__ import with_statement
 import logging
 import os
 import sys

+ 1 - 12
trychange.py

@@ -11,6 +11,7 @@ to the server by HTTP.
 import datetime
 import errno
 import getpass
+import json
 import logging
 import optparse
 import os
@@ -21,16 +22,6 @@ import sys
 import tempfile
 import urllib
 
-try:
-  import simplejson as json  # pylint: disable=F0401
-except ImportError:
-  try:
-    import json  # pylint: disable=F0401
-  except ImportError:
-    # Import the one included in depot_tools.
-    sys.path.append(os.path.join(os.path.dirname(__file__), 'third_party'))
-    import simplejson as json  # pylint: disable=F0401
-
 import breakpad  # pylint: disable=W0611
 
 import gcl
@@ -744,8 +735,6 @@ def TryChange(argv,
     elif options.issue and options.patchset is None:
       # Retrieve the patch from rietveld when the diff is not specified.
       # When patchset is specified, it's because it's done by gcl/git-try.
-      if json is None:
-        parser.error('json or simplejson library is missing, please install.')
       api_url = '%s/api/%d' % (options.rietveld_url, options.issue)
       logging.debug(api_url)
       contents = json.loads(urllib.urlopen(api_url).read())