[cig-commits] r15843 - doc/geodynamics.org/benchmarks/trunk
luis at geodynamics.org
luis at geodynamics.org
Mon Oct 19 12:34:08 PDT 2009
Author: luis
Date: 2009-10-19 12:34:07 -0700 (Mon, 19 Oct 2009)
New Revision: 15843
Added:
doc/geodynamics.org/benchmarks/trunk/download.py
Log:
Added download.py script.
This script assumes we have mounted
http://geodynamics.org:1980/cig/
as the local WebDAV folder /Volumes/cig/
Added: doc/geodynamics.org/benchmarks/trunk/download.py
===================================================================
--- doc/geodynamics.org/benchmarks/trunk/download.py (rev 0)
+++ doc/geodynamics.org/benchmarks/trunk/download.py 2009-10-19 19:34:07 UTC (rev 15843)
@@ -0,0 +1,53 @@
+#!/usr/bin/env python2.6
+
+"""
+download.py - Download the source pages from geodynamics.org website.
+
+This script copies the files listed in "sources.txt" from a mounted
+WebDAV folder, into the _latest directory.
+"""
+
+import os, shutil
+
+def main():
+
+ from common import (
+ webdav_benchroot,
+ readlines, writefile,
+ sitename, latestname, headername,
+ split_content,
+ )
+
+ for line in readlines("sources.txt"):
+ filename = line.strip()
+ site_page = sitename(filename, prefix=webdav_benchroot)
+
+ latest_filename = latestname(filename)
+ latest_header_filename = headername(latest_filename)
+ tmp_filename = latest_filename + '.orig'
+
+ print "Downloading %s" % site_page
+ shutil.copyfile(site_page, tmp_filename)
+ header, content = split_content(tmp_filename)
+
+ print "...writing %s" % latest_header_filename
+ writefile(latest_header_filename, header)
+
+ # XXX: For now, always copy latest_header_filename into current header.
+ # This effectively means our local copy of the header file is always
+ # overwritten by the site copy. The implication is that all edits to
+ # the page metadata will need to be done at the website. Do we even
+ # want to do this locally? Presumably the timestamp information would
+ # change...
+ shutil.copyfile(latest_header_filename, headername(filename))
+
+ print "...writing %s" % latest_filename
+ writefile(latest_filename, content.replace('\r', ''))
+
+ return
+
+
+if __name__ == "__main__":
+ main()
+
+
Property changes on: doc/geodynamics.org/benchmarks/trunk/download.py
___________________________________________________________________
Name: svn:executable
+ *
More information about the CIG-COMMITS
mailing list