X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=secnet.git;a=blobdiff_plain;f=make-secnet-sites;fp=make-secnet-sites;h=aa503440d6b3555a60df0591aafe19ae4e958a15;hp=0c19a78c35815ee11519e98bd6e7131a1b8bcfa3;hb=433b0ae83105d91d14c321a9e1369338fe7f7f7d;hpb=6d8cd9b228325a1f49a3e50233e4b0fa96c19529 diff --git a/make-secnet-sites b/make-secnet-sites index 0c19a78..aa50344 100755 --- a/make-secnet-sites +++ b/make-secnet-sites @@ -334,23 +334,22 @@ def pline(i,allow_include=False): "Process a configuration file line" global allow_defs, obstack, root w=string.split(i.rstrip('\n')) - if len(w)==0: return + if len(w)==0: return [i] keyword=w[0] current=obstack[len(obstack)-1] if keyword=='end-definitions': allow_defs=sitelevel.depth obstack=[root] - return + return [i] if keyword=='include': if not allow_include: complain("include not permitted here") - return + return [] if len(w) != 2: complain("include requires one argument") - return + return [] newfile=os.path.join(os.path.dirname(file),w[1]) - pfilepath(newfile,allow_include=allow_include) - return + return pfilepath(newfile,allow_include=allow_include) if levels.has_key(keyword): # We may go up any number of levels, but only down by one newdepth=levels[keyword].depth @@ -381,33 +380,34 @@ def pline(i,allow_include=False): current.children[w[1]]=nl current=nl obstack.append(current) - return + return [i] if current.allow_properties.has_key(keyword): set_property(current,w) - return + return [i] else: complain("Property %s not allowed at %s level"% (keyword,current.type)) - return + return [] complain("unknown keyword '%s'"%(keyword)) def pfilepath(pathname,allow_include=False): f=open(pathname) - lines=f.readlines() - pfile(pathname,lines,allow_include=allow_include) + outlines=pfile(pathname,f.readlines(),allow_include=allow_include) f.close() - return lines + return outlines def pfile(name,lines,allow_include=False): "Process a file" global file,line file=name line=0 + outlines=[] for i in lines: line=line+1 if (i[0]=='#'): continue - pline(i,allow_include=allow_include) + outlines += pline(i,allow_include=allow_include) + return outlines def outputsites(w): "Output include file for secnet configuration"