From 13f4023bf5244a58bdd1bc07b6d5b29cfa5fd0cd Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Tue, 16 Feb 2021 14:43:49 +0100 Subject: [PATCH] flake8 fixes --- koji/__init__.py | 2 +- vm/kojikamid.py | 9 +++++---- www/kojiweb/index.py | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/koji/__init__.py b/koji/__init__.py index d2bbbe86..85b9998a 100644 --- a/koji/__init__.py +++ b/koji/__init__.py @@ -49,7 +49,6 @@ import warnings import weakref import xml.sax import xml.sax.handler -from contextlib import contextmanager from fnmatch import fnmatch import dateutil.parser @@ -1276,6 +1275,7 @@ def _open_text_file(path, mode='rt'): return open(path, mode, encoding='utf-8') # END kojikamid dup $ + ENTITY_RE = re.compile(r'&[A-Za-z0-9]+;') diff --git a/vm/kojikamid.py b/vm/kojikamid.py index caf604d0..4460e355 100755 --- a/vm/kojikamid.py +++ b/vm/kojikamid.py @@ -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')) diff --git a/www/kojiweb/index.py b/www/kojiweb/index.py index a74acaf4..75f66512 100644 --- a/www/kojiweb/index.py +++ b/www/kojiweb/index.py @@ -1461,6 +1461,7 @@ def userinfo(environ, userID, packageOrder='package_name', packageStart=None, # headers shown in rpminfo and buildinfo pages RPM_HEADERS = ['summary', 'description', 'license', 'disturl', 'vcs'] + def rpminfo(environ, rpmID, fileOrder='name', fileStart=None, buildrootOrder='-id', buildrootStart=None): values = _initValues(environ, 'RPM Info', 'builds')