109: #line 121 "interscript_options.ipk"
110: class argument_frame:
111: def copy(self):
112: other = argument_frame()
113: other.__dict__ = self.__dict__.copy()
114: return other
115:
116: def getoption_frames(args):
117: parsed = getopt(args)
118: process_options = argument_frame()
119: process_options.logfile = None
120: process_options.logfile_mode = None
121: process_options.break_on_error = 0
122: process_options.args = args
123: process_options.trace = []
124: master_frames = []
125:
126: frame = argument_frame()
127: frame.update_files = 1
128: frame.tabwidth = 8
129: frame.download = 'regularly'
130: frame.refresh_interval = 28
131: frame.usecache = 1
132: frame.passes = 1
133: frame.weaver_prefix = ''
134: frame.tangler_prefix = ''
135: frame.weaver_directory= ''
136: frame.tangler_directory = ''
137: frame.autoweave = []
138: frame.useropt = {}
139: frame.encoding='utf8'
140: frame.html_eol = '\n'
141: frame.title = None
142: frame.languages = []
143: for opts,filename in parsed:
144: for opt,value in opts:
145: try:
146: if opt == 'break-on-error': process_options.break_on_error=1
147: elif opt == 'v': process_options.trace = [
148: 'options',
149: 'frames',
150: 'input',
151: 'weavers',
152: 'tanglers',
153: 'lines',
154: 'sources',
155: 'sinks',
156: 'script',
157: 'cache',
158: 'deps']
159: elif opt == 'noupdate': frame.update_files = 0
160: elif opt == 'nocache': frame.usecache = 0
161: elif opt == 'nodownload': frame.download = 'never'
162: elif opt == 'download': frame.download = 'always'
163: elif opt == 'tabwidth': frame.tabwidth = int(value)
164: elif opt == 'passes': frame.passes = int(value)
165: elif opt == 'weaver': frame.autoweave.append(value)
166: elif opt == 'weaver-prefix': frame.weaver_prefix = value
167: elif opt == 'title': frame.title = value
168: elif opt == 'tangler-prefix': frame.tangler_prefix = value
169: elif opt == 'weaver-directory': frame.weaver_directory = value
170: elif opt == 'weaver-directory': frame.weaver_directory = value
171: elif opt == 'language': frame.languages.append(value)
172: elif opt == 'encoding': frame.encoding=value
173: elif opt == 'trace': process_options.trace.append(value)
174: elif opt == 'html-eol':
175: if sys.platform == 'Win32':
176: print 'CRLF kludge ignored for Win32'
177: print 'Use on Unix only, to make html files in DOS format'
178: else:
179: frame.html_eol = '\r\n'
180: elif opt == 'tangler-directory': frame.tangler_directory = value
181: elif opt == 'homepage':
182: print 'http://www.triode.net.au/~skaller/interscript'
183: elif opt == 'author':
184: print 'mailto:skaller@maxtal.com.au <John Skaller>'
185: elif opt == 'copyright':
186: print 'Copyright (C)1998 Maxtal P/L Australia'
187: elif opt == 'licence':
188: print 'Free for any use'
189: elif opt == 'executable':
190: print sys.executable
191: elif opt == 'python-version':
192: print sys.version
193: elif opt == 'python':
194: try:
195: if 'script' in process_options.trace:
196: print 'Executing python:'
197: print value
198: exec value
199: except:
200: print 'Error in python option'
201: traceback.print_exc()
202: elif opt == 'logfile':
203: process_options.logfile = value
204: process_options.logfile_mode = 'a'
205: elif opt == 'new-logfile':
206: process_options.logfile = value
207: process_options.logfile_mode = 'w'
208: elif opt in ['help', 'usage']:
209: print_help()
210: print
211: else:
212:
213: print 'Nonstandard option',opt,'value',value,'accepted as user option'
214: frame.useropt[opt]=value
215: if 'options' in process_options.trace: print 'Option:',opt,value
216: except:
217: print 'Warning: Option',opt,'has bad value',value
218: prefix = ''
219: while opt[0]=='-': prefix = prefix + '-'; opt=opt[1:]
220: print_help1(opt)
221:
222: files = glob.glob( filename)
223: for file in files:
224: frame.source_prefix, frame.filename = os.path.split(file)
225: if frame.source_prefix != '':
226: frame.source_prefix = frame.source_prefix + os.sep
227: master_frames.append(frame.copy())
228: return process_options, master_frames
229:
230: