Mercurial > treepkg > treepkg
diff treepkg/packager.py @ 372:ef87d30468b6
Added the option to expose additional log files from the log directory.
To enable this one can either set a build_logs value in the staticweb.cfg
or call createstaticweb with the parameter --show-logs. Default behavior is
to only publish the build log, although the title is now capitalized.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 21 Jun 2010 08:23:30 +0000 |
parents | 0bee91b435ab |
children | 41226e427823 |
line wrap: on
line diff
--- a/treepkg/packager.py Tue Jun 15 10:56:44 2010 +0000 +++ b/treepkg/packager.py Mon Jun 21 08:23:30 2010 +0000 @@ -308,20 +308,39 @@ def has_build_log(self): return os.path.exists(self.get_log_file()) + def get_log_title(self, f): + if not os.path.isfile(f): + return None + title = os.path.basename(f) + title = title.replace("_"," ") + title = title[:title.find(".")] + title = title.title() + return title + def get_log_file(self): if os.path.exists(self.build_log + ".gz"): return self.build_log + ".gz" return self.build_log - def list_log_files(self): + def get_log_files(self, logs): + files = [] + for f in os.listdir(self.log_dir): + if f in logs: + f = os.path.join(self.log_dir,f) + if os.path.isfile(f): + files.append((self.get_log_title(f),f)) + return files + + def list_log_files(self, logs): """Returns a list describing the logfiles available for the revision. Each list item is a tuple of the form (TITLE, FILENAME) where - TITLE is a string with a title usable in e. g. a web-page, and + TITLE is a string with the filename without directory or ending in + which _ is replaced with a whitespace and words are capitalized. FILENAME is the absolute filename of the log file. """ - files = [] - if self.has_build_log(): - files.append(("build log", self.get_log_file())) + files = self.get_log_files(logs) + if not files: + return [] return files def list_source_files(self):