#!/usr/bin/env python import user import maker import sys import os import shutil class Make(maker.BasicMake): def __init__(self): assert "PETSC_DIR" in os.environ assert "PETSC_ARCH" in os.environ assert "LINEAL_DIR" in os.environ self.petsc_dir = os.environ["PETSC_DIR"] self.lineal_dir = os.environ["LINEAL_DIR"] self.petsc_arch = os.environ["PETSC_ARCH"] # Mess around with system paths petsc_python = os.path.join(self.petsc_dir, "python") sys.path.insert(0, petsc_python) maker.BasicMake.__init__(self) return def setupConfigure(self, framework): # Get hold of the PETSc configuration module petsc_python = os.path.join(self.petsc_dir, "python", "PETSc") self.configureMod = self.getModule(petsc_python, "petsc") # Now set up the usual configuration maker.BasicMake.setupConfigure(self, framework) framework.header = None framework.cHeader = None # BUGBUG: Do we need this? framework.require("config.python", self.configureObj) return 1 def configure(self, builder): framework = maker.BasicMake.configure(self, builder) # self.arch = framework.require("PETSc.utilities.arch", None) self.python = framework.require("config.python", None) self.mpi = framework.require("PETSc.packages.MPI", None) return framework def setupDirectories(self, builder): """ Where do we look for sources and where do we build the libraries? """ maker.BasicMake.setupDirectories(self, builder) src_dir = os.path.join(self.lineal_dir, "src", "pypetsc") self.srcDir["C"] = src_dir self.srcDir["Python"] = src_dir lib_dir = os.path.join(self.lineal_dir, "lib", self.petsc_arch) self.libDir = lib_dir return def buildLibraries(self, builder): """ Actually build the Python libraries. """ maker.BasicMake.buildLibraries(self, builder) # Copy the python sources into the lib directory for f in self.classifySource(os.listdir(self.srcDir["Python"]))["Python"]: shutil.copy(os.path.join(self.srcDir["Python"], f), os.path.join(self.libDir, os.path.basename(f))) return def dylib_cfuncs(maker): '''cfuncs.c''' return (maker.configureObj.include+maker.mpi.include+maker.python.include, maker.configureObj.lib+maker.mpi.lib+maker.python.lib) if __name__ == '__main__': Make().run()