Commit 725f1c3b authored by maruel@chromium.org's avatar maruel@chromium.org

Add a warning if the current version of python is not 2.5

R=dpranke@chromium.org
BUG=
TEST=

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@80212 0039d316-1c4b-4281-b951-d872f2087c98
parent fe79c31e
......@@ -11,6 +11,17 @@ details on the presubmit API built into depot_tools.
def CommonChecks(input_api, output_api):
results = []
import sys
if not sys.version.startswith('2.5'):
# Depot_tools has the particularity that it needs to be tested on python
# 2.5. But we don't want the presubmit check to fail if it is not installed.
results.append(output_api.PresubmitNotifyResult(
'You should install python 2.5 and run ln -s $(which python2.5) python.'
'\n'
'A great place to put this symlink is in depot_tools.\n'
'Otherwise, you break depot_tools on python 2.5, you get to keep the '
'pieces.'))
results.extend(input_api.canned_checks.CheckOwners(input_api, output_api))
black_list = list(input_api.DEFAULT_BLACK_LIST) + [
......
#!/usr/bin/python
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
#!/usr/bin/env python
# Copyright (c) 2011 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.
......
#!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
#!/usr/bin/env python
# Copyright (c) 2011 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.
......
......@@ -187,7 +187,8 @@ class WinUnicodeConsoleOutput(WinUnicodeOutputBase):
# Loads the necessary function.
from ctypes import byref, GetLastError, POINTER, windll, WINFUNCTYPE
from ctypes.wintypes import BOOL, DWORD, HANDLE, LPVOID, LPWSTR
from ctypes.wintypes import BOOL, DWORD, HANDLE, LPWSTR
from ctypes.wintypes import LPVOID # pylint: disable=E0611
self._DWORD = DWORD
self._byref = byref
......
#!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
#!/usr/bin/env python
# Copyright (c) 2011 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.
......@@ -25,12 +25,8 @@ try:
import simplejson as json # pylint: disable=F0401
except ImportError:
try:
import json
# Some versions of python2.5 have an incomplete json module. Check to make
# sure loads exists.
# pylint: disable=W0104
json.loads
except (ImportError, AttributeError):
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
......
#!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
#!/usr/bin/env python
# Copyright (c) 2011 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.
......
#!/usr/bin/python
# git-cl -- a git-command for integrating reviews on Rietveld
#!/usr/bin/env python
# Copyright (c) 2011 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.
# Copyright (C) 2008 Evan Martin <martine@danga.com>
"""A git-command for integrating reviews on Rietveld."""
import errno
import logging
import optparse
......@@ -23,7 +28,7 @@ try:
import simplejson as json # pylint: disable=F0401
except ImportError:
try:
import json
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'))
......
......@@ -18,6 +18,8 @@ BASIC_EMAIL_REGEXP = r'^[\w\-\+\%\.]+\@[\w\-\+\%\.]+$'
def _assert_is_collection(obj):
assert not isinstance(obj, basestring)
# Module 'collections' has no 'Iterable' member
# pylint: disable=E1101
if hasattr(collections, 'Iterable') and hasattr(collections, 'Sized'):
assert (isinstance(obj, collections.Iterable) and
isinstance(obj, collections.Sized))
......
......@@ -598,6 +598,7 @@ def RunPylint(input_api, output_api, white_list=None, black_list=None):
return [output_api.PresubmitError(
'Please install pylint with "sudo apt-get install python-setuptools; '
'sudo easy_install pylint"\n'
'or visit http://pypi.python.org/pypi/setuptools.\n'
'Cannot do static analysis of python files.')]
if result:
if input_api.is_committing:
......
#!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
#!/usr/bin/env python
# Copyright (c) 2011 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.
......@@ -38,13 +38,8 @@ try:
import simplejson as json # pylint: disable=F0401
except ImportError:
try:
import json
# Some versions of python2.5 have an incomplete json module. Check to make
# sure loads exists.
# Statement seems to have no effect
# pylint: disable=W0104
json.loads
except (ImportError, AttributeError):
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
......
#!/usr/bin/python
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
#!/usr/bin/env python
# Copyright (c) 2011 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.
......@@ -25,20 +25,15 @@ try:
import simplejson as json # pylint: disable=F0401
except ImportError:
try:
import json
import json # pylint: disable=F0401
except ImportError:
json = None
# 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
try:
import breakpad # pylint: disable=W0611
except ImportError:
pass
try:
import gcl
except ImportError:
gcl = None
import breakpad # pylint: disable=W0611
import gcl
import fix_encoding
import gclient_utils
import scm
......
#!/usr/bin/python
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
#!/usr/bin/env python
# Copyright (c) 2011 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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment