flake8 fixes

This commit is contained in:
Tomas Kopecek 2021-02-16 14:43:49 +01:00
parent 556f8a1fcd
commit 13f4023bf5
3 changed files with 7 additions and 5 deletions

View file

@ -61,6 +61,7 @@ class fakemodule(object):
koji = fakemodule()
koji.GenericError = GenericError # noqa: F821
koji.BuildError = BuildError # noqa: F821
koji._open_text_file = _open_text_file # noqa: F821
def encode_int(n):
@ -331,7 +332,7 @@ class WindowsBuild(object):
raise BuildError('Unknown checksum type %s for %s' % ( # noqa: F821
checksum_type,
os.path.basename(fileinfo['localpath'])))
with _open_text_file(destpath, 'wt') as destfile:
with koji._open_text_file(destpath, 'wt') as destfile:
offset = 0
while True:
encoded = self.server.getFile(buildinfo, fileinfo, encode_int(offset), 1048576,
@ -412,7 +413,7 @@ class WindowsBuild(object):
"""Do the build: run the execute line(s) with cmd.exe"""
tmpfd, tmpname = tempfile.mkstemp(prefix='koji-tmp', suffix='.bat',
dir='/cygdrive/c/Windows/Temp')
script = _open_text_file(tmpfd, 'wt')
script = koji._open_text_file(tmpfd, 'wt')
for attr in ['source_dir', 'spec_dir', 'patches_dir']:
val = getattr(self, attr)
if val:
@ -449,7 +450,7 @@ class WindowsBuild(object):
def bashBuild(self):
"""Do the build: run the execute line(s) with bash"""
tmpfd, tmpname = tempfile.mkstemp(prefix='koji-tmp.', dir='/tmp')
script = _open_text_file(tmpfd, 'wt')
script = koji._open_text_file(tmpfd, 'wt')
script.write("export source_dir='%s'\n" % self.source_dir)
script.write("export spec_dir='%s'\n" % self.spec_dir)
if self.patches_dir:
@ -657,7 +658,7 @@ def setup_logging(opts):
if opts.debug:
level = logging.DEBUG
logger.setLevel(level)
logfd = _open_text_file(logfile, 'wt')
logfd = koji._open_text_file(logfile, 'wt')
handler = logging.StreamHandler(logfd)
handler.setLevel(level)
handler.setFormatter(logging.Formatter('%(asctime)s [%(levelname)s] %(name)s: %(message)s'))