Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/mingw32/Python27/Lib/site-packages/numpy/f2py/__init__.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 from __future__ import division, absolute_import, print_function | |
3 | |
4 __all__ = ['run_main', 'compile', 'f2py_testing'] | |
5 | |
6 import os | |
7 import sys | |
8 import subprocess | |
9 | |
10 from . import f2py2e | |
11 from . import f2py_testing | |
12 from . import diagnose | |
13 | |
14 from .info import __doc__ | |
15 | |
16 run_main = f2py2e.run_main | |
17 main = f2py2e.main | |
18 | |
19 def compile(source, | |
20 modulename = 'untitled', | |
21 extra_args = '', | |
22 verbose = 1, | |
23 source_fn = None | |
24 ): | |
25 ''' Build extension module from processing source with f2py. | |
26 Read the source of this function for more information. | |
27 ''' | |
28 from numpy.distutils.exec_command import exec_command | |
29 import tempfile | |
30 if source_fn is None: | |
31 f = tempfile.NamedTemporaryFile(suffix='.f') | |
32 else: | |
33 f = open(source_fn, 'w') | |
34 | |
35 try: | |
36 f.write(source) | |
37 f.flush() | |
38 | |
39 args = ' -c -m %s %s %s'%(modulename, f.name, extra_args) | |
40 c = '%s -c "import numpy.f2py as f2py2e;f2py2e.main()" %s' % \ | |
41 (sys.executable, args) | |
42 s, o = exec_command(c) | |
43 finally: | |
44 f.close() | |
45 return s | |
46 | |
47 from numpy.testing import Tester | |
48 test = Tester().test | |
49 bench = Tester().bench |