[cig-commits] r12363 - in cs/portal/trunk/northridge: . SeismoWebPortal SeismoWebPortal/templates/SeismoWebPortal
leif at geodynamics.org
leif at geodynamics.org
Tue Jul 1 12:47:37 PDT 2008
Author: leif
Date: 2008-07-01 12:47:37 -0700 (Tue, 01 Jul 2008)
New Revision: 12363
Added:
cs/portal/trunk/northridge/MANIFEST.in
cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_list.py.tmpl
cs/portal/trunk/northridge/debug-setup.sh
Removed:
cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_list.py
cs/portal/trunk/northridge/ez_setup.py
cs/portal/trunk/northridge/runserver.sh
Modified:
cs/portal/trunk/northridge/SeismoWebPortal/urls.py
cs/portal/trunk/northridge/setup.py
Log:
Wrote working 'setup.py' script. Added shell script which documents
how to debug the portal.
Added: cs/portal/trunk/northridge/MANIFEST.in
===================================================================
--- cs/portal/trunk/northridge/MANIFEST.in (rev 0)
+++ cs/portal/trunk/northridge/MANIFEST.in 2008-07-01 19:47:37 UTC (rev 12363)
@@ -0,0 +1,23 @@
+include MANIFEST.in
+include debug-setup.sh
+include SeismoWebPortal/data/prem_noocean.txt
+include SeismoWebPortal/data/prem_ocean.txt
+include SeismoWebPortal/data/STATIONS_FULL_758
+include SeismoWebPortal/data/CMTSOLUTION_BHUJ
+include SeismoWebPortal/data/CMTSOLUTION_VANUATU
+include SeismoWebPortal/sql/*.sql
+include SeismoWebPortal/static/images/*.gif
+include SeismoWebPortal/static/images/*.jpg
+include SeismoWebPortal/static/samples/STATIONS.txt
+include SeismoWebPortal/static/samples/UTILS.tar.gz
+include SeismoWebPortal/static/doc/*.pdf
+include SeismoWebPortal/static/script.js
+include SeismoWebPortal/templates/SeismoWebPortal/*.html
+include SeismoWebPortal/templates/SeismoWebPortal/*.css
+include SeismoWebPortal/templates/SeismoWebPortal/*.txt
+include SeismoWebPortal/templates/SeismoWebPortal/*.kml
+include SeismoWebPortal/templates/SeismoWebPortal/*.pml
+include SeismoWebPortal/templates/SeismoWebPortal/*.tmpl
+include SeismoWebPortal/templates/registration/*.html
+include SeismoWebPortal/templates/registration/*.txt
+include SeismoWebPortal/templates/*.html
Deleted: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_list.py
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_list.py 2008-07-01 18:55:59 UTC (rev 12362)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_list.py 2008-07-01 19:47:37 UTC (rev 12363)
@@ -1,5 +0,0 @@
-(
- {% for object in object_list %}
- { 'id': {{ object.id }}, 'status': '{{ object.status }}', 'code': {{ object.code }} },
- {% endfor %}
-)
Copied: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_list.py.tmpl (from rev 12359, cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_list.py)
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_list.py.tmpl (rev 0)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_list.py.tmpl 2008-07-01 19:47:37 UTC (rev 12363)
@@ -0,0 +1,5 @@
+(
+ {% for object in object_list %}
+ { 'id': {{ object.id }}, 'status': '{{ object.status }}', 'code': {{ object.code }} },
+ {% endfor %}
+)
Modified: cs/portal/trunk/northridge/SeismoWebPortal/urls.py
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/urls.py 2008-07-01 18:55:59 UTC (rev 12362)
+++ cs/portal/trunk/northridge/SeismoWebPortal/urls.py 2008-07-01 19:47:37 UTC (rev 12363)
@@ -23,7 +23,7 @@
# runs
(r'^runs/list\.py$', 'django.views.generic.list_detail.object_list', dict(queryset = models.ArchivedRun.objects.all(),
allow_empty = True,
- template_name='SeismoWebPortal/run_list.py',
+ template_name='SeismoWebPortal/run_list.py.tmpl',
mimetype='text/plain')),
(r'^runs/(?P<object_id>\d+)/status/$', 'SeismoWebPortal.views.update_run_status'),
(r'^runs/(?P<object_id>\d+)/(?P<filename>.*)$', 'SeismoWebPortal.views.downloadInputFile'),
Added: cs/portal/trunk/northridge/debug-setup.sh
===================================================================
--- cs/portal/trunk/northridge/debug-setup.sh (rev 0)
+++ cs/portal/trunk/northridge/debug-setup.sh 2008-07-01 19:47:37 UTC (rev 12363)
@@ -0,0 +1,22 @@
+# To debug the portal, perform the following:
+#
+# . debug-setup.sh
+# django-admin.py syncdb
+# django-admin.py runserver
+# firefox http://127.0.0.1:8000/portals/seismo/
+#
+
+export DJANGO_SETTINGS_MODULE=SeismoWebPortal.site.settings
+export WEBPORTAL_MEDIA_ROOT=`pwd`/media
+export WEBPORTAL_DATABASE_NAME=`pwd`/database
+export WEBPORTAL_SECRET_KEY='$2k0qi00^76%1i9r5z at i#l at l($2&-r3&!37z00-vll&9#&(skg'
+export WEBPORTAL_GMT_ROOT=$HOME/opt/gmt
+export WEBPORTAL_NETCDF_ROOT=$HOME/opt/netCDF
+
+mkdir -p $WEBPORTAL_MEDIA_ROOT
+
+export WEBPORTAL_DEBUG=1
+
+# This tells the 'management' module to import user tables from the
+# production portal during 'syncdb'.
+#export WEBPORTAL_LEGACY_DB=/home/portal/www-data/database
Deleted: cs/portal/trunk/northridge/ez_setup.py
===================================================================
--- cs/portal/trunk/northridge/ez_setup.py 2008-07-01 18:55:59 UTC (rev 12362)
+++ cs/portal/trunk/northridge/ez_setup.py 2008-07-01 19:47:37 UTC (rev 12363)
@@ -1,222 +0,0 @@
-#!python
-"""Bootstrap setuptools installation
-
-If you want to use setuptools in your package's setup.py, just include this
-file in the same directory with it, and add this to the top of your setup.py::
-
- from ez_setup import use_setuptools
- use_setuptools()
-
-If you want to require a specific version of setuptools, set a download
-mirror, or use an alternate download directory, you can do so by supplying
-the appropriate options to ``use_setuptools()``.
-
-This file can also be run as a script to install or upgrade setuptools.
-"""
-import sys
-DEFAULT_VERSION = "0.6c3"
-DEFAULT_URL = "http://cheeseshop.python.org/packages/%s/s/setuptools/" % sys.version[:3]
-
-md5_data = {
- 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca',
- 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb',
- 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b',
- 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a',
- 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618',
- 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac',
- 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5',
- 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',
- 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c',
- 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b',
- 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27',
- 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',
- 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',
- 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e',
- 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e',
-}
-
-import sys, os
-
-def _validate_md5(egg_name, data):
- if egg_name in md5_data:
- from md5 import md5
- digest = md5(data).hexdigest()
- if digest != md5_data[egg_name]:
- print >>sys.stderr, (
- "md5 validation of %s failed! (Possible download problem?)"
- % egg_name
- )
- sys.exit(2)
- return data
-
-
-def use_setuptools(
- version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
- download_delay=15
-):
- """Automatically find/download setuptools and make it available on sys.path
-
- `version` should be a valid setuptools version number that is available
- as an egg for download under the `download_base` URL (which should end with
- a '/'). `to_dir` is the directory where setuptools will be downloaded, if
- it is not already available. If `download_delay` is specified, it should
- be the number of seconds that will be paused before initiating a download,
- should one be required. If an older version of setuptools is installed,
- this routine will print a message to ``sys.stderr`` and raise SystemExit in
- an attempt to abort the calling script.
- """
- try:
- import setuptools
- if setuptools.__version__ == '0.0.1':
- print >>sys.stderr, (
- "You have an obsolete version of setuptools installed. Please\n"
- "remove it from your system entirely before rerunning this script."
- )
- sys.exit(2)
- except ImportError:
- egg = download_setuptools(version, download_base, to_dir, download_delay)
- sys.path.insert(0, egg)
- import setuptools; setuptools.bootstrap_install_from = egg
-
- import pkg_resources
- try:
- pkg_resources.require("setuptools>="+version)
-
- except pkg_resources.VersionConflict, e:
- # XXX could we install in a subprocess here?
- print >>sys.stderr, (
- "The required version of setuptools (>=%s) is not available, and\n"
- "can't be installed while this script is running. Please install\n"
- " a more recent version first.\n\n(Currently using %r)"
- ) % (version, e.args[0])
- sys.exit(2)
-
-def download_setuptools(
- version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
- delay = 15
-):
- """Download setuptools from a specified location and return its filename
-
- `version` should be a valid setuptools version number that is available
- as an egg for download under the `download_base` URL (which should end
- with a '/'). `to_dir` is the directory where the egg will be downloaded.
- `delay` is the number of seconds to pause before an actual download attempt.
- """
- import urllib2, shutil
- egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3])
- url = download_base + egg_name
- saveto = os.path.join(to_dir, egg_name)
- src = dst = None
- if not os.path.exists(saveto): # Avoid repeated downloads
- try:
- from distutils import log
- if delay:
- log.warn("""
----------------------------------------------------------------------------
-This script requires setuptools version %s to run (even to display
-help). I will attempt to download it for you (from
-%s), but
-you may need to enable firewall access for this script first.
-I will start the download in %d seconds.
-
-(Note: if this machine does not have network access, please obtain the file
-
- %s
-
-and place it in this directory before rerunning this script.)
----------------------------------------------------------------------------""",
- version, download_base, delay, url
- ); from time import sleep; sleep(delay)
- log.warn("Downloading %s", url)
- src = urllib2.urlopen(url)
- # Read/write all in one block, so we don't create a corrupt file
- # if the download is interrupted.
- data = _validate_md5(egg_name, src.read())
- dst = open(saveto,"wb"); dst.write(data)
- finally:
- if src: src.close()
- if dst: dst.close()
- return os.path.realpath(saveto)
-
-def main(argv, version=DEFAULT_VERSION):
- """Install or upgrade setuptools and EasyInstall"""
-
- try:
- import setuptools
- except ImportError:
- egg = None
- try:
- egg = download_setuptools(version, delay=0)
- sys.path.insert(0,egg)
- from setuptools.command.easy_install import main
- return main(list(argv)+[egg]) # we're done here
- finally:
- if egg and os.path.exists(egg):
- os.unlink(egg)
- else:
- if setuptools.__version__ == '0.0.1':
- # tell the user to uninstall obsolete version
- use_setuptools(version)
-
- req = "setuptools>="+version
- import pkg_resources
- try:
- pkg_resources.require(req)
- except pkg_resources.VersionConflict:
- try:
- from setuptools.command.easy_install import main
- except ImportError:
- from easy_install import main
- main(list(argv)+[download_setuptools(delay=0)])
- sys.exit(0) # try to force an exit
- else:
- if argv:
- from setuptools.command.easy_install import main
- main(argv)
- else:
- print "Setuptools version",version,"or greater has been installed."
- print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
-
-
-
-def update_md5(filenames):
- """Update our built-in md5 registry"""
-
- import re
- from md5 import md5
-
- for name in filenames:
- base = os.path.basename(name)
- f = open(name,'rb')
- md5_data[base] = md5(f.read()).hexdigest()
- f.close()
-
- data = [" %r: %r,\n" % it for it in md5_data.items()]
- data.sort()
- repl = "".join(data)
-
- import inspect
- srcfile = inspect.getsourcefile(sys.modules[__name__])
- f = open(srcfile, 'rb'); src = f.read(); f.close()
-
- match = re.search("\nmd5_data = {\n([^}]+)}", src)
- if not match:
- print >>sys.stderr, "Internal error!"
- sys.exit(2)
-
- src = src[:match.start(1)] + repl + src[match.end(1):]
- f = open(srcfile,'w')
- f.write(src)
- f.close()
-
-
-if __name__=='__main__':
- if len(sys.argv)>2 and sys.argv[1]=='--md5update':
- update_md5(sys.argv[2:])
- else:
- main(sys.argv[1:])
-
-
-
-
-
Deleted: cs/portal/trunk/northridge/runserver.sh
===================================================================
--- cs/portal/trunk/northridge/runserver.sh 2008-07-01 18:55:59 UTC (rev 12362)
+++ cs/portal/trunk/northridge/runserver.sh 2008-07-01 19:47:37 UTC (rev 12363)
@@ -1,41 +0,0 @@
-#!/bin/csh
-
-# runserver.sh
-# by santiago v lombeyda
-#
-# sets up environment variables as needed. feel free
-# to translate to bash if more robust and/or more portable
-
-set DJANGO_SETTINGS_MODULE="SeismoWebPortal.site.settings"
-setenv DJANGO_SETTINGS_MODULE SeismoWebPortal.site.settings
-
-echo "Setting up environment for" $USER
-
-if ( $USER == "leif" ) then
-
- set WEBPORTAL_MEDIA_ROOT="/Users/leif/Projects/WebPortal/"
- setenv WEBPORTAL_MEDIA_ROOT /Users/leif/Projects/WebPortal/
-
- set WEBPORTAL_DATABASE_NAME=$WEBPORTAL_MEDIA_ROOT'/SiteDatabase.db'
- setenv WEBPORTAL_DATABASE_NAME $WEBPORTAL_MEDIA_ROOT/SiteDatabase.db
-
-else if ( $USER == "slombey" ) then
-
- set WEBPORTAL_MEDIA_ROOT="/Volumes/Documents/geophys/ondemand/pyportalSVN/trunk/SeismoWebPortal"
- setenv WEBPORTAL_MEDIA_ROOT /Volumes/Documents/geophys/ondemand/pyportalSVN/trunk/SeismoWebPortal
-
- set WEBPORTAL_DATABASE_NAME=$WEBPORTAL_MEDIA_ROOT'/SiteDatabase.db'
- setenv WEBPORTAL_DATABASE_NAME $WEBPORTAL_MEDIA_ROOT/SiteDatabase.db
-
-endif
-
-if ( $1 == "install" ) then
- sudo python setup.py develop
-endif
-
-echo "Synchronizing database at" $WEBPORTAL_DATABASE_NAME
-django-admin.py syncdb
-
-echo "Starting server from" $WEBPORTAL_MEDIA_ROOT
-django-admin.py runserver
-
Modified: cs/portal/trunk/northridge/setup.py
===================================================================
--- cs/portal/trunk/northridge/setup.py 2008-07-01 18:55:59 UTC (rev 12362)
+++ cs/portal/trunk/northridge/setup.py 2008-07-01 19:47:37 UTC (rev 12363)
@@ -1,30 +1,33 @@
-try:
- # If setuptools 0.6b1 or later is installed, run with it.
- from pkg_resources import require
- require("setuptools>=0.6b1")
-except:
- from ez_setup import use_setuptools
- use_setuptools()
+from distutils.core import setup
-from setuptools import setup
-
setup(
name = 'SeismoWebPortal',
- version = '3.5',
- url = 'http://www.gps.caltech.edu/~jtromp/research/downloads.html',
- author = 'Dimitri Komatitsch and Jeroen Tromp',
- author_email = 'jtromp AT caltech.edu',
- packages = [ 'SeismoWebPortal' ],
-
- install_requires = [
- 'Django >= 0.95',
- #'pysqlite >= 2.0.3',
- ],
-
- dependency_links = [
- 'http://www.djangoproject.com/download/0.95/tarball/#egg=Django-0.95',
- 'http://initd.org/tracker/pysqlite',
- ],
-
-)
+ version = '3.0.0',
+ url = 'http://www.geodynamics.org/',
+ author = 'Leif Strand',
+ author_email = 'leif at geodynamics.org',
+ packages = ['SeismoWebPortal', 'SeismoWebPortal.site'],
+ package_data = {'SeismoWebPortal': ['data/prem_noocean.txt',
+ 'data/prem_ocean.txt',
+ 'data/STATIONS_FULL_758',
+ 'data/CMTSOLUTION_BHUJ',
+ 'data/CMTSOLUTION_VANUATU',
+ 'sql/*.sql',
+ 'static/images/*.gif',
+ 'static/images/*.jpg',
+ 'static/samples/STATIONS.txt',
+ 'static/samples/UTILS.tar.gz',
+ 'static/doc/*.pdf',
+ 'static/script.js',
+ 'templates/SeismoWebPortal/*.html',
+ 'templates/SeismoWebPortal/*.css',
+ 'templates/SeismoWebPortal/*.txt',
+ 'templates/SeismoWebPortal/*.kml',
+ 'templates/SeismoWebPortal/*.pml',
+ 'templates/SeismoWebPortal/*.tmpl',
+ 'templates/registration/*.html',
+ 'templates/registration/*.txt',
+ 'templates/*.html',
+ ]},
+ )
More information about the cig-commits
mailing list