The code below is tricky to understand. There are three distinct sets of version information: data describing the version being generated, data describing the version doing the generating, and data describing the version which generated the generator.
Python script at the top of this file computes or fixes the version information for the version being generated, that information is bound into the source of the generated version.
When that version is itself used to generated yet another version the data bound into it by the previous generation describes the currently executing version, which is now the generator.
When the version being generated is yet again used to generate another version, the original data now describes the version that generated the version generating the new version.
In order to make it easy to add or change identification attributes, they're initialised to dummy values, in case the generating version doesn't has the same set of values. This is always the case when a new attribute is introduced: the attribute won't make it into the generating version until a second pass is executed and the version being generated itself becomes the generator.
Note that knowing the version that generated the executing version is important for bug tracking, since a problem may be due to a bug in the source for the version, or in the generator which processed it: a bug can persist even when the source is correct for many generations if it is not processed correctly by the generator. Bootstrapped code can be a real nightmare to debug.
54: #line 343 "interscript/src/iscr.pak" 55: # first a hack to help bootstrapping work 56: # if any of the variable in the second section don't exist. 57: # then the at least some value is set in the generated code. 58: # Iterated bootstrapping should eventually fix the problem. 59: 60: buildno=0 61: version=0 62: hostname="unknown" 63: username="unknown" 64: buildtime="unknown" 65: generator_buildno=0 66: generator_hostname="unknown" 67: generator_username="unknown" 68: generator_version="unknown" 69: generator_buildtime="unknown" 70: 71: # now the real data 72: buildno=1302 73: version='1.0a7' 74: hostname='ruby' 75: username='root' 76: buildtime='Thu Nov 12, 1998 at 12:57 PM (UTC)' 77: generator_buildno=1300 78: generator_hostname='ruby' 79: generator_username='root' 80: generator_version='1.0a7' 81: generator_buildtime='Thu Nov 12, 1998 at 12:49 PM (UTC)' 82: 83: # now print the current version information 84: # wrapped in try/except clause in case any of the variables didn't get set 85: try: 86: print 'Interscript version',global_frame.version, 87: print 'build',global_frame.buildno 88: print 'Built by',global_frame.username, 89: print 'on',global_frame.hostname, 90: print 'at',global_frame.buildtime 91: print 'Generated by',global_frame.generator_version, 92: print 'buildno',global_frame.generator_buildno, 93: print 'host',global_frame.generator_hostname 94: print 'at',global_frame.buildtime 95: except: pass 96: 97: # This is a utility function that makes it easy to use interscript 98: # givem options in a standard form. The arguments are a list as 99: # would be entered on a unix or nt command line. 100: # Mac (or Tkinter) users can create a GUI interface to set the options 101: # and then call this function to run interscript. 102: 103: def run_from_options(arguments): 104: from interscript.getframes import getoption_frames 105: from interscript.frames.processf import process_frame 106: process_options, master_options = getoption_frames(arguments) 107: process = process_frame(global_frame, process_options, master_options) 108: process.run() 109: del process 110: