code: def generate(env):
      
      global PSAction
      if PSAction is None:
          PSAction = SCons.Action.Action('$PSCOM', '$PSCOMSTR')
  
      global DVIPSAction
      if DVIPSAction is None:
          DVIPSAction = SCons.Action.Action(DviPsFunction, strfunction = DviPsStrFunction)
  
      global PSBuilder
      if PSBuilder is None:
          PSBuilder = SCons.Builder.Builder(action = PSAction,
                                            prefix = '$PSPREFIX',
                                            suffix = '$PSSUFFIX',
                                            src_suffix = '.dvi',
                                            src_builder = 'DVI',
                                            single_source=True)
  
      env['BUILDERS']['PostScript'] = PSBuilder
      
      env['DVIPS']      = 'dvips'
      env['DVIPSFLAGS'] = SCons.Util.CLVar('')
      # I'm not quite sure I got the directories and filenames right for variant_dir
      # We need to be in the correct directory for the sake of latex \includegraphics eps included files.
      env['PSCOM']      = 'cd ${TARGET.dir} && $DVIPS $DVIPSFLAGS -o ${TARGET.file} ${SOURCE.file}'
      env['PSPREFIX'] = ''
      env['PSSUFFIX'] = '.ps'
docs: Add Builders and construction variables for dvips to an Environment.