[cig-commits] r4618 - in cs/Exchanger/trunk: . Exchanger lib tests
leif at geodynamics.org
leif at geodynamics.org
Mon Sep 25 17:16:40 PDT 2006
Author: leif
Date: 2006-09-25 17:16:40 -0700 (Mon, 25 Sep 2006)
New Revision: 4618
Added:
cs/Exchanger/trunk/Exchanger/
cs/Exchanger/trunk/PKG-INFO.in
cs/Exchanger/trunk/config.cfg.in
cs/Exchanger/trunk/ez_setup.py
cs/Exchanger/trunk/setup.py
Removed:
cs/Exchanger/trunk/Exchanger/Make.mm
cs/Exchanger/trunk/Make.mm
cs/Exchanger/trunk/lib/Make.mm
cs/Exchanger/trunk/pyre/
cs/Exchanger/trunk/tests/Make.mm
Modified:
cs/Exchanger/trunk/Makefile.am
cs/Exchanger/trunk/configure.ac
Log:
Exchanger egg-ification (part 1/2).
Copied: cs/Exchanger/trunk/Exchanger (from rev 4597, cs/Exchanger/trunk/pyre)
Deleted: cs/Exchanger/trunk/Exchanger/Make.mm
===================================================================
--- cs/Exchanger/trunk/pyre/Make.mm 2006-09-22 23:47:35 UTC (rev 4597)
+++ cs/Exchanger/trunk/Exchanger/Make.mm 2006-09-26 00:16:40 UTC (rev 4618)
@@ -1,45 +0,0 @@
-# -*- Makefile -*-
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-# <LicenseText>
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-PROJECT = Exchanger
-PACKAGE = pyre
-
-
-#--------------------------------------------------------------------------
-#
-
-all: export
-
-release: tidy
- cvs release .
-
-update: clean
- cvs update .
-
-init:
- sed -e 's|@PACKAGE_VERSION@|1.0.0|g' < __init__.py.in > __init__.py
-
-#--------------------------------------------------------------------------
-#
-# export
-
-EXPORT_PYTHON_MODULES = \
- __init__.py \
- CoupledApp.py \
- Coupler.py \
- Exchanger.py \
- Layout.py \
-
-
-export:: init export-python-modules
- $(RM) $(RMFLAGS) __init__.py __init__.pyc
-
-# version
-# $Id: Make.mm,v 1.2 2004/06/11 17:20:55 tan2 Exp $
-
-# End of file
Deleted: cs/Exchanger/trunk/Make.mm
===================================================================
--- cs/Exchanger/trunk/Make.mm 2006-09-25 23:46:27 UTC (rev 4617)
+++ cs/Exchanger/trunk/Make.mm 2006-09-26 00:16:40 UTC (rev 4618)
@@ -1,33 +0,0 @@
-# -*- Makefile -*-
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-# <LicenseText>
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-PROJECT = Exchanger
-PACKAGE = main
-
-RECURSE_DIRS = \
- lib \
- pyre
-
-#--------------------------------------------------------------------------
-#
-
-all:
- BLD_ACTION="all" $(MM) recurse
-
-PROJ_CLEAN =
-clean::
- BLD_ACTION="clean" $(MM) recurse
-
-tidy::
- BLD_ACTION="tidy" $(MM) recurse
-
-
-# version
-# $Id: Make.mm,v 1.3 2005/01/21 20:19:08 tan2 Exp $
-
-# End of file
Modified: cs/Exchanger/trunk/Makefile.am
===================================================================
--- cs/Exchanger/trunk/Makefile.am 2006-09-25 23:46:27 UTC (rev 4617)
+++ cs/Exchanger/trunk/Makefile.am 2006-09-26 00:16:40 UTC (rev 4618)
@@ -10,7 +10,7 @@
# lib
CXX = $(MPICXX)
CXXLD = @CXX@
-INCLUDES = $(PYTHIA_CPPFLAGS) -I$(PYTHON_INCDIR) $(MPIINCLUDES)
+INCLUDES = $(PYTHON_EGG_CPPFLAGS) -I$(PYTHON_INCDIR) $(MPIINCLUDES)
pkginclude_HEADERS = \
lib/Array2D.h \
lib/Array2D.cc \
@@ -49,26 +49,35 @@
lib/Spherical2Cartesian.cc \
lib/Utility.cc
libExchanger_la_LDFLAGS = -release $(PACKAGE_VERSION)
-libExchanger_la_LIBADD = -l_mpimodule -ljournal
+libExchanger_la_LIBADD = $(PYTHON_EGG_LDFLAGS)
# pyre
-pkgpython_PYTHON = \
- pyre/CoupledApp.py \
- pyre/Coupler.py \
- pyre/Exchanger.py \
- pyre/Layout.py
-nodist_pkgpython_PYTHON = \
- config.py \
- __init__.py
+nobase_pythonegg_PYTHON = \
+ Exchanger/CoupledApp.py \
+ Exchanger/Coupler.py \
+ Exchanger/Exchanger.py \
+ Exchanger/Layout.py \
+ Exchanger/__init__.py
+pythonegginfo_PYTHON = \
+ requires.txt
+nodist_pythonegginfo_PYTHON = \
+ PKG-INFO \
+ config.cfg
do_subst = sed \
- -e 's|[@]PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g'
-config.py: $(top_builddir)/portinfo $(top_builddir)/Makefile
- $(PYCONFIG) -h $(top_builddir)/portinfo -m $(top_builddir)/Makefile -o $@
-__init__.py: $(srcdir)/pyre/__init__.py.in
- $(do_subst) < $(srcdir)/pyre/__init__.py.in > $@ || (rm -f $@ && exit 1)
-CLEANFILES = $(nodist_pkgpython_PYTHON)
+ -e 's|[@]PACKAGE[@]|$(PACKAGE)|g' \
+ -e 's|[@]PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g' \
+ -e 's|[@]prefix[@]|$(prefix)|g' \
+ -e 's|[@]exec_prefix[@]|$(exec_prefix)|g' \
+ -e 's|[@]includedir[@]|$(includedir)|g' \
+ -e 's|[@]libdir[@]|$(libdir)|g'
+PKG-INFO: $(srcdir)/PKG-INFO.in
+ $(do_subst) < $(srcdir)/PKG-INFO.in > $@ || (rm -f $@ && exit 1)
+config.cfg: $(srcdir)/config.cfg.in
+ $(do_subst) < $(srcdir)/config.cfg.in > $@ || (rm -f $@ && exit 1)
+CLEANFILES = $(nodist_pythonegginfo_PYTHON)
EXTRA_DIST += \
- pyre/__init__.py.in
+ PKG-INFO.in \
+ config.cfg.in
# export
export_incdir = $(top_builddir)/include
Added: cs/Exchanger/trunk/PKG-INFO.in
===================================================================
--- cs/Exchanger/trunk/PKG-INFO.in 2006-09-25 23:46:27 UTC (rev 4617)
+++ cs/Exchanger/trunk/PKG-INFO.in 2006-09-26 00:16:40 UTC (rev 4618)
@@ -0,0 +1,10 @@
+Metadata-Version: 1.0
+Name: @PACKAGE@
+Version: @PACKAGE_VERSION@
+Summary: Exchanger module.
+Home-page: http://www.geodynamics.org/
+Author: Eh Tan
+Author-email: cig-all at geodynamics.org
+License: GPL
+Description: UNKNOWN
+Platform: UNKNOWN
Added: cs/Exchanger/trunk/config.cfg.in
===================================================================
--- cs/Exchanger/trunk/config.cfg.in 2006-09-25 23:46:27 UTC (rev 4617)
+++ cs/Exchanger/trunk/config.cfg.in 2006-09-26 00:16:40 UTC (rev 4618)
@@ -0,0 +1,10 @@
+
+[DEFAULT]
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+includedir = @includedir@
+libdir = @libdir@
+
+[flags]
+CPPFLAGS = -I%(includedir)s
+LDFLAGS = -L%(libdir)s -lExchanger
Modified: cs/Exchanger/trunk/configure.ac
===================================================================
--- cs/Exchanger/trunk/configure.ac 2006-09-25 23:46:27 UTC (rev 4617)
+++ cs/Exchanger/trunk/configure.ac 2006-09-26 00:16:40 UTC (rev 4618)
@@ -5,7 +5,7 @@
AC_PREREQ(2.59)
AC_INIT([Exchanger], [1.0.0], [cig-mc at geodynamics.org], [Exchanger])
AC_CONFIG_AUX_DIR([./aux-config])
-AC_CONFIG_SRCDIR([pyre/Exchanger.py])
+AC_CONFIG_SRCDIR([Exchanger/Exchanger.py])
AC_CONFIG_HEADER([portinfo])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign])
@@ -14,18 +14,20 @@
AC_ARG_VAR(PYTHON, [Python interpreter])
AC_ARG_VAR(PYTHONPATH, [Python module search path])
-# Checks for programs.
+# Check for Python.
AM_PATH_PYTHON([2.3])
CIT_PYTHON_INCDIR
+
+# Checks for Python modules and packages.
+CIT_CHECK_PYTHON_EGG([pythia >= 0.8-1.0dev-r4617, < 0.8-2.0a, == dev])
+CIT_PYTHON_EGG_FLAGS
+CIT_PYTHON_EGG_REQUIRES
+
+# Checks for programs.
CIT_PROG_MPICXX
AC_LANG(C++)
AC_PROG_LIBTOOL
-CIT_PROG_PYCONFIG
-# Checks for Python modules and packages.
-PYTHONPATH="${pythondir}${PYTHONPATH:+:${PYTHONPATH}}"; export PYTHONPATH
-CIT_PATH_PYTHIA([0.8], [mpi])
-
# Checks for libraries.
CIT_CHECK_LIB_MPI
Added: cs/Exchanger/trunk/ez_setup.py
===================================================================
--- cs/Exchanger/trunk/ez_setup.py 2006-09-25 23:46:27 UTC (rev 4617)
+++ cs/Exchanger/trunk/ez_setup.py 2006-09-26 00:16:40 UTC (rev 4618)
@@ -0,0 +1,222 @@
+#!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/Exchanger/trunk/lib/Make.mm
===================================================================
--- cs/Exchanger/trunk/lib/Make.mm 2006-09-25 23:46:27 UTC (rev 4617)
+++ cs/Exchanger/trunk/lib/Make.mm 2006-09-26 00:16:40 UTC (rev 4618)
@@ -1,75 +0,0 @@
-# -*- Makefile -*-
-#
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-# <LicenseText>
-#
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-
-PROJECT = Exchanger
-PACKAGE = libExchanger
-
-PROJ_SAR = $(BLD_LIBDIR)/$(PACKAGE).$(EXT_SAR)
-PROJ_DLL = $(BLD_LIBDIR)/$(PACKAGE).$(EXT_SO)
-PROJ_TMPDIR = $(BLD_TMPDIR)/$(PROJECT)/$(PACKAGE)
-PROJ_CLEAN += $(PROJ_DLL) $(PROJ_SAR)
-
-PROJ_CXX_SRCLIB = \
- -ljournal \
-
-EXTERNAL_INCLUDES += $(PYTHON_INCDIR) $(PYTHIA_DIR)/include $(PYTHIA_INCDIR)
-EXTERNAL_LIBDIRS = $(PYTHIA_LIBDIR)
-EXTERNAL_LIBPATH += $(foreach dir,$(EXTERNAL_LIBDIRS),-L$(dir))
-
-PROJ_SRCS = \
- Boundary.cc \
- BoundedBox.cc \
- BoundedMesh.cc \
- BoundingBox.cc \
- Convertor.cc \
- Inlet.cc \
- Interpolator.cc \
- Outlet.cc \
- SIUnit.cc \
- Sink.cc \
- Source.cc \
- Spherical2Cartesian.cc \
- Utility.cc \
- exchangers.cc \
-
-
-EXPORT_HEADERS = \
- Array2D.h \
- Array2D.cc \
- Boundary.h \
- BoundedBox.h \
- BoundedMesh.h \
- BoundingBox.h \
- CartesianCoord.h \
- Convertor.h \
- DIM.h \
- Inlet.h \
- Interpolator.h \
- Outlet.h \
- SIUnit.h \
- Sink.h \
- Source.h \
- Spherical2Cartesian.h \
- Utility.h \
- UtilTemplate.h \
- UtilTemplate.cc \
- exchangers.h \
-
-
-EXPORT_LIBS = $(PROJ_SAR)
-EXPORT_BINS = $(PROJ_DLL)
-
-all: $(PROJ_SAR) export
-
-export:: export-headers export-libraries export-binaries
-
-# version
-# $Id: Make.mm,v 1.12 2005/06/03 21:51:47 leif Exp $
-
-# End of file
Added: cs/Exchanger/trunk/setup.py
===================================================================
--- cs/Exchanger/trunk/setup.py 2006-09-25 23:46:27 UTC (rev 4617)
+++ cs/Exchanger/trunk/setup.py 2006-09-26 00:16:40 UTC (rev 4618)
@@ -0,0 +1,19 @@
+
+# This is not a normal 'setup.py' script; it is provided as a
+# convenience to install Python packages required by Exchanger. For
+# instructions on installing Exchanger itself, see the file INSTALL.
+
+from ez_setup import use_setuptools
+use_setuptools()
+
+from setuptools import setup
+import sys
+
+setup(
+ script_args = (
+ ['easy_install',
+ '--find-links=svn://geodynamics.org/cig/cs/pythia/trunk#egg=pythia-dev'] +
+ sys.argv[1:] +
+ ['pythia >= 0.8-1.0dev-r4617, < 0.8-2.0a, == dev']
+ )
+)
Deleted: cs/Exchanger/trunk/tests/Make.mm
===================================================================
--- cs/Exchanger/trunk/tests/Make.mm 2006-09-25 23:46:27 UTC (rev 4617)
+++ cs/Exchanger/trunk/tests/Make.mm 2006-09-26 00:16:40 UTC (rev 4618)
@@ -1,27 +0,0 @@
-# -*- Makefile -*-
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-# <LicenseText>
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-PROJECT = Exchanger
-PACKAGE = tests
-
-PROJ_TESTS =
-
-
-#--------------------------------------------------------------------------
-#
-
-all: $(PROJ_TESTS)
-
-test:
- for test in $(PROJ_TESTS) ; do $${test}; done;
-
-
-# version
-# $Id: Make.mm,v 1.1 2004/05/08 01:51:14 tan2 Exp $
-
-# End of file
More information about the cig-commits
mailing list