1 | import os |
---|
2 | import sys |
---|
3 | |
---|
4 | env = Environment() |
---|
5 | |
---|
6 | # Find the path for Python.h and then share it to other SConscripts later on |
---|
7 | # Where to find the Python.h |
---|
8 | if sys.platform == 'win32': #Windows |
---|
9 | python_include = os.path.join(sys.exec_prefix, 'include') |
---|
10 | # Windows installs need to be told the lib path and the python library name |
---|
11 | # else it won't work right. |
---|
12 | python_libdir = os.path.join(sys.exec_prefix, 'libs') |
---|
13 | try: |
---|
14 | env['LIBPATH'] = env['LIBPATH'] + [python_libdir] |
---|
15 | except KeyError: |
---|
16 | env['LIBPATH'] = [python_libdir] |
---|
17 | python_libname = 'python%d%d' % (sys.version_info[0], sys.version_info[1]) |
---|
18 | try: |
---|
19 | env['LIBS'] = env['LIBS'] + [python_libname] |
---|
20 | except KeyError: |
---|
21 | env['LIBS'] = [python_libname] |
---|
22 | else: |
---|
23 | python_include = os.path.join(os.path.join(sys.exec_prefix, 'include'), |
---|
24 | 'python' + sys.version[:3]) |
---|
25 | |
---|
26 | # Check existence of Python.h |
---|
27 | headerfile = python_include + os.sep + 'Python.h' |
---|
28 | try: |
---|
29 | open(headerfile, 'r') |
---|
30 | except: |
---|
31 | raise """Did not find Python header file %s. |
---|
32 | Make sure files for Python C-extensions are installed. |
---|
33 | In debian linux, for example, you need to install a |
---|
34 | package called something like python2.3-dev""" %headerfile |
---|
35 | |
---|
36 | try: |
---|
37 | env['CPPPATH'] = env['CPPPATH'] + [python_include] |
---|
38 | except KeyError: |
---|
39 | env['CPPPATH'] = [python_include] |
---|
40 | |
---|
41 | Export('env') |
---|
42 | |
---|
43 | # Build the inundation modules |
---|
44 | SConscript(['inundation/SConscript']) |
---|