More py3-ready fixes

This commit is contained in:
Denis Silakov 2018-10-23 14:54:55 +03:00
parent f19f3697b2
commit 6103bff8e1

20
abf.py
View file

@ -472,7 +472,7 @@ def run_mock_urpm(binary=True):
config_opts['plugin_conf'] = {'ccache_opts': {}, 'root_cache_opts': {}, 'bind_mount_opts': {'dirs': []}, 'tmpfs_opts': {}, 'selinux_opts': {}}
try:
execfile(config_path)
except Exception, ex:
except Exception as ex:
log.error(_("Could not read the contents of '%(path)s': %(exception)s") % {'path': config_path, 'exception': str(ex)})
exit(2)
@ -502,7 +502,7 @@ def run_mock_urpm(binary=True):
log.info(_('Executing mock-urpm...'))
try:
res = execute_command(cmd, print_to_stdout=True, exit_on_error=False, shell=False)
except OSError, ex:
except OSError as ex:
log.error(_("Can not execute mock-urpm (%s). Maybe it is not installed?") % str(ex))
exit(1)
finally:
@ -542,7 +542,7 @@ def localbuild_mock_urpm():
try:
run_mock_urpm(binary=True)
except OSError, ex:
except OSError as ex:
log.error(str(ex))
exit(1)
@ -610,7 +610,7 @@ def localbuild_rpmbuild():
log.info(_('Executing rpmbuild...'))
try:
res = execute_command(cmd, print_to_stdout=True, exit_on_error=False, shell=False)
except OSError, ex:
except OSError as ex:
log.error(_("Can not execute rpmbuild (%s). Maybe it is not installed?") % str(ex))
exit(1)
except ReturnCodeNotZero:
@ -815,7 +815,7 @@ def put():
try:
min_size = human2bytes(command_line.minimal_file_size)
except ValueError, ex:
except ValueError as ex:
log.error(_('Incorrect "--minimal-file-size" value: %s') % command_line.minimal_file_size)
exit(1)
error_count = upload_files(models, min_size, remove_files=not command_line.do_not_remove_files, path=path, upload_all=command_line.upload_all)
@ -867,9 +867,9 @@ def fetch():
exit(1)
try:
fetch_files(models, path, command_line.only)
except yaml.scanner.ScannerError, ex:
except yaml.scanner.ScannerError as ex:
log.error(_('Invalid yml file %(filename)s!\nProblem in line %(line)d column %(column)d: %(problem)s') % {'filename': path, 'line': ex.problem_mark.line, 'column': ex.problem_mark.column, 'problem': ex.problem})
except yaml.composer.ComposerError, ex:
except yaml.composer.ComposerError as ex:
log.error(_('Invalid yml file %(filename)s!\n%(exception)s') % {'filename': path, 'exception': ex})
def remote():
@ -945,7 +945,7 @@ def copy():
pack_project(path)
cmd = ['git', 'reset']
execute_command(cmd, print_to_stdout=True, cwd=path)
except Exception, ex:
except Exception as ex:
if type(ex) == ReturnCodeNotZero:
log.error(str(ex))
else:
@ -1463,14 +1463,14 @@ def publish():
log.error(_("The status of build task %(id)s is \"%(status)s\", can not published!") % {'id': bl.id, 'status': bl.status_string})
continue
res = bl.publish()
except AbfApiException, ex:
except AbfApiException as ex:
log.error(_('Could not publish task %(id)s: %(exception)s') % {'id': task_id, 'exception': str(ex)})
def _print_build_status(models, ID):
try:
bl = BuildList(models, ID)
except AbfApiException, ex:
except AbfApiException as ex:
log.error(_("Can not read buildlist %(id)s: %(exception)s") % {'id': ID, 'exception': ex})
exit(3)
if command_line.short: