comparison DEPENDENCIES/mingw32/Python27/Lib/site-packages/numpy/f2py/setup.py @ 87:2a2c65a20a8b

Add Python libs and headers
author Chris Cannam
date Wed, 25 Feb 2015 14:05:22 +0000
parents
children
comparison
equal deleted inserted replaced
86:413a9d26189e 87:2a2c65a20a8b
1 #!/usr/bin/env python
2 """
3 setup.py for installing F2PY
4
5 Usage:
6 python setup.py install
7
8 Copyright 2001-2005 Pearu Peterson all rights reserved,
9 Pearu Peterson <pearu@cens.ioc.ee>
10 Permission to use, modify, and distribute this software is given under the
11 terms of the NumPy License.
12
13 NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
14 $Revision: 1.32 $
15 $Date: 2005/01/30 17:22:14 $
16 Pearu Peterson
17
18 """
19 from __future__ import division, print_function
20
21 __version__ = "$Id: setup.py,v 1.32 2005/01/30 17:22:14 pearu Exp $"
22
23 import os
24 import sys
25 from distutils.dep_util import newer
26 from numpy.distutils import log
27 from numpy.distutils.core import setup
28 from numpy.distutils.misc_util import Configuration
29
30 from __version__ import version
31
32 def configuration(parent_package='',top_path=None):
33 config = Configuration('f2py', parent_package, top_path)
34
35 config.add_data_dir('docs')
36 config.add_data_dir('tests')
37
38 config.add_data_files('src/fortranobject.c',
39 'src/fortranobject.h',
40 'f2py.1'
41 )
42
43 config.make_svn_version_py()
44
45 def generate_f2py_py(build_dir):
46 f2py_exe = 'f2py'+os.path.basename(sys.executable)[6:]
47 if f2py_exe[-4:]=='.exe':
48 f2py_exe = f2py_exe[:-4] + '.py'
49 if 'bdist_wininst' in sys.argv and f2py_exe[-3:] != '.py':
50 f2py_exe = f2py_exe + '.py'
51 target = os.path.join(build_dir, f2py_exe)
52 if newer(__file__, target):
53 log.info('Creating %s', target)
54 f = open(target, 'w')
55 f.write('''\
56 #!%s
57 # See http://cens.ioc.ee/projects/f2py2e/
58 import os, sys
59 for mode in ["g3-numpy", "2e-numeric", "2e-numarray", "2e-numpy"]:
60 try:
61 i=sys.argv.index("--"+mode)
62 del sys.argv[i]
63 break
64 except ValueError: pass
65 os.environ["NO_SCIPY_IMPORT"]="f2py"
66 if mode=="g3-numpy":
67 sys.stderr.write("G3 f2py support is not implemented, yet.\\n")
68 sys.exit(1)
69 elif mode=="2e-numeric":
70 from f2py2e import main
71 elif mode=="2e-numarray":
72 sys.argv.append("-DNUMARRAY")
73 from f2py2e import main
74 elif mode=="2e-numpy":
75 from numpy.f2py import main
76 else:
77 sys.stderr.write("Unknown mode: " + repr(mode) + "\\n")
78 sys.exit(1)
79 main()
80 '''%(sys.executable))
81 f.close()
82 return target
83
84 config.add_scripts(generate_f2py_py)
85
86 log.info('F2PY Version %s', config.get_version())
87
88 return config
89
90 if __name__ == "__main__":
91
92 config = configuration(top_path='')
93 version = config.get_version()
94 print('F2PY Version', version)
95 config = config.todict()
96
97 if sys.version[:3]>='2.3':
98 config['download_url'] = "http://cens.ioc.ee/projects/f2py2e/2.x"\
99 "/F2PY-2-latest.tar.gz"
100 config['classifiers'] = [
101 'Development Status :: 5 - Production/Stable',
102 'Intended Audience :: Developers',
103 'Intended Audience :: Science/Research',
104 'License :: OSI Approved :: NumPy License',
105 'Natural Language :: English',
106 'Operating System :: OS Independent',
107 'Programming Language :: C',
108 'Programming Language :: Fortran',
109 'Programming Language :: Python',
110 'Topic :: Scientific/Engineering',
111 'Topic :: Software Development :: Code Generators',
112 ]
113 setup(version=version,
114 description = "F2PY - Fortran to Python Interface Generaton",
115 author = "Pearu Peterson",
116 author_email = "pearu@cens.ioc.ee",
117 maintainer = "Pearu Peterson",
118 maintainer_email = "pearu@cens.ioc.ee",
119 license = "BSD",
120 platforms = "Unix, Windows (mingw|cygwin), Mac OSX",
121 long_description = """\
122 The Fortran to Python Interface Generator, or F2PY for short, is a
123 command line tool (f2py) for generating Python C/API modules for
124 wrapping Fortran 77/90/95 subroutines, accessing common blocks from
125 Python, and calling Python functions from Fortran (call-backs).
126 Interfacing subroutines/data from Fortran 90/95 modules is supported.""",
127 url = "http://cens.ioc.ee/projects/f2py2e/",
128 keywords = ['Fortran', 'f2py'],
129 **config)