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
experimental/szager/collated-output
maruel@chromium.org 15 years ago
parent fe79c31e20
commit 725f1c3b69

@ -11,6 +11,17 @@ details on the presubmit API built into depot_tools.
def CommonChecks(input_api, output_api): def CommonChecks(input_api, output_api):
results = [] 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)) results.extend(input_api.canned_checks.CheckOwners(input_api, output_api))
black_list = list(input_api.DEFAULT_BLACK_LIST) + [ black_list = list(input_api.DEFAULT_BLACK_LIST) + [

@ -1,5 +1,5 @@
#!/usr/bin/python #!/usr/bin/env python
# Copyright (c) 2009 The Chromium Authors. All rights reserved. # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.

@ -1,5 +1,5 @@
#!/usr/bin/python #!/usr/bin/env python
# Copyright (c) 2010 The Chromium Authors. All rights reserved. # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.

@ -187,7 +187,8 @@ class WinUnicodeConsoleOutput(WinUnicodeOutputBase):
# Loads the necessary function. # Loads the necessary function.
from ctypes import byref, GetLastError, POINTER, windll, WINFUNCTYPE 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._DWORD = DWORD
self._byref = byref self._byref = byref

@ -1,5 +1,5 @@
#!/usr/bin/python #!/usr/bin/env python
# Copyright (c) 2010 The Chromium Authors. All rights reserved. # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
@ -25,12 +25,8 @@ try:
import simplejson as json # pylint: disable=F0401 import simplejson as json # pylint: disable=F0401
except ImportError: except ImportError:
try: try:
import json import json # pylint: disable=F0401
# Some versions of python2.5 have an incomplete json module. Check to make except ImportError:
# sure loads exists.
# pylint: disable=W0104
json.loads
except (ImportError, AttributeError):
# Import the one included in depot_tools. # Import the one included in depot_tools.
sys.path.append(os.path.join(os.path.dirname(__file__), 'third_party')) sys.path.append(os.path.join(os.path.dirname(__file__), 'third_party'))
import simplejson as json # pylint: disable=F0401 import simplejson as json # pylint: disable=F0401

@ -1,5 +1,5 @@
#!/usr/bin/python #!/usr/bin/env python
# Copyright (c) 2010 The Chromium Authors. All rights reserved. # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.

@ -1,7 +1,12 @@
#!/usr/bin/python #!/usr/bin/env python
# git-cl -- a git-command for integrating reviews on Rietveld # 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> # Copyright (C) 2008 Evan Martin <martine@danga.com>
"""A git-command for integrating reviews on Rietveld."""
import errno import errno
import logging import logging
import optparse import optparse
@ -23,7 +28,7 @@ try:
import simplejson as json # pylint: disable=F0401 import simplejson as json # pylint: disable=F0401
except ImportError: except ImportError:
try: try:
import json import json # pylint: disable=F0401
except ImportError: except ImportError:
# Fall back to the packaged version. # Fall back to the packaged version.
sys.path.append(os.path.join(os.path.dirname(__file__), 'third_party')) 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): def _assert_is_collection(obj):
assert not isinstance(obj, basestring) assert not isinstance(obj, basestring)
# Module 'collections' has no 'Iterable' member
# pylint: disable=E1101
if hasattr(collections, 'Iterable') and hasattr(collections, 'Sized'): if hasattr(collections, 'Iterable') and hasattr(collections, 'Sized'):
assert (isinstance(obj, collections.Iterable) and assert (isinstance(obj, collections.Iterable) and
isinstance(obj, collections.Sized)) isinstance(obj, collections.Sized))

@ -598,6 +598,7 @@ def RunPylint(input_api, output_api, white_list=None, black_list=None):
return [output_api.PresubmitError( return [output_api.PresubmitError(
'Please install pylint with "sudo apt-get install python-setuptools; ' 'Please install pylint with "sudo apt-get install python-setuptools; '
'sudo easy_install pylint"\n' 'sudo easy_install pylint"\n'
'or visit http://pypi.python.org/pypi/setuptools.\n'
'Cannot do static analysis of python files.')] 'Cannot do static analysis of python files.')]
if result: if result:
if input_api.is_committing: if input_api.is_committing:

@ -1,5 +1,5 @@
#!/usr/bin/python #!/usr/bin/env python
# Copyright (c) 2010 The Chromium Authors. All rights reserved. # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
@ -38,13 +38,8 @@ try:
import simplejson as json # pylint: disable=F0401 import simplejson as json # pylint: disable=F0401
except ImportError: except ImportError:
try: try:
import json import json # pylint: disable=F0401
# Some versions of python2.5 have an incomplete json module. Check to make except ImportError:
# sure loads exists.
# Statement seems to have no effect
# pylint: disable=W0104
json.loads
except (ImportError, AttributeError):
# Import the one included in depot_tools. # Import the one included in depot_tools.
sys.path.append(os.path.join(os.path.dirname(__file__), 'third_party')) sys.path.append(os.path.join(os.path.dirname(__file__), 'third_party'))
import simplejson as json # pylint: disable=F0401 import simplejson as json # pylint: disable=F0401

@ -1,5 +1,5 @@
#!/usr/bin/python #!/usr/bin/env python
# Copyright (c) 2009 The Chromium Authors. All rights reserved. # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
@ -25,20 +25,15 @@ try:
import simplejson as json # pylint: disable=F0401 import simplejson as json # pylint: disable=F0401
except ImportError: except ImportError:
try: try:
import json import json # pylint: disable=F0401
except ImportError: 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
import breakpad # pylint: disable=W0611
except ImportError:
pass
try:
import gcl
except ImportError:
gcl = None
import gcl
import fix_encoding import fix_encoding
import gclient_utils import gclient_utils
import scm import scm

@ -1,5 +1,5 @@
#!/usr/bin/python #!/usr/bin/env python
# Copyright (c) 2009 The Chromium Authors. All rights reserved. # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.

Loading…
Cancel
Save