[MOAB-dev] r3046 - MOAB/trunk/tools/iMesh/python

jvporter at mcs.anl.gov jvporter at mcs.anl.gov
Wed Jul 22 00:41:47 CDT 2009


Author: jvporter
Date: 2009-07-22 00:41:47 -0500 (Wed, 22 Jul 2009)
New Revision: 3046

Modified:
   MOAB/trunk/tools/iMesh/python/Makefile.am
   MOAB/trunk/tools/iMesh/python/setup.py
Log:
Support building PyTAPS from outside of source directory. Notes:
* Removed "--root" from INSTALL_FLAGS in python/Makefile.am since this 
  broke install paths
* Has the interesting side effect that python/build/temp.$PLAT has 
  deeply-nested subdirs
* Fixed typo in "--install-headers" in python/Makefile.am, not that we 
  use it


Modified: MOAB/trunk/tools/iMesh/python/Makefile.am
===================================================================
--- MOAB/trunk/tools/iMesh/python/Makefile.am	2009-07-21 23:54:15 UTC (rev 3045)
+++ MOAB/trunk/tools/iMesh/python/Makefile.am	2009-07-22 05:41:47 UTC (rev 3046)
@@ -1,24 +1,23 @@
-BUILD_EXT_FLAGS = --include-dirs="$(PYTHON_DIR):$(NUMPY_DIR):$(abs_top_srcdir)"\
-                  --imesh-dir="$(abs_srcdir)/.."
+BUILD_EXT_FLAGS = -I"$(PYTHON_DIR):$(NUMPY_DIR):$(abs_top_builddir)" \
+                  --imesh-dir="$(abs_builddir)/.."
 
 INSTALL_FLAGS = --skip-build \
                 --prefix="$(prefix)" \
                 --exec-prefix="$(exec_prefix)" \
-                --root="$(DESTDIR)" \
                 --install-lib="$(libdir)" \
-                --install-headers="$(incluedir)" \
+                --install-headers="$(includedir)" \
                 --install-data="$(datadir)" \
                 --install-scripts="$(bindir)"
 
 all:
-	$(PYTHON) setup.py build_ext $(BUILD_EXT_FLAGS)
-	$(PYTHON) setup.py build
+	$(PYTHON) $(abs_srcdir)/setup.py build_ext $(BUILD_EXT_FLAGS)
+	$(PYTHON) $(abs_srcdir)/setup.py build
 
-install:
-	$(PYTHON) setup.py install $(INSTALL_FLAGS)
+install: all
+	$(PYTHON) $(abs_srcdir)/setup.py install $(INSTALL_FLAGS)
 
 clean:
-	$(PYTHON) setup.py clean --all
+	$(PYTHON) $(abs_srcdir)/setup.py clean --all
 
 EXTRA_DIST = doc perf pkg test tools \
              common.h \
@@ -26,12 +25,12 @@
              iBase.c \
              iBase_Python.h \
              iMesh.c \
-	     iMesh_entSet.inl \
-	     iMesh_iter.inl \
-	     iMesh_Python.h \
-	     iMesh_tag.inl \
-	     Makefile.am \
-	     numpy_extensions.h \
-	     numpy_extensions.inl \
-	     setup.cfg.example \
-	     setup.py
+             iMesh_entSet.inl \
+             iMesh_iter.inl \
+             iMesh_Python.h \
+             iMesh_tag.inl \
+             Makefile.am \
+             numpy_extensions.h \
+             numpy_extensions.inl \
+             setup.cfg.example \
+             setup.py

Modified: MOAB/trunk/tools/iMesh/python/setup.py
===================================================================
--- MOAB/trunk/tools/iMesh/python/setup.py	2009-07-21 23:54:15 UTC (rev 3045)
+++ MOAB/trunk/tools/iMesh/python/setup.py	2009-07-22 05:41:47 UTC (rev 3046)
@@ -40,17 +40,22 @@
 build_ext.finalize_options   = pair_fun(build_ext.finalize_options,   new_fin)
 
 
+def rebase(path):
+    return os.path.normpath( os.path.join( os.path.abspath(sys.argv[0]),
+                                           '../'+path) )
+
 iBase = Extension('itaps.iBase',
-                  depends      = ['common.h', 'iBase_Python.h'],
-                  sources      = ['iBase.c']
+                  depends = map(rebase, ['common.h', 'iBase_Python.h']),
+                  sources = map(rebase, ['iBase.c'])
                   )
 
 iMesh = Extension('itaps.iMesh',
-                  depends      = ['common.h', 'errors.h', 'iMesh_Python.h',
-                                  'iBase_Python.h', 'iMesh_entSet.inl',
-                                  'iMesh_iter.inl', 'iMesh_tag.inl',
-                                  'numpy_extensions.h', 'numpy_extensions.inl'],
-                  sources      = ['iMesh.c']
+                  depends = map(rebase,
+                                ['common.h', 'errors.h', 'iMesh_Python.h',
+                                 'iBase_Python.h', 'iMesh_entSet.inl',
+                                 'iMesh_iter.inl', 'iMesh_tag.inl',
+                                 'numpy_extensions.h', 'numpy_extensions.inl']),
+                  sources = map(rebase, ['iMesh.c'])
                   )
 
 class TestCommand(Command):
@@ -69,8 +74,7 @@
             raise DistutilsOptionError('"verbosity" option must be an integer')
 
     def run(self):
-        root = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
-                                             '../test'))
+        root = rebase('test')
         old = os.getcwd()
         tests = []
         regex = re.compile(r'^(.*).py$')
@@ -104,8 +108,7 @@
             self.target = '_build/' + self.builder
 
     def run(self):
-        root = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
-                                             '../doc'))
+        root = rebase('doc')
         old = os.getcwd()
 
         os.chdir(root)
@@ -167,8 +170,7 @@
             add_imesh_defs(self.imesh_dir, self)
 
     def run(self):
-        root = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
-                                             '../perf'))
+        root = rebase('perf')
         old = os.getcwd()
         os.chdir(root)
 
@@ -207,8 +209,7 @@
             raise DistutilsOptionError('"count" option must be an integer')
 
     def run(self):
-        root = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
-                                             '../perf'))
+        root = rebase('perf')
         old = os.getcwd()
         os.chdir(root)
         os.system('python perf.py -c%d "%s"' % (self.count, self.file))
@@ -223,7 +224,7 @@
       requires = ['numpy'],
       provides = ['itaps'],
 
-      package_dir = {'itaps': 'pkg'},
+      package_dir = {'itaps': rebase('pkg')},
       packages = ['itaps'],
       ext_modules = [iBase, iMesh],
       py_modules = ['itaps.helpers'],



More information about the moab-dev mailing list