~nizamov-shawkat/python-meep/devel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env python

"""
setup.py file for python-meep module 
"""

from distutils import file_util, sysconfig
from distutils.core import setup, Extension
import sys,getopt

#User can specify an include directory with -I : this will be passed to SWIG. If no such parameter is specified, then -I/usr/include will be passed to SWIG
optlist, a = getopt.getopt(sys.argv[2:], 'I:L:',['all'])


libDir = "/usr/lib"
removeArg = -1
removeArg2 = -1

for opt in optlist:
    if (opt[0]=="-I"):
    includeDir = opt[1]
    c = 0
    for arg in sys.argv:
        if (arg[0:2]=="-I"):
            removeArg = c+2  # +2 because we omitted the 1st and 2nd argument in the beginning!
    if (opt[0]=="-L"):
        libDir = opt[1]
        c = 0
    for arg in sys.argv:
            if (arg[0:2]=="-L"):
                removeArg2 = c+2  # +2 because we omitted the 1st and 2nd argument in the beginning!

if (removeArg >= 0):
    dummy = sys.argv.pop(removeArg)
if (removeArg2 >= 0):
    dummy = sys.argv.pop(removeArg2)
            
print "Directory for SWIG -I option : " , includeDir
print "Directory for -L option : " , libDir

# file_util.copy_file("python_meep_config-nonmpi.py","python_meep_config.py")
# no need for such granularization
 
meep_swig = Extension ('_meep', ['meep.i'], 
        swig_opts=['-c++','-w503','-I'+includeDir],
        libraries = ['meep'],
        library_dirs=[libDir],
)


setup (name = 'python-meep',
       version = '0.7',
       author      = "Nizamov Shawkat and Emmanuel Lambert",
       author_email = "http://launchpad.net/~python-meep/+contactuser",
       url = 'http://launchpad.net/~python-meep',
       description = """Python wrapper module for MEEP FDTD""",
       ext_modules = [meep_swig],
       data_files=[(sysconfig.get_python_lib(1,0,""),['custom.hpp'])],
       py_modules = ["meep"],
       )
#file 'custom.hpp' needed for using inline C/C++ callback