[SCM] watchdog branch, master, updated. 8aec1207a57a598a3dad9e139bd64c7c1e48b735

1 view
Skip to first unread message

aaronsw

unread,
Aug 13, 2009, 11:39:17 PM8/13/09
to watchdo...@googlegroups.com
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "watchdog".

The branch, master has been updated
via 8aec1207a57a598a3dad9e139bd64c7c1e48b735 (commit)
from d443c6ded5fe8b7df07ea1a892a07a748579a88d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8aec1207a57a598a3dad9e139bd64c7c1e48b735
Author: Aaron Swartz <m...@aaronsw.com>
Date: Thu Aug 13 23:39:02 2009 -0400

sort indexes, allow creation based on offsets

-----------------------------------------------------------------------

Summary of changes:
utils/index.py | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/utils/index.py b/utils/index.py
index c9aac4c..1781931 100644
--- a/utils/index.py
+++ b/utils/index.py
@@ -121,9 +121,17 @@ def write_sitemap(i, seq, index_dir):
os.mkdir(dir)
write(filename, str(make_sitemap(filename, seq)))

-def write_sitemaps(data, index_dir):
+def write_sitemaps(data, index_dir, offset=0):
for i, x in enumerate(group(data, pagesize)):
- write_sitemap(i, x, index_dir)
+ write_sitemap(i+offset, x, index_dir)
+
+def update_indexes(index_dir):
+ dirs = [d for d in os.listdir(index_dir) if os.path.isdir(os.path.join(index_dir, d))]
+ write(index_dir + '/index.html', str(make_index(index_dir, sorted(d+'/index.html' for d in dirs))))
+
+ for d in dirs:
+ d = os.path.join(index_dir, d)
+ write(d + '/index.html', str(make_index('index %s' % (d), sorted(os.listdir(d)))))

def create_index(index_dir, _test=False):
if not os.path.exists(index_dir):
@@ -131,13 +139,7 @@ def create_index(index_dir, _test=False):

data = getindex(webapp.app, _test)
write_sitemaps(data, index_dir)
-
- dirs = [d for d in os.listdir(index_dir) if os.path.isdir(os.path.join(index_dir, d))]
- write(index_dir + '/index.html', str(make_index(index_dir, [d+'/index.html' for d in dirs])))
+ update_indexes(index_dir)

- for d in dirs:
- d = os.path.join(index_dir, d)
- write(d + '/index.html', str(make_index('index %s' % (d), os.listdir(d))))
-
if __name__ == "__main__":
create_index('static/index', _test=False)


hooks/post-receive
--
watchdog

Reply all
Reply to author
Forward
0 new messages