File: %40cnvc

package info (click to toggle)
auto-07p 0.9.1%2Bdfsg-7
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 16,200 kB
  • sloc: fortran: 22,644; f90: 19,340; python: 19,045; ansic: 11,116; sh: 1,079; makefile: 618; perl: 339
file content (33 lines) | stat: -rwxr-xr-x 862 bytes parent folder | download | duplicates (3)
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
#! /usr/bin/env python

import sys
import os
sys.path.append(os.path.join(os.environ["AUTO_DIR"],"python"))
from parseC import parseC
from parseH import parseH

# This is the Python syntax for making a script runnable
if __name__ == '__main__':
    input = sys.argv[1]
    output = sys.argv[1]
    if len(sys.argv) > 2:
        output = sys.argv[2]
    c=None
    try:
        h=parseH('h.'+input)
        c=parseC()
    except IOError:
        h=None
    try:
        c=parseC('c.'+input)
    except IOError:
        pass
    if h is not None:
        for k,v in h.items():
            c[k] = v
    elif c is None:
        sys.stderr.write("Neither the c. file nor the h. file exists. Aborting.\n")
        sys.exit(1)
    c.writeFilename('c.'+output,new=True)
    if len(sys.argv) <= 2 and os.path.exists('h.'+sys.argv[1]):
        os.remove('h.'+sys.argv[1])