Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: native_client_sdk/src/tools/oshelpers.py

Issue 10868089: add PRESUBMIT for native_client_sdk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « native_client_sdk/src/tools/getos.py ('k') | native_client_sdk/src/tools/zip_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/tools/oshelpers.py
diff --git a/native_client_sdk/src/tools/oshelpers.py b/native_client_sdk/src/tools/oshelpers.py
index fb2f3eb65b2481fa6e9832646a30095374c584a1..253afa7fe9689d4da630df2d81208a3fd68f21ea 100755
--- a/native_client_sdk/src/tools/oshelpers.py
+++ b/native_client_sdk/src/tools/oshelpers.py
@@ -22,8 +22,8 @@ def IncludeFiles(filters, files):
if not filters:
return files
match = set()
- for filter in filters:
- match |= set(fnmatch.filter(files, filter))
+ for file_filter in filters:
+ match |= set(fnmatch.filter(files, file_filter))
return [name for name in files if name in match]
@@ -35,8 +35,8 @@ def ExcludeFiles(filters, files):
if not filters:
return files
match = set()
- for filter in filters:
- excludes = set(fnmatch.filter(files, filter))
+ for file_filter in filters:
+ excludes = set(fnmatch.filter(files, file_filter))
match |= excludes
return [name for name in files if name not in match]
@@ -163,7 +163,7 @@ def Mkdir(args):
print 'mkdir ' + dst
try:
os.makedirs(dst)
- except OSError as error:
+ except OSError:
if os.path.isdir(dst):
if options.parents:
continue
@@ -192,7 +192,7 @@ def MovePath(options, src, dst):
raise OSError('mv: FAILED TO REMOVE ' + dst)
else:
raise OSError('mv: already exists ' + dst)
- for i in range(5):
+ for _ in range(5):
try:
os.rename(src, dst)
return
@@ -216,12 +216,13 @@ def Move(args):
options, files = parser.parse_args(args)
if len(files) < 2:
parser.error('ERROR: expecting SOURCE... and DEST.')
- if options.verbose:
- print 'mv %s %s' % (src, dst)
srcs = files[:-1]
dst = files[-1]
+ if options.verbose:
+ print 'mv %s %s' % (' '.join(srcs), dst)
+
for src in srcs:
MovePath(options, src, dst)
return 0
@@ -366,10 +367,10 @@ def Zip(args):
src_files.append(src_file)
if options.recursive and os.path.isdir(src_file):
for root, dirs, files in os.walk(src_file):
- for dir in dirs:
- src_files.append(os.path.join(root, dir))
- for file in files:
- src_files.append(os.path.join(root, file))
+ for dirname in dirs:
+ src_files.append(os.path.join(root, dirname))
+ for filename in files:
+ src_files.append(os.path.join(root, filename))
zip_stream = None
# zip_data represents a list of the data to be written or appended to the
« no previous file with comments | « native_client_sdk/src/tools/getos.py ('k') | native_client_sdk/src/tools/zip_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698