xref: /petsc/setup.py (revision 12c1d45b57e5063bd6ae19b82ae305182ed5c3c4)
1#!/usr/bin/env python
2
3"""
4     Make PETSc appear to be a Python package; so it can be depended on by petsc4py
5"""
6
7def setup():
8    import os,sys
9    os.environ['PETSC_DIR']  = os.path.abspath(os.getcwd())
10    os.environ['PETSC_ARCH'] = 'arch-python-test'
11    os.chdir(os.environ['PETSC_DIR'])
12    sys.path.insert(0,os.path.join(os.environ['PETSC_DIR'],'config'))
13    return
14
15def configure(prefix):
16    import configure
17    configure.petsc_configure(['--with-fc=0','--with-mpi=0','--with-shared-libraries'])
18    # force save of configure information, or build will fail to load it
19
20    # work around bug in logger.Logger that when log file is closed Logger.defaultLog still points to something
21    import logger
22    logger.Logger.defaultLog = None
23    return
24
25def build():
26    import builder
27    builder.PETScMaker().run()
28    return
29
30if __name__ == '__main__':
31    setup()
32    configure("dummy")
33    build()
34
35# -----------------------------------------------------------------------------
36