Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
TEMPLATESDIR = "@templatesdir@"
STATICDIR = "@staticdir@"
-FILE_EXTENSIONS_VIEWABLE = (
- ".c",
- ".cc",
- ".cfg",
- ".conf",
- ".config",
- ".cpp",
- ".diff",
- ".h",
- ".nm",
- ".patch",
- ".patch0",
- ".patch1",
- ".patch2",
- ".patch3",
- ".patch4",
- ".patch5",
- ".patch6",
- ".patch7",
- ".patch8",
- ".patch9",
- ".pl",
- ".pm",
- ".py",
- ".S",
- ".s",
- ".sh",
- ".txt",
- "Kconfig",
- "Makefile",
-)
-
# Bug update messages.
BUG_TESTING_MSG = """\
%(package_name)s has been pushed to the %(distro_name)s %(repo_name)s repository.
# All regular files are downloadable
return self.type == stat.S_IFREG
- # Viewable?
-
- def is_viewable(self):
- # Empty files cannot be viewed.
- if self.size == 0:
- return False
-
- # Files that are of type text/* are viewable
- if self.mimetype and self.mimetype.startswith("text/"):
- return True
-
- for ext in FILE_EXTENSIONS_VIEWABLE:
- if self.path.endswith(ext):
- return True
-
- return False
-
# Send Payload
async def open(self):