Merge "Shift stringslint to using python3." am: 785a55ff0c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1557450 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Id701d8418d8a31d0cd67870257befd84800eb3ea
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
#-*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright (C) 2018 The Android Open Source Project
|
# Copyright (C) 2018 The Android Open Source Project
|
||||||
#
|
#
|
||||||
@@ -33,9 +34,6 @@ In general:
|
|||||||
import re, sys, codecs
|
import re, sys, codecs
|
||||||
import lxml.etree as ET
|
import lxml.etree as ET
|
||||||
|
|
||||||
reload(sys)
|
|
||||||
sys.setdefaultencoding('utf8')
|
|
||||||
|
|
||||||
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
|
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
|
||||||
|
|
||||||
def format(fg=None, bg=None, bright=False, bold=False, dim=False, reset=False):
|
def format(fg=None, bg=None, bright=False, bold=False, dim=False, reset=False):
|
||||||
@@ -118,7 +116,7 @@ def lint(path):
|
|||||||
raw = f.read()
|
raw = f.read()
|
||||||
if len(raw.strip()) == 0:
|
if len(raw.strip()) == 0:
|
||||||
return warnings
|
return warnings
|
||||||
tree = ET.fromstring(raw)
|
tree = ET.fromstring(bytes(raw, encoding='utf-8'))
|
||||||
root = tree #tree.getroot()
|
root = tree #tree.getroot()
|
||||||
|
|
||||||
last_comment = None
|
last_comment = None
|
||||||
@@ -231,6 +229,6 @@ for b in before:
|
|||||||
|
|
||||||
if len(after) > 0:
|
if len(after) > 0:
|
||||||
for a in sorted(after.keys()):
|
for a in sorted(after.keys()):
|
||||||
print after[a]
|
print(after[a])
|
||||||
print
|
print()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
LOCAL_DIR="$( dirname ${BASH_SOURCE} )"
|
LOCAL_DIR="$( dirname ${BASH_SOURCE} )"
|
||||||
git show --name-only --pretty=format: $1 | grep values/strings.xml | while read file; do
|
git show --name-only --pretty=format: $1 | grep values/strings.xml | while read file; do
|
||||||
python $LOCAL_DIR/stringslint.py <(git show $1:$file) <(git show $1^:$file)
|
python3 $LOCAL_DIR/stringslint.py <(git show $1:$file) <(git show $1^:$file)
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user