Commit Graph

17 Commits (chrome/3904)

Author SHA1 Message Date
Raul Tambre 65c2b1e1d1 fix_encoding: Do unicode type checks only on Python 2
The unicode type doesn't exist in Python 3, because everything's Unicode.

This would resulted in the following error on Python 3:
<Unicode console <stderr>>.write: NameError("name 'unicode' is not defined")

Bug: 942522
Change-Id: I3e90d078df64abcec2c79aa69881deea40ff7d01
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1701401
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Raul Tambre <raul@tambre.ee>
Auto-Submit: Raul Tambre <raul@tambre.ee>
6 years ago
Raul Tambre 80ee78e7fa Convert print statements to Python 3 style
Ran "2to3 -w -n -f print ./" and manually added imports.
Ran "^\s*print " and "\s+print " to find batch/shell scripts, comments and the like with embedded code, and updated them manually.
Also manually added imports to files, which used print as a function, but were missing the import.

The scripts still work with Python 2.
There are no intended behaviour changes.

Bug: 942522
Change-Id: Id777e4d4df4adcdfdab1b18bde89f235ef491b9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1595684
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Auto-Submit: Raul Tambre <raul@tambre.ee>
6 years ago
Raul Tambre b946b2389c Improve gclient Python 3 compatibility
This enables gclient sync and gclient runhooks to run, barring hook script failures.
git cl upload also now works.

The scripts still work with Python 2.
There are no intended behaviour changes.

Bug: 942522
Change-Id: I2ac587b5f803ba7f5bb5e412337ce049f4b1a741
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1524583
Commit-Queue: Raul Tambre <raul@tambre.ee>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
6 years ago
Quinten Yearsley b2cc4a94da depot_tools: Replace pylint error numbers with symbolic names.
This affects a bunch of files, but only changes comments,
and shouldn't make any difference to behavior.

The purpose is to slightly improve readability of pylint
disable comments.

Change-Id: Ic6cd0f8de792b31d91c6125f6da2616450b30f11
Reviewed-on: https://chromium-review.googlesource.com/420412
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
8 years ago
qyearsley 12fa6ff69b Run auto-spell-checker (codespell) on files in depot_tools.
This should only change spelling in:
 - messages that are printed
 - comments
 - docstrings

Review-Url: https://codereview.chromium.org/2277513002
9 years ago
iannucci@chromium.org 8b7274b1a2 Use getdefaultlocale in fix_encoding
R=dnj@chromium.org, maruel@chromium.org
BUG=595883

Review URL: https://codereview.chromium.org/1843843002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299547 0039d316-1c4b-4281-b951-d872f2087c98
9 years ago
maruel@chromium.org 3215234993 Convert old-style exception handling to current format in fix_encoding.py.
With this change, fix_encoding can be imported in python3.
fix_encoding.fix_encoding() returns False because, at least on my Ubuntu 14.04
system running python 3.4.3;

  sys.getdefaultencoding() == 'utf-8'

The Windows specific code hasn't been tested on python3 and is expected to
require fixes.

R=vapier@chromium.org
BUG=61357

Review URL: https://codereview.chromium.org/1710553003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@298834 0039d316-1c4b-4281-b951-d872f2087c98
9 years ago
avakulenko@google.com 255f2bea85 Update cpplint.py to r141.
This just a copy of cpplint.py from upstream [1].

[1] https://code.google.com/p/google-styleguide/source/detail?spec=svn141&r=141

The change in gclient_scm.py is to address a presubmit check error
which was introduced by https://codereview.chromium.org/227163002
"print_func" parameter was being passed to a function instead of
the object constructor.

BUG=None
NOTRY=True

Change-Id: I4dca890d5f02957ddae33c4bd4269fd37758be3d

Review URL: https://codereview.chromium.org/777533005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293276 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
maruel@chromium.org ade9c5953d Fix case where wc_info is not present.
Reapply r80770 "Switch from xml.dom.minidom to xml.etree".

TBR=dpranke@chromium.org
BUG=
TEST=

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@80785 0039d316-1c4b-4281-b951-d872f2087c98
14 years ago
maruel@chromium.org d25fb8f68b Revert r80770 "Switch from xml.dom.minidom to xml.etree"
Throws exceptions on mac.

R=dpranke@chromium.org
BUG=
TEST=

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@80771 0039d316-1c4b-4281-b951-d872f2087c98
14 years ago
maruel@chromium.org 949d1a6a9e Switch from xml.dom.minidom to xml.etree
The reason of this change (beside deleting 30 lines) is to fix pylint on Mac.
For an unknown reason, it was dying here trying to process the minidom import.

R=dpranke@chromium.org
BUG=
TEST=

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@80770 0039d316-1c4b-4281-b951-d872f2087c98
14 years ago
maruel@chromium.org 725f1c3b69 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
14 years ago
maruel@chromium.org cfa826c984 Catch exception thrown on certain locale setup
Mostly happening on Mac. Will investigate later.

TBR=dpranke
BUG=
TEST=

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@79354 0039d316-1c4b-4281-b951-d872f2087c98
14 years ago
tony@chromium.org e155bcdd1d Fix an exception raised when trying to gclient sync on a Mac
with python 2.5.1.

Traceback (most recent call last):
  File "/Users/tc/depot_tools/gclient.py", line 1270, in <module>
    fix_encoding.fix_encoding()
  File "/Users/tc/depot_tools/fix_encoding.py", line 350, in fix_encoding
    ret &= fix_default_encoding()
  File "/Users/tc/depot_tools/fix_encoding.py", line 51, in
fix_default_encoding
    lang = locale.getlocale(aref)[0]
  File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/locale.py",
line 460, in getlocale
    return _parse_localename(localename)
  File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/locale.py",
line 373, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: C/UTF-8/C/C/C/C

R=dpranke@chromium.org,chase@chromium.org,bradnelson@google.com,maruel@chromium.org,evan@chromium.org,nsylvain@chromium.org,nsylvain@google.com
Review URL: http://codereview.chromium.org/6730008

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@79213 0039d316-1c4b-4281-b951-d872f2087c98
14 years ago
maruel@chromium.org 35625c7e56 Fix locale.getlocale() exception.
Reapply r79006 with fixes for ubuntu 10.4.

The only change is in fix_default_encoding() to trap an exception
locale.getlocale() may throw.

R=dpranke@chromium.org
BUG=none
TEST=unit test

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@79144 0039d316-1c4b-4281-b951-d872f2087c98
14 years ago
maruel@chromium.org f946b22f96 Revert r79006: "Add code to 'fix' python encoding and it's unit test."
It is causing exception for some users on ubuntu 10.4 with:
"category LC_ALL is not supported"

TBR=dpranke

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@79012 0039d316-1c4b-4281-b951-d872f2087c98
14 years ago
maruel@chromium.org 8e741d3bb1 Add code to 'fix' python encoding and it's unit test.
With this code in action, I can successfully print arabic and chinese on linux
and cygwin. It fails to print chinese on my Mac but prints arabic. It prints '?'
on Windows console but it *doesn't throw* which is the biggest improvement here.
It was particularly a problem on windows because WindowsError's description text
is in the current ANSI code page so it failed to print if the text was not pure
ASCII, like error message when using Windows' French UI.

R=dpranke@chromium.org
BUG=none
TEST=manual unit test ./tests/fix_encoding_test.py and it shouldn't throw

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@79006 0039d316-1c4b-4281-b951-d872f2087c98
14 years ago