#! /usr/bin/env autox import sys import os from auto.parseC import parseC from auto.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])