6.1.2. Set version

This is an experimental release only, intended as an act of advocacy and to solicit comments and support.

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.

Start python section to interscript/__init__.py[3 /3 ] Prev
    64: #line 366 "iscr.pak"
    65: # first a hack to help bootstrapping work
    66: # if any of the variable in the second section don't exist.
    67: # then the at least some value is set in the generated code.
    68: # Iterated bootstrapping should eventually fix the problem.
    69: 
    70:   buildno=0
    71:   version=0
    72:   hostname="unknown"
    73:   username="unknown"
    74:   buildtime="unknown"
    75:   generator_buildno=0
    76:   generator_hostname="unknown"
    77:   generator_username="unknown"
    78:   generator_version="unknown"
    79:   generator_buildtime="unknown"
    80: 
    81: # now the real data
    82:   buildno=1384
    83:   version='1.0a8'
    84:   hostname='ruby'
    85:   username='root'
    86:   buildtime='Mon Nov 30, 1998 at 08:56 AM (UTC)'
    87:   generator_buildno=1383
    88:   generator_hostname='ruby'
    89:   generator_username='root'
    90:   generator_version='1.0a8'
    91:   generator_buildtime='Mon Nov 30, 1998 at 05:02 AM (UTC)'
    92: 
    93: # now print the current version information
    94: # wrapped in try/except clause in case any of the variables didn't get set
    95: try:
    96:   print 'Interscript version',global_frame.version,
    97:   print 'build',global_frame.buildno
    98:   print 'Built by',global_frame.username,
    99:   print 'on',global_frame.hostname,
   100:   print 'at',global_frame.buildtime
   101:   print 'Generated by',global_frame.generator_version,
   102:   print 'buildno',global_frame.generator_buildno,
   103:   print 'host',global_frame.generator_hostname
   104:   print 'at',global_frame.buildtime
   105: except: pass
   106: 
   107: # This is a utility function that makes it easy to use interscript
   108: # givem options in a standard form. The arguments are a list as
   109: # would be entered on a unix or nt command line.
   110: # Mac (or Tkinter) users can create a GUI interface to set the options
   111: # and then call this function to run interscript.
   112: 
   113: def run_from_options(arguments):
   114:   from interscript.getframes import getoption_frames
   115:   from interscript.frames.processf import process_frame
   116:   process_options, master_options = getoption_frames(arguments)
   117:   process = process_frame(global_frame, process_options, master_options)
   118:   process.run()
   119:   del process
   120: 
End python section to interscript/__init__.py[3]