backport py27 compatible file open with encoding
client and builder needs to run on py27 which doesn't support open(encoding='utf-8') Related: https://pagure.io/koji/issue/2641
This commit is contained in:
parent
9e376a22b0
commit
c6e69b4f8b
10 changed files with 62 additions and 59 deletions
|
|
@ -1035,7 +1035,7 @@ def anon_handle_mock_config(goptions, session, args):
|
|||
opts['tag_macros'][macro] = buildcfg['extra'][key]
|
||||
output = koji.genMockConfig(name, arch, **opts)
|
||||
if options.ofile:
|
||||
with open(options.ofile, 'wt', encoding='utf-8') as fo:
|
||||
with open(options.ofile, 'wt') as fo:
|
||||
fo.write(output)
|
||||
else:
|
||||
print(output)
|
||||
|
|
@ -1586,10 +1586,10 @@ def handle_prune_signed_copies(goptions, session, args):
|
|||
# (with the modification that we check to see if the build was latest within
|
||||
# the last N days)
|
||||
if options.ignore_tag_file:
|
||||
with open(options.ignore_tag_file, encoding='utf-8') as fo:
|
||||
with open(options.ignore_tag_file) as fo:
|
||||
options.ignore_tag.extend([line.strip() for line in fo.readlines()])
|
||||
if options.protect_tag_file:
|
||||
with open(options.protect_tag_file, encoding='utf-8') as fo:
|
||||
with open(options.protect_tag_file) as fo:
|
||||
options.protect_tag.extend([line.strip() for line in fo.readlines()])
|
||||
if options.debug:
|
||||
options.verbose = True
|
||||
|
|
@ -6890,7 +6890,7 @@ def anon_handle_download_logs(options, session, args):
|
|||
full_filename = os.path.normpath(os.path.join(task_log_dir, FAIL_LOG))
|
||||
koji.ensuredir(os.path.dirname(full_filename))
|
||||
sys.stdout.write("Writing: %s\n" % full_filename)
|
||||
with open(full_filename, 'wt', encoding='utf-8') as fo:
|
||||
with open(full_filename, 'wt') as fo:
|
||||
fo.write(content)
|
||||
|
||||
def download_log(task_log_dir, task_id, filename, blocksize=102400, volume=None):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue