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 First
    69: #line 339 "iscr.pak"
    70: # first a hack to help bootstrapping work
    71: # if any of the variable in the second section don't exist.
    72: # then the at least some value is set in the generated code.
    73: # Iterated bootstrapping should eventually fix the problem.
    74: 
    75:   buildno=0
    76:   version=0
    77:   hostname="unknown"
    78:   username="unknown"
    79:   buildtime="unknown"
    80:   generator_buildno=0
    81:   generator_hostname="unknown"
    82:   generator_username="unknown"
    83:   generator_version="unknown"
    84:   generator_buildtime="unknown"
    85: 
    86: # now the real data
    87:   buildno=41
    88:   version='1.0a11'
    89:   hostname='pelican'
    90:   username='root'
    91:   buildtime='Mon Jun 18, 2001 at 01:17 PM (UTC)'
    92:   generator_buildno=40
    93:   generator_hostname='pelican'
    94:   generator_username='root'
    95:   generator_version='1.0a11'
    96:   generator_buildtime='Mon Jun 18, 2001 at 01:03 PM (UTC)'
    97: 
    98: # now define a routine to print the current version information
    99: # wrapped in try/except clause in case any of the variables didn't get set
   100: def print_version_info():
   101:   try:
   102:     print 'Interscript version',global_frame.version,
   103:     print 'build',global_frame.buildno
   104:     print 'Built by',global_frame.username,
   105:     print 'on',global_frame.hostname,
   106:     print 'at',global_frame.buildtime
   107:     print 'Generated by',global_frame.generator_version,
   108:     print 'buildno',global_frame.generator_buildno,
   109:     print 'host',global_frame.generator_hostname
   110:     print 'at',global_frame.buildtime
   111:   except: pass
   112: #line 384 "iscr.pak"
   113: # This is a utility function that makes it easy to use interscript
   114: # givem options in a standard form. The arguments are a list as
   115: # would be entered on a unix or nt command line.
   116: # Mac (or Tkinter) users can create a GUI interface to set the options
   117: # and then call this function to run interscript.
   118: 
   119: def run_from_options(arguments):
   120:   from interscript.getframes import getoption_frames
   121:   from interscript.frames.processf import process_frame
   122:   process_options, master_options = getoption_frames(arguments)
   123:   process = process_frame(global_frame, process_options, master_options)
   124:   process.run()
   125:   del process
   126: 
End python section to interscript/__init__.py[3]