File: gen.py

package info (click to toggle)
lapackpp 2024.10.26-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,500 kB
  • sloc: cpp: 80,181; ansic: 27,660; python: 4,838; xml: 182; perl: 99; makefile: 53; sh: 23
file content (35 lines) | stat: -rwxr-xr-x 740 bytes parent folder | download
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
#!/usr/bin/env python3
#
# Usage: ./gen.py basenames
# where basenames are like getrf, gesv, posv, ...
#
# Generates wrapper in ../gen, copies to ../src, and attempts to compile.

from __future__ import print_function

import sys
import os

pwd = os.getcwd()

def run( cmd ):
    print( cmd )
    os.system( cmd )
# end

for arg in sys.argv[1:]:
    try:
        gen = '../gen/' + arg + '.cc'
        src = '../src/' + arg + '.cc'
        if (os.path.exists( src )):
            print( src + ' already exists; skipping' )
            continue
        run( './wrapper_gen.py ' + arg )
        run( 'cp ' + gen + ' ' + src )
        os.chdir( '../src' )
        run( 'make ' + arg + '.o' )
    except:
        pass

    os.chdir( pwd )
# end