~ubuntu-branches/ubuntu/feisty/python-numpy/feisty

« back to all changes in this revision

Viewing changes to numpy/distutils/tests/gen_ext/setup.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-07-12 10:00:24 UTC
  • Revision ID: james.westby@ubuntu.com-20060712100024-5lw9q2yczlisqcrt
Tags: upstream-0.9.8
ImportĀ upstreamĀ versionĀ 0.9.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
fib3_f = '''
 
4
C FILE: FIB3.F
 
5
      SUBROUTINE FIB(A,N)
 
6
C
 
7
C     CALCULATE FIRST N FIBONACCI NUMBERS
 
8
C
 
9
      INTEGER N
 
10
      REAL*8 A(N)
 
11
Cf2py intent(in) n
 
12
Cf2py intent(out) a
 
13
Cf2py depend(n) a
 
14
      DO I=1,N
 
15
         IF (I.EQ.1) THEN
 
16
            A(I) = 0.0D0
 
17
         ELSEIF (I.EQ.2) THEN
 
18
            A(I) = 1.0D0
 
19
         ELSE
 
20
            A(I) = A(I-1) + A(I-2)
 
21
         ENDIF
 
22
      ENDDO
 
23
      END
 
24
C END FILE FIB3.F
 
25
'''
 
26
 
 
27
def source_func(ext, build_dir):
 
28
    import os
 
29
    from distutils.dep_util import newer
 
30
    target = os.path.join(build_dir,'fib3.f')
 
31
    if newer(__file__, target):
 
32
        f = open(target,'w')
 
33
        f.write(fib3_f)
 
34
        f.close()
 
35
    return [target]
 
36
 
 
37
def configuration(parent_package='',top_path=None):
 
38
    from numpy.distutils.misc_util import Configuration
 
39
    config = Configuration('gen_ext',parent_package,top_path)
 
40
    config.add_extension('fib3',
 
41
                         [source_func]
 
42
                         )
 
43
    return config
 
44
 
 
45
if __name__ == "__main__":
 
46
    from numpy.distutils.core import setup
 
47
    setup(**configuration(top_path='').todict())