예제 #1
0
 def __init__(self, cfg, sectnm, cnvrts):
     self.children = []
     self._dependencies = ltoc.lTOC(
     )  # the stuff an outer package will need to use me
     self.cfg = cfg
     self.__name__ = 'joe'
     for optnm in cfg.options(sectnm):
         cnvrt = cnvrts.get(optnm, 'getstringlist')
         if cnvrt:
             f = getattr(self, cnvrt, None)
             if f:
                 self.__dict__[optnm] = f(cfg.get(sectnm, optnm))
     if not hasattr(self, 'name'):
         self.name = self.__name__
     print "Initializing", self.__name__
     self.pathprefix = autopath + self.pathprefix
     self.pathprefix.append(os.path.join(pyinsthome, 'support'))
     for z in self.zlib:
         if z in self.cfg.sections():
             self.children.append(z)
         else:
             raise ValueError, "%s - zlib '%s' does not refer to a sections" \
                   % (self.name, z)
     for i in range(len(self.misc)):
         x = self.misc[i]
         if x in self.cfg.sections():
             if self.cfg.get(x, "type") == 'PYZ':
                 self.zlib.append(x)
                 self.misc[i] = None
             self.children.append(x)
     self.misc = filter(None, self.misc)
     self.edit()
     self.toc = ltoc.lTOC()
     for thingie in self.excludes:
         try:
             fltr = tocfilter.makefilter(thingie, self.pathprefix)
         except ValueError:
             print "Warning: '%s' not found - no filter created" % thingie
         else:
             self.toc.addFilter(fltr)
     if self.exstdlib:
         self.toc.addFilter(tocfilter.StdLibFilter())
     if self.extypes:
         self.toc.addFilter(tocfilter.ExtFilter(self.extypes))
     if self.expatterns:
         self.toc.addFilter(tocfilter.PatternFilter(self.expatterns))
예제 #2
0
 def gather(self):
     for script in self.dependencies:
         rsrc = resource.makeresource(script, self.pathprefix)
         if not isinstance(rsrc, resource.scriptresource):
             print "Bug alert - Made %s from %s!" % (rsrc, script)
         self.toc.merge(rsrc.modules)
     logfile.write("lTOC after expanding 'depends':\n")
     pprint.pprint(self.toc.toList(), logfile)
     for thingie in self.includes + self.directories + self.packages:
         rsrc = resource.makeresource(thingie, self.pathprefix)
         ##            if not isinstance(rsrc, resource.pythonresource):
         ##                print "PYZ target %s ignoring include %s" % (self.name, thingie)
         ##            else:
         self.toc.merge(rsrc.contents())
     logfile.write("lTOC after includes, dir, pkgs:\n")
     pprint.pprint(self.toc.toList(), logfile)
     self.toc.addFilter(tocfilter.ExtFilter(['.py', '.pyc', '.pyo'], 1))
     logfile.write("Applying the following filters:\n")
     pprint.pprint(self.toc.filters, logfile)
     self.toc.filter()