diff options
author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-07-27 15:06:06 +0200 |
---|---|---|
committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-07-27 15:06:06 +0200 |
commit | 20a1566dd868ed1706b5257a8b2f1ea09f835ee0 (patch) | |
tree | afd750e5822e2ed0b7187d2ab01bd482a7e52331 | |
parent | d0be4ae7ad038359780e4a6e0d6a95d3d89ca55d (diff) | |
download | lasso-20a1566dd868ed1706b5257a8b2f1ea09f835ee0.tar.gz lasso-20a1566dd868ed1706b5257a8b2f1ea09f835ee0.tar.xz lasso-20a1566dd868ed1706b5257a8b2f1ea09f835ee0.zip |
[Website] import convert-to-static.py modification from lupin
-rw-r--r-- | website/convert-to-static.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/website/convert-to-static.py b/website/convert-to-static.py index c6e4b4a3..83e61d93 100644 --- a/website/convert-to-static.py +++ b/website/convert-to-static.py @@ -113,11 +113,16 @@ class Build: if self.changelog: self.changelog = self.changelog.replace('.xml', '') - dom_cl = xml.dom.minidom.parse(file('web' + self.changelog + '.xml')) - self.last_commit_author = getText(dom_cl.getElementsByTagName('author')[-1].childNodes) - self.nb_commits = len(dom_cl.getElementsByTagName('entry')) - if not self.nb_commits: - self.nb_commits = len(dom_cl.getElementsByTagName('logentry')) + try: + dom_cl = xml.dom.minidom.parse(file('web' + self.changelog + '.xml')) + except: + self.nb_commits = '?' + self.last_commit_author = '?' + else: + self.last_commit_author = getText(dom_cl.getElementsByTagName('author')[-1].childNodes) + self.nb_commits = len(dom_cl.getElementsByTagName('entry')) + if not self.nb_commits: + self.nb_commits = len(dom_cl.getElementsByTagName('logentry')) @@ -205,7 +210,7 @@ for BUILDLOGS_DIR in ('build-logs', 'build-logs-wsf'): day_dirs = os.listdir('web/%s/' % BUILDLOGS_DIR) day_dirs.sort() day_dirs.reverse() - day_dirs = day_dirs[:20] + day_dirs = day_dirs[:60] main_page = [] @@ -217,7 +222,7 @@ for BUILDLOGS_DIR in ('build-logs', 'build-logs-wsf'): main_page.sort() main_page.reverse() - main_page = main_page[:20] + main_page = main_page[:50] builds = [] for filename in main_page: builds.append( Build(xml.dom.minidom.parse(filename)) ) @@ -255,6 +260,8 @@ for base, dirs, files in os.walk('web'): src_file = os.path.join(base, filename) dst_file = 'web-static/' + src_file[4:] + if os.path.isdir(src_file): continue + if os.path.exists(dst_file) and \ os.stat(dst_file)[stat.ST_MTIME] >= os.stat(src_file)[stat.ST_MTIME]: continue |