6.15.2. Argument Frame

Just an empty class to hook attributes to.
Start python section to interscript/getframes.py[3 /3 ] Prev
   105: #line 127 "interscript_options.ipk"
   106: class argument_frame:
   107:   def copy(self):
   108:      other = argument_frame()
   109:      other.__dict__ = self.__dict__.copy()
   110:      return other
   111: 
   112: def getoption_frames(args): # note: has side effects!
   113:   parsed =  getopt(args)
   114:   process_options = argument_frame()
   115:   process_options.verbosity = 2
   116:   process_options.logfile = None
   117:   process_options.logfile_mode = None
   118:   process_options.args = args
   119:   master_frames = []
   120: 
   121:   frame = argument_frame()
   122:   frame.echo_input = 0
   123:   frame.update_files = 1
   124:   frame.tabwidth = 8
   125:   frame.verbosity = 2
   126:   frame.download = 'regularly'
   127:   frame.refresh_interval = 28
   128:   frame.usecache = 1
   129:   frame.passes = 1
   130:   frame.weaver_prefix = ''
   131:   frame.tangler_prefix = ''
   132:   frame.weaver_directory= ''
   133:   frame.tangler_directory = ''
   134:   frame.autoweave = []
   135:   frame.useropt = {}
   136:   frame.html_eol = '\n'
   137:   frame.title = 'Anonymous Interscript Document'
   138:   for opts,filename in parsed:
   139:     for opt,value in opts:
   140:       try:
   141:         if opt == 'verbosity': process_options.verbosity = frame.verbosity = int(value)
   142:         elif opt == 'echo_input': frame.echo_input = int(value)
   143:         elif opt == 'v': process_options.verbosity = frame.verbosity = 6
   144:         elif opt == 'noupdate': frame.update_files = 0
   145:         elif opt == 'nocache': frame.usecache = 0
   146:         elif opt == 'nodownload': frame.download = 'never'
   147:         elif opt == 'download': frame.download = 'always'
   148:         elif opt == 'tabwidth': frame.tabwidth = int(value)
   149:         elif opt == 'passes': frame.passes = int(value)
   150:         elif opt == 'weaver': frame.autoweave.append(value)
   151:         elif opt == 'weaver-prefix': frame.weaver_prefix = value
   152:         elif opt == 'title': frame.title = value
   153:         elif opt == 'tangler-prefix': frame.tangler_prefix = value
   154:         elif opt == 'weaver-directory': frame.weaver_directory = value
   155:         elif opt == 'html-eol':
   156:           if sys.platform == 'Win32':
   157:             print 'CRLF kludge ignored for Win32'
   158:             print 'Use on Unix only, to make html files in DOS format'
   159:           else:
   160:             frame.html_eol = '\r\n'
   161:         elif opt == 'tangler-directory': frame.tangler_directory = value
   162:         elif opt == 'homepage':
   163:           print 'http://www.triode.net.au/~skaller/interscript'
   164:         elif opt == 'author':
   165:           print 'mailto:skaller@maxtal.com.au <John Skaller>'
   166:         elif opt == 'copyright':
   167:           print 'Copyright (C)1998 Maxtal P/L Australia'
   168:         elif opt == 'licence':
   169:           print 'Free for any use'
   170:         elif opt == 'executable':
   171:           print sys.executable
   172:         elif opt == 'python-version':
   173:           print sys.version
   174:         elif opt == 'python':
   175:           try:
   176:             if process_options.verbosity>=3:
   177:               print 'Executing python:'
   178:               print value
   179:             exec value
   180:           except:
   181:             print 'Error in python option'
   182:             traceback.print_exc()
   183:         elif opt == 'logfile':
   184:           process_options.logfile = value
   185:           process_options.logfile_mode = 'a'
   186:         elif opt == 'new-logfile':
   187:           process_options.logfile = value
   188:           process_options.logfile_mode = 'w'
   189:         elif opt in ['help', 'usage']:
   190:           print_help()
   191:           print
   192:         else:
   193:           # FIX: all options should be OK (user options?)
   194:           print 'Nonstandard option',opt,'value',value,'accepted as user option'
   195:           frame.useropt[opt]=value
   196:         if process_options.verbosity>=4: print 'Option:',opt,value
   197:       except:
   198:         print 'Warning: Option',opt,'has bad value',value
   199:         prefix = ''
   200:         while opt[0]=='-': prefix = prefix + '-'; opt=opt[1:]
   201:         print_help1(opt)
   202: 
   203:     files = glob.glob( filename)
   204:     for file in files:
   205:       frame.source_prefix, frame.filename = os.path.split(file)
   206:       master_frames.append(frame.copy())
   207:   return process_options, master_frames
   208: 
   209: 
     6: #line 448 "iscr.pak"
     7: 
     8: 
End python section to interscript/core/__init__.py[1]