mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-30 19:11:37 +00:00
patman: Rename variables in patchstream
Some variables are too short or shadow other variables or types. Fix these to keep pylint3 happy. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
d93720e138
commit
dd147eda10
1 changed files with 26 additions and 26 deletions
|
@ -149,7 +149,7 @@ class PatchStream:
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return int(value)
|
return int(value)
|
||||||
except ValueError as str:
|
except ValueError:
|
||||||
raise ValueError("%s: Cannot decode version info '%s'" %
|
raise ValueError("%s: Cannot decode version info '%s'" %
|
||||||
(self.commit.hash, line))
|
(self.commit.hash, line))
|
||||||
|
|
||||||
|
@ -385,10 +385,10 @@ class PatchStream:
|
||||||
# Well that means this is an ordinary line
|
# Well that means this is an ordinary line
|
||||||
else:
|
else:
|
||||||
# Look for space before tab
|
# Look for space before tab
|
||||||
m = RE_SPACE_BEFORE_TAB.match(line)
|
mat = RE_SPACE_BEFORE_TAB.match(line)
|
||||||
if m:
|
if mat:
|
||||||
self.warn.append('Line %d/%d has space before tab' %
|
self.warn.append('Line %d/%d has space before tab' %
|
||||||
(self.linenum, m.start()))
|
(self.linenum, mat.start()))
|
||||||
|
|
||||||
# OK, we have a valid non-blank line
|
# OK, we have a valid non-blank line
|
||||||
out = [line]
|
out = [line]
|
||||||
|
@ -527,10 +527,10 @@ def get_metadata_for_list(commit_range, git_dir=None, count=None,
|
||||||
params = gitutil.LogCmd(commit_range, reverse=True, count=count,
|
params = gitutil.LogCmd(commit_range, reverse=True, count=count,
|
||||||
git_dir=git_dir)
|
git_dir=git_dir)
|
||||||
stdout = command.RunPipe([params], capture=True).stdout
|
stdout = command.RunPipe([params], capture=True).stdout
|
||||||
ps = PatchStream(series, is_log=True)
|
pst = PatchStream(series, is_log=True)
|
||||||
for line in stdout.splitlines():
|
for line in stdout.splitlines():
|
||||||
ps.process_line(line)
|
pst.process_line(line)
|
||||||
ps.finalise()
|
pst.finalise()
|
||||||
return series
|
return series
|
||||||
|
|
||||||
def get_metadata(branch, start, count):
|
def get_metadata(branch, start, count):
|
||||||
|
@ -554,13 +554,13 @@ def get_metadata_for_test(text):
|
||||||
text:
|
text:
|
||||||
"""
|
"""
|
||||||
series = Series()
|
series = Series()
|
||||||
ps = PatchStream(series, is_log=True)
|
pst = PatchStream(series, is_log=True)
|
||||||
for line in text.splitlines():
|
for line in text.splitlines():
|
||||||
ps.process_line(line)
|
pst.process_line(line)
|
||||||
ps.finalise()
|
pst.finalise()
|
||||||
return series
|
return series
|
||||||
|
|
||||||
def fix_patch(backup_dir, fname, series, commit):
|
def fix_patch(backup_dir, fname, series, cmt):
|
||||||
"""Fix up a patch file, by adding/removing as required.
|
"""Fix up a patch file, by adding/removing as required.
|
||||||
|
|
||||||
We remove our tags from the patch file, insert changes lists, etc.
|
We remove our tags from the patch file, insert changes lists, etc.
|
||||||
|
@ -571,16 +571,16 @@ def fix_patch(backup_dir, fname, series, commit):
|
||||||
Args:
|
Args:
|
||||||
fname: Filename to patch file to process
|
fname: Filename to patch file to process
|
||||||
series: Series information about this patch set
|
series: Series information about this patch set
|
||||||
commit: Commit object for this patch file
|
cmt: Commit object for this patch file
|
||||||
Return:
|
Return:
|
||||||
A list of errors, or [] if all ok.
|
A list of errors, or [] if all ok.
|
||||||
"""
|
"""
|
||||||
handle, tmpname = tempfile.mkstemp()
|
handle, tmpname = tempfile.mkstemp()
|
||||||
outfd = os.fdopen(handle, 'w', encoding='utf-8')
|
outfd = os.fdopen(handle, 'w', encoding='utf-8')
|
||||||
infd = open(fname, 'r', encoding='utf-8')
|
infd = open(fname, 'r', encoding='utf-8')
|
||||||
ps = PatchStream(series)
|
pst = PatchStream(series)
|
||||||
ps.commit = commit
|
pst.commit = cmt
|
||||||
ps.process_stream(infd, outfd)
|
pst.process_stream(infd, outfd)
|
||||||
infd.close()
|
infd.close()
|
||||||
outfd.close()
|
outfd.close()
|
||||||
|
|
||||||
|
@ -588,7 +588,7 @@ def fix_patch(backup_dir, fname, series, commit):
|
||||||
if backup_dir:
|
if backup_dir:
|
||||||
shutil.copy(fname, os.path.join(backup_dir, os.path.basename(fname)))
|
shutil.copy(fname, os.path.join(backup_dir, os.path.basename(fname)))
|
||||||
shutil.move(tmpname, fname)
|
shutil.move(tmpname, fname)
|
||||||
return ps.warn
|
return pst.warn
|
||||||
|
|
||||||
def fix_patches(series, fnames):
|
def fix_patches(series, fnames):
|
||||||
"""Fix up a list of patches identified by filenames
|
"""Fix up a list of patches identified by filenames
|
||||||
|
@ -603,10 +603,10 @@ def fix_patches(series, fnames):
|
||||||
backup_dir = None #tempfile.mkdtemp('clean-patch')
|
backup_dir = None #tempfile.mkdtemp('clean-patch')
|
||||||
count = 0
|
count = 0
|
||||||
for fname in fnames:
|
for fname in fnames:
|
||||||
commit = series.commits[count]
|
cmt = series.commits[count]
|
||||||
commit.patch = fname
|
cmt.patch = fname
|
||||||
commit.count = count
|
cmt.count = count
|
||||||
result = fix_patch(backup_dir, fname, series, commit)
|
result = fix_patch(backup_dir, fname, series, cmt)
|
||||||
if result:
|
if result:
|
||||||
print('%d warnings for %s:' % (len(result), fname))
|
print('%d warnings for %s:' % (len(result), fname))
|
||||||
for warn in result:
|
for warn in result:
|
||||||
|
@ -623,11 +623,11 @@ def insert_cover_letter(fname, series, count):
|
||||||
series: Series object
|
series: Series object
|
||||||
count: Number of patches in the series
|
count: Number of patches in the series
|
||||||
"""
|
"""
|
||||||
fd = open(fname, 'r')
|
fil = open(fname, 'r')
|
||||||
lines = fd.readlines()
|
lines = fil.readlines()
|
||||||
fd.close()
|
fil.close()
|
||||||
|
|
||||||
fd = open(fname, 'w')
|
fil = open(fname, 'w')
|
||||||
text = series.cover
|
text = series.cover
|
||||||
prefix = series.GetPatchPrefix()
|
prefix = series.GetPatchPrefix()
|
||||||
for line in lines:
|
for line in lines:
|
||||||
|
@ -647,5 +647,5 @@ def insert_cover_letter(fname, series, count):
|
||||||
# Now the change list
|
# Now the change list
|
||||||
out = series.MakeChangeLog(None)
|
out = series.MakeChangeLog(None)
|
||||||
line += '\n' + '\n'.join(out)
|
line += '\n' + '\n'.join(out)
|
||||||
fd.write(line)
|
fil.write(line)
|
||||||
fd.close()
|
fil.close()
|
||||||
|
|
Loading…
Add table
Reference in a new issue