Example #1
0
 def assemble(self):
     print "building PKG", os.path.basename(self.name)
     trash = []
     mytoc = []
     toc = TOC()
     for item in self.toc:
         inm, fnm, typ = item
         if typ == 'EXTENSION':
             binext = os.path.splitext(fnm)[1]
             if not os.path.splitext(inm)[1] == binext:
                 inm = inm + binext
         toc.append((inm, fnm, typ))
     seen = {}
     for inm, fnm, typ in toc:
         if typ in ('BINARY', 'EXTENSION'):
             if self.exclude_binaries:
                 self.dependencies.append((inm, fnm, typ))
             else:
                 fnm = checkCache(
                     fnm, self.strip_binaries, self.upx_binaries
                     and (iswin or cygwin) and config['hasUPX'])
                 # Avoid importing the same binary extension twice. This might
                 # happen if they come from different sources (eg. once from
                 # binary dependence, and once from direct import).
                 if typ == 'BINARY' and seen.has_key(fnm):
                     continue
                 seen[fnm] = 1
                 mytoc.append((inm, fnm, self.cdict.get(typ, 0),
                               self.xformdict.get(typ, 'b')))
         elif typ == 'OPTION':
             mytoc.append((inm, '', 0, 'o'))
         else:
             mytoc.append((inm, fnm, self.cdict.get(typ, 0),
                           self.xformdict.get(typ, 'b')))
     archive = carchive.CArchive()
     archive.build(self.name, mytoc)
     outf = open(self.out, 'w')
     pprint.pprint((self.name, self.cdict, self.toc, self.exclude_binaries,
                    self.strip_binaries, self.upx_binaries), outf)
     outf.close()
     for item in trash:
         os.remove(item)
     return 1
Example #2
0
 def assemble(self):
     print "building PKG", os.path.basename(self.name)
     trash = []
     mytoc = []
     toc = TOC()
     for item in self.toc:
         inm, fnm, typ = item
         if typ == 'EXTENSION':
             binext = os.path.splitext(fnm)[1]
             if not os.path.splitext(inm)[1] == binext:
                 inm = inm + binext
         toc.append((inm, fnm, typ))
     seen = {}
     for inm, fnm, typ in toc:
         if typ in ('BINARY', 'EXTENSION'):
             if self.exclude_binaries:
                 self.dependencies.append((inm, fnm, typ))
             else:
                 fnm = checkCache(fnm, self.strip_binaries,
                                  self.upx_binaries and ( iswin or cygwin )
                                   and config['hasUPX'])
                 # Avoid importing the same binary extension twice. This might
                 # happen if they come from different sources (eg. once from
                 # binary dependence, and once from direct import).
                 if typ == 'BINARY' and seen.has_key(fnm):
                     continue
                 seen[fnm] = 1
                 mytoc.append((inm, fnm, self.cdict.get(typ,0),
                               self.xformdict.get(typ,'b')))
         elif typ == 'OPTION':
             mytoc.append((inm, '', 0, 'o'))
         else:
             mytoc.append((inm, fnm, self.cdict.get(typ,0), self.xformdict.get(typ,'b')))
     archive = carchive.CArchive()
     archive.build(self.name, mytoc)
     outf = open(self.out, 'w')
     pprint.pprint((self.name, self.cdict, self.toc, self.exclude_binaries, self.strip_binaries, self.upx_binaries), outf)
     outf.close()
     for item in trash:
         os.remove(item)
     return 1
Example #3
0
 def assemble(self):
     print "building PKG", os.path.basename(self.name)
     trash = []
     mytoc = []
     toc = TOC()
     for item in self.toc:
         inm, fnm, typ = item
         if typ == 'EXTENSION':
             inm = fixextension(inm, fnm)
         toc.append((inm, fnm, typ))
     for inm, fnm, typ in toc:
         if typ in ('BINARY', 'EXTENSION', 'LINK'):
             if self.exclude_binaries:
                 self.dependencies.append((inm, fnm, typ))
             elif typ == 'LINK':
                 mytoc.append((fnm + ':' + inm, '', 0, 'l'))
             else:
                 fnm = checkCache(
                     fnm, self.strip_binaries, self.upx_binaries
                     and (iswin or cygwin) and config['hasUPX'])
                 mytoc.append((inm, fnm, self.cdict.get(typ, 0),
                               self.xformdict.get(typ, 'b')))
         elif typ == 'OPTION':
             mytoc.append((inm, '', 0, 'o'))
         else:
             mytoc.append((inm, fnm, self.cdict.get(typ, 0),
                           self.xformdict.get(typ, 'b')))
     archive = carchive.CArchive()
     archive.build(self.name, mytoc)
     outf = open(self.out, 'w')
     pprint.pprint((self.name, self.cdict, self.toc, self.exclude_binaries,
                    self.strip_binaries, self.upx_binaries), outf)
     outf.close()
     for item in trash:
         os.remove(item)
     return 1
Example #4
0
#!/usr/local/bin/python2
from archive import build
build()