Be py3-ready

This commit is contained in:
Denis Silakov 2018-10-23 13:21:28 +03:00
parent 8bba856e1e
commit f76477b3fd
2 changed files with 8 additions and 7 deletions

View file

@ -76,7 +76,7 @@ class Section(dict):
return super(Section, self).__getitem__(key)
try:
res = self.config.get(self.section, key)
except ConfigParser.NoOptionError, ex:
except ConfigParser.NoOptionError as ex:
if key in ['default_branch', 'default_publish_status']:
print(_('non-critical error in config "%(path)s": %(exception)s') % {'path': self.conf_path, 'exception': str(ex)})
return ''
@ -177,6 +177,7 @@ class Config(dict):
parts = self['main']['abf_url'].split('//')
git_uri = "%(protocol)s//%(user)s@%(domain)s" % \
dict(protocol=parts[0], user=self['user']['login'], domain=parts[1])
# git_uri = "ssh://git@github.com/OpenMandrivaAssociation"
self['user']['git_uri'] = git_uri

View file

@ -228,9 +228,9 @@ def find_spec_problems(exit_on_error=True, strict=False, auto_remove=False):
with open(yaml_path, 'r') as fd:
try:
yaml_data = yaml.load(fd)
except yaml.scanner.ScannerError, ex:
except yaml.scanner.ScannerError as ex:
log.error(_('Invalid yml file %(file)s!\nProblem in line %(line)d column %(col)d: %(exception)s') % {'file': yaml_path, 'line': ex.problem_mark.line, 'col': ex.problem_mark.column, 'exception': ex.problem})
except yaml.composer.ComposerError, ex:
except yaml.composer.ComposerError as ex:
log.error(_('Invalid yml file %(file)s!\n%(exception)s') % {'file': yaml_path, 'exception': ex})
if not 'sources' in yaml_data:
@ -328,7 +328,7 @@ def pack_project(root_path):
cmd = ['tar', 'czf', full_tarball_path, '--exclude-vcs', os.path.basename(root_path)]
try:
execute_command(cmd, cwd=os.path.dirname(root_path), exit_on_error=False)
except ReturnCodeNotZero, ex:
except ReturnCodeNotZero as ex:
if ex.code != 1:
raise
@ -369,7 +369,7 @@ def execute_command(command, shell=False, cwd=None, timeout=0, raiseExc=True, pr
# use select() to poll for output so we dont block
output = logOutput([child.stdout, child.stderr],
start, timeout, print_to_stdout=print_to_stdout)
except Exception, ex:
except Exception as ex:
# kill children if they arent done
if type(ex) == IOError and ex.errno==4:
print(_('Process execution has been terminated'))
@ -479,7 +479,7 @@ def fetch_files(models, yaml_path, file_names=None):
log.info(_('The file %s already presents but its hash is not the same as in .abf.yml, so it will be rewritten.') % file_name)
try:
models.jsn.fetch_file(to_fetch[file_name], path)
except AbfApiException, ex:
except AbfApiException as ex:
print(_('error: ') + str(ex))
def upload_files(models, min_size, path=None, remove_files=True, upload_all=False):
@ -515,7 +515,7 @@ def upload_files(models, min_size, path=None, remove_files=True, upload_all=Fals
else:
try:
sources = get_project_data(spec_path)['sources']
except Exception, ex:
except Exception as ex:
log.error(ex)
return 1
for src, num in sources: