예제 #1
0
 def __init__(self, cfg, sectnm, cnvrts):
     Target.__init__(self, cfg, sectnm, cnvrts)
     # to use a PYZTarget, you'll need imputil and archive
     archivebuilder.GetCompiled([os.path.join(pyinsthome, 'imputil.py')])
     print "pyinsthome:", pyinsthome
     imputil = resource.makeresource('imputil.py', [pyinsthome])
     self._dependencies.append(imputil)
     archivebuilder.GetCompiled([os.path.join(pyinsthome, 'archive_rt.py')])
     archmodule = resource.makeresource('archive_rt.py', [pyinsthome])
     self._dependencies.merge(archmodule.dependencies())
     self._dependencies.append(archmodule)
     self.toc.addFilter(archmodule)
     self.toc.addFilter(imputil)
     for mod in archmodule.modules:
         self.toc.addFilter(mod)
예제 #2
0
 def __init__(self, cfg, sectnm, cnvrts):
     Target.__init__(self, cfg, sectnm, cnvrts)
     # to use a PYZTarget, you'll need imputil and archive
     archivebuilder.GetCompiled([os.path.join(pyinsthome, 'imputil.py')])
     print "pyinsthome:", pyinsthome
     imputil = resource.makeresource('imputil.py', [pyinsthome])
     self._dependencies.append(imputil)
     archivebuilder.GetCompiled([os.path.join(pyinsthome, 'archive_rt.py')])
     archmodule = resource.makeresource('archive_rt.py', [pyinsthome])
     self._dependencies.merge(archmodule.dependencies())
     self._dependencies.append(archmodule)
     self.toc.addFilter(archmodule)
     self.toc.addFilter(imputil)
     for mod in archmodule.modules:
         self.toc.addFilter(mod)
예제 #3
0
 def gather(self):
     FullExeTarget.gather(self)
     if self.script[0] == 'gen_install.py':
         f = open(self.script[0], 'a')
         for rsrc in self.toc:
             if isinstance(rsrc, resource.binaryresource):
                 nm = os.path.basename(rsrc.path)
                 f.write(mvfile % (nm, nm))
             elif isinstance(rsrc, resource.pythonresource):
                 pass
             elif isinstance(rsrc, resource.zlibresource):
                 pass
             else:
                 f.write(extractfile % (rsrc.name, rsrc.name))
                 if isinstance(rsrc, resource.archiveresource):
                     #did it come with an install script?
                     target = built.get(rsrc.name, None)
                     if target:
                         if hasattr(target, "installscript"):
                             for script in target.installscript:
                                 s = resource.makeresource(
                                     script, self.pathprefix)
                                 txt = open(s.path, 'r').read()
                                 f.write(txt)
         f.close()
예제 #4
0
 def __init__(self, cfg, sectnm, cnvrts):
     CollectTarget.__init__(self, cfg, sectnm, cnvrts)
     archivebuilder.GetCompiled(
         [os.path.join(pyinsthome, 'carchive_rt.py')])
     carchmodule = resource.makeresource('carchive_rt.py', [pyinsthome])
     self._dependencies.merge(carchmodule.dependencies())
     self._dependencies.append(carchmodule)
예제 #5
0
 def gather(self):
     for script in self.script:
         #print "FullExeTarget.gather: script is", repr(script)
         rsrc = resource.makeresource(script, self.pathprefix)
         rsrc = resource.scriptresource(rsrc.name, rsrc.path)
         #print " resource is", repr(rsrc)
         self.toc.merge(rsrc.binaries)
     ArchiveTarget.gather(self)
     if not self.zlib:
         self.toc.merge(rsrc.modules)
     self._dependencies = ltoc.lTOC()
예제 #6
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()
예제 #7
0
 def gather(self):
     for script in self.script:
         #print "FullExeTarget.gather: script is", `script`
         rsrc = resource.makeresource(script, self.pathprefix)
         rsrc = resource.scriptresource(rsrc.name, rsrc.path)
         #print " resource is", `rsrc`
         self.toc.merge(rsrc.binaries)
     ArchiveTarget.gather(self)
     if not self.zlib:
         self.toc.merge(rsrc.modules)
     self._dependencies = ltoc.lTOC()
예제 #8
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()
예제 #9
0
 def gather(self):
     FullExeTarget.gather(self)
     if self.script[0] == 'gen_install.py':
         f = open(self.script[0], 'a')
         for rsrc in self.toc:
             if isinstance(rsrc, resource.binaryresource):
                 nm = os.path.basename(rsrc.path)
                 f.write(mvfile % (nm, nm))
             elif isinstance(rsrc, resource.pythonresource):
                 pass
             elif isinstance(rsrc, resource.zlibresource):
                 pass
             else:
                 f.write(extractfile % (rsrc.name, rsrc.name))
                 if isinstance(rsrc, resource.archiveresource):
                     #did it come with an install script?
                     target = built.get(rsrc.name, None)
                     if target:
                         if hasattr(target, "installscript"):
                             for script in target.installscript:
                                 s = resource.makeresource(script, self.pathprefix)
                                 txt = open(s.path, 'r').read()
                                 f.write(txt)
         f.close()
예제 #10
0
 def __init__(self, cfg, sectnm, cnvrts):
     CollectTarget.__init__(self, cfg, sectnm, cnvrts)
     archivebuilder.GetCompiled([os.path.join(pyinsthome, 'carchive_rt.py')])
     carchmodule = resource.makeresource('carchive_rt.py', [pyinsthome])
     self._dependencies.merge(carchmodule.dependencies())
     self._dependencies.append(carchmodule)
예제 #11
0
 def gather(self):
     if self.support:
         # the bare minimum
         self.toc.merge([resource.makeresource('python20.dll')])
         self.toc.merge([resource.makeresource('exceptions.pyc').asBinary()])
     # zlib, bindepends, misc, trees, destdir
     for i in range(len(self.zlib)):
         # z refers to the section name
         z = self.zlib[i]
         nm = self.cfg.get(z, 'name')
         try:
             self.toc.merge([resource.makeresource(nm, ['.'])])
         except ValueError:
             # zlibs aren't written if they turn out to be empty
             self.zlib[i] = None
     self.zlib = filter(None, self.zlib)
     if self.zlib:
         target = built.get(self.zlib[0], None)
         if target:
             self.toc.merge(target._dependencies)
     for script in self.bindepends:
         rsrc = resource.makeresource(script, self.pathprefix)
         self.toc.merge(rsrc.binaries)
     logfile.write('ltoc after bindepends:\n')
     pprint.pprint(self.toc.toList(), logfile)
     for thingie in self.misc:
         if thingie in self.cfg.sections():
             name = self.cfg.get(thingie, "name")
             typ = self.cfg.get(thingie, "type")
             klass = self._rsrcdict.get(typ, resource.dataresource)
             rsrc = apply(klass, (name, name))
             #now make sure we have the stuff the resource requires
             target = built.get(thingie, None)
             if target:
                 self.toc.merge(target._dependencies)
         else:
             rsrc = resource.makeresource(thingie, self.pathprefix)
         self.toc.merge(rsrc.contents())
     logfile.write('ltoc after misc:\n')
     pprint.pprint(self.toc.toList(), logfile)
     for script in self.script:
         if string.find(script, '.') == -1:
             script = script + '.py'
         rsrc = resource.makeresource(script, self.pathprefix)
         if rsrc.typ == 'm':
             rsrc.typ = 's'
         self.toc.merge([rsrc])
     logfile.write('ltoc after scripts:\n')
     pprint.pprint(self.toc.toList(), logfile)
     for tree in self.trees:
         try:
             rsrc = resource.treeresource('.', tree)
         except ValueError:
             print "tree %s not found" % tree
         else:
             self.toc.merge(rsrc.contents())
     logfile.write('ltoc after trees:\n')
     pprint.pprint(self.toc.toList(), logfile)
     self.toc.addFilter(tocfilter.TypeFilter(['d']))
     logfile.write("Applying the following filters:\n")
     pprint.pprint(self.toc.filters, logfile)
     self.toc.filter()
     #don't dupe stuff in a zlib that's part of this target
     if self.zlib:
         ztoc = ltoc.lTOC()
         for zlibnm in self.zlib:
             target = built.get(zlibnm, None)
             if target:
                 ztoc.merge(target.toc)
         for i in range(len(self.toc)-1, -1, -1):
             rsrc = self.toc[i]
             if isinstance(rsrc, resource.moduleresource) and rsrc in ztoc:
                 del self.toc[i]
예제 #12
0
 def gather(self):
     if self.support:
         # the bare minimum
         self.toc.merge([resource.makeresource('python20.dll')])
         self.toc.merge(
             [resource.makeresource('exceptions.pyc').asBinary()])
     # zlib, bindepends, misc, trees, destdir
     for i in range(len(self.zlib)):
         # z refers to the section name
         z = self.zlib[i]
         nm = self.cfg.get(z, 'name')
         try:
             self.toc.merge([resource.makeresource(nm, ['.'])])
         except ValueError:
             # zlibs aren't written if they turn out to be empty
             self.zlib[i] = None
     self.zlib = filter(None, self.zlib)
     if self.zlib:
         target = built.get(self.zlib[0], None)
         if target:
             self.toc.merge(target._dependencies)
     for script in self.bindepends:
         rsrc = resource.makeresource(script, self.pathprefix)
         self.toc.merge(rsrc.binaries)
     logfile.write('ltoc after bindepends:\n')
     pprint.pprint(self.toc.toList(), logfile)
     for thingie in self.misc:
         if thingie in self.cfg.sections():
             name = self.cfg.get(thingie, "name")
             typ = self.cfg.get(thingie, "type")
             klass = self._rsrcdict.get(typ, resource.dataresource)
             rsrc = apply(klass, (name, name))
             #now make sure we have the stuff the resource requires
             target = built.get(thingie, None)
             if target:
                 self.toc.merge(target._dependencies)
         else:
             rsrc = resource.makeresource(thingie, self.pathprefix)
         self.toc.merge(rsrc.contents())
     logfile.write('ltoc after misc:\n')
     pprint.pprint(self.toc.toList(), logfile)
     for script in self.script:
         if string.find(script, '.') == -1:
             script = script + '.py'
         rsrc = resource.makeresource(script, self.pathprefix)
         if rsrc.typ == 'm':
             rsrc.typ = 's'
         self.toc.merge([rsrc])
     logfile.write('ltoc after scripts:\n')
     pprint.pprint(self.toc.toList(), logfile)
     for tree in self.trees:
         try:
             rsrc = resource.treeresource('.', tree)
         except ValueError:
             print "tree %s not found" % tree
         else:
             self.toc.merge(rsrc.contents())
     logfile.write('ltoc after trees:\n')
     pprint.pprint(self.toc.toList(), logfile)
     self.toc.addFilter(tocfilter.TypeFilter(['d']))
     logfile.write("Applying the following filters:\n")
     pprint.pprint(self.toc.filters, logfile)
     self.toc.filter()
     #don't dupe stuff in a zlib that's part of this target
     if self.zlib:
         ztoc = ltoc.lTOC()
         for zlibnm in self.zlib:
             target = built.get(zlibnm, None)
             if target:
                 ztoc.merge(target.toc)
         for i in range(len(self.toc) - 1, -1, -1):
             rsrc = self.toc[i]
             if isinstance(rsrc, resource.moduleresource) and rsrc in ztoc:
                 del self.toc[i]