mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 16:52:14 +02:00
buildman: Convert to Python 3
Convert buildman to Python 3 and make it use that, to meet the 2020 deadline. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -30,7 +30,7 @@ def GetActionSummary(is_summary, commits, selected, options):
|
||||
"""
|
||||
if commits:
|
||||
count = len(commits)
|
||||
count = (count + options.step - 1) / options.step
|
||||
count = (count + options.step - 1) // options.step
|
||||
commit_str = '%d commit%s' % (count, GetPlural(count))
|
||||
else:
|
||||
commit_str = 'current source'
|
||||
@@ -59,31 +59,31 @@ def ShowActions(series, why_selected, boards_selected, builder, options,
|
||||
board_warnings: List of warnings obtained from board selected
|
||||
"""
|
||||
col = terminal.Color()
|
||||
print 'Dry run, so not doing much. But I would do this:'
|
||||
print
|
||||
print('Dry run, so not doing much. But I would do this:')
|
||||
print()
|
||||
if series:
|
||||
commits = series.commits
|
||||
else:
|
||||
commits = None
|
||||
print GetActionSummary(False, commits, boards_selected,
|
||||
options)
|
||||
print 'Build directory: %s' % builder.base_dir
|
||||
print(GetActionSummary(False, commits, boards_selected,
|
||||
options))
|
||||
print('Build directory: %s' % builder.base_dir)
|
||||
if commits:
|
||||
for upto in range(0, len(series.commits), options.step):
|
||||
commit = series.commits[upto]
|
||||
print ' ', col.Color(col.YELLOW, commit.hash[:8], bright=False),
|
||||
print commit.subject
|
||||
print
|
||||
print(' ', col.Color(col.YELLOW, commit.hash[:8], bright=False), end=' ')
|
||||
print(commit.subject)
|
||||
print()
|
||||
for arg in why_selected:
|
||||
if arg != 'all':
|
||||
print arg, ': %d boards' % len(why_selected[arg])
|
||||
print(arg, ': %d boards' % len(why_selected[arg]))
|
||||
if options.verbose:
|
||||
print ' %s' % ' '.join(why_selected[arg])
|
||||
print ('Total boards to build for each commit: %d\n' %
|
||||
len(why_selected['all']))
|
||||
print(' %s' % ' '.join(why_selected[arg]))
|
||||
print(('Total boards to build for each commit: %d\n' %
|
||||
len(why_selected['all'])))
|
||||
if board_warnings:
|
||||
for warning in board_warnings:
|
||||
print col.Color(col.YELLOW, warning)
|
||||
print(col.Color(col.YELLOW, warning))
|
||||
|
||||
def CheckOutputDir(output_dir):
|
||||
"""Make sure that the output directory is not within the current directory
|
||||
@@ -146,17 +146,17 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
|
||||
if options.fetch_arch:
|
||||
if options.fetch_arch == 'list':
|
||||
sorted_list = toolchains.ListArchs()
|
||||
print col.Color(col.BLUE, 'Available architectures: %s\n' %
|
||||
' '.join(sorted_list))
|
||||
print(col.Color(col.BLUE, 'Available architectures: %s\n' %
|
||||
' '.join(sorted_list)))
|
||||
return 0
|
||||
else:
|
||||
fetch_arch = options.fetch_arch
|
||||
if fetch_arch == 'all':
|
||||
fetch_arch = ','.join(toolchains.ListArchs())
|
||||
print col.Color(col.CYAN, '\nDownloading toolchains: %s' %
|
||||
fetch_arch)
|
||||
print(col.Color(col.CYAN, '\nDownloading toolchains: %s' %
|
||||
fetch_arch))
|
||||
for arch in fetch_arch.split(','):
|
||||
print
|
||||
print()
|
||||
ret = toolchains.FetchAndInstall(arch)
|
||||
if ret:
|
||||
return ret
|
||||
@@ -167,7 +167,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
|
||||
toolchains.Scan(options.list_tool_chains and options.verbose)
|
||||
if options.list_tool_chains:
|
||||
toolchains.List()
|
||||
print
|
||||
print()
|
||||
return 0
|
||||
|
||||
# Work out how many commits to build. We want to build everything on the
|
||||
@@ -191,7 +191,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
|
||||
sys.exit(col.Color(col.RED, "Range '%s' has no commits" %
|
||||
options.branch))
|
||||
if msg:
|
||||
print col.Color(col.YELLOW, msg)
|
||||
print(col.Color(col.YELLOW, msg))
|
||||
count += 1 # Build upstream commit also
|
||||
|
||||
if not count:
|
||||
@@ -268,7 +268,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
|
||||
options.threads = min(multiprocessing.cpu_count(), len(selected))
|
||||
if not options.jobs:
|
||||
options.jobs = max(1, (multiprocessing.cpu_count() +
|
||||
len(selected) - 1) / len(selected))
|
||||
len(selected) - 1) // len(selected))
|
||||
|
||||
if not options.step:
|
||||
options.step = len(series.commits) - 1
|
||||
|
Reference in New Issue
Block a user