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