Changeset 412

Show
Ignore:
Timestamp:
Fri Jan 18 12:04:33 2008
Author:
danielevarrazzo
Message:

On Mac OS X dependency paths are turned relative.

Files:

Legend:

Unmodified
Added
Removed
Modified
  • branches/dl/bindepend.py

    r411 r412  
    266 266     #print "I: analyzing", pth  
    267 267     seen[string.upper(nm)] = 1  
      268     for lib, npth in selectImports(pth):  
      269         if seen.get(string.upper(lib),0):  
      270             continue  
      271         lTOC.append((lib, npth, 'BINARY'))  
      272  
      273   return lTOC  
      274  
      275 def selectImports(pth):  
      276     """Return the dependencies of a binary that should be included.  
      277  
      278     Return a list of pairs (name, fullpath)  
      279     """  
      280     rv = []  
    268 281     dlls = getImports(pth)  
    269 282     for lib in dlls:  
    270           #print "I: found", lib  
    271 283         if not iswin and not cygwin:  
    272 284             npth = lib  
     
    279 291             if 'libpython' not in npth and 'Python.framework' not in npth:  
    280 292                 continue  
    281           if seen.get(string.upper(lib),0):  
    282               continue  
    283 293         if npth:  
    284               lTOC.append((lib, npth, 'BINARY'))  
      294             rv.append((lib, npth))  
    284 294         else:  
    285 295             print "E: lib not found:", lib, "dependency of", pth  
    286     return lTOC  
      296  
      297     return rv  
    287 298  
    288 299 def _getImports_ldd(pth):  
     
    355 366     return _bpath  
    356 367  
      368 def fixOsxPaths(moduleName):  
      369     for name, lib in selectImports(moduleName):  
      370         dest = os.path.join("@executable_path", name)  
      371         cmd = "install_name_tool -change %s %s %s" % (lib, dest, moduleName)  
      372         os.system(cmd)  
      373  
    357 374 if __name__ == "__main__":  
    358 375   if len(sys.argv) < 2:  
  • branches/dl/Build.py

    r314 r412  
    299 299     return digest  
    300 300  
    301   def checkCache(fnm, strip, upx):  
    302       if not strip and not upx:  
      301 def checkCache(fnm, strip, upx, fix_paths=1):  
      302     # On darwin a cache is required anyway to keep the libaries  
      303     # with relative install names  
      304     if not strip and not upx and sys.platform != 'darwin':  
    303 305         return fnm  
    304 306     if strip:  
     
    325 327     digest = cacheDigest(fnm)  
    326 328     cachedfile = os.path.join(cachedir, basenm)  
      329     cmd = None  
    327 330     if cache_index.has_key(basenm):  
    328 331         if digest != cache_index[basenm]:  
     
    332 335     if upx:  
    333 336         if strip:  
    334               fnm = checkCache(fnm, 1, 0)  
      337             fnm = checkCache(fnm, 1, 0, fix_paths=0)  
    334 337         cmd = "upx --best -q \"%s\"" % cachedfile  
    335 338     else:  
    336           cmd = "strip \"%s\"" % cachedfile  
      339         if strip:  
      340             cmd = "strip \"%s\"" % cachedfile  
    337 341     shutil.copy2(fnm, cachedfile)  
    338 342     os.chmod(cachedfile, 0755)  
    339       os.system(cmd)  
      343     if cmd: os.system(cmd)  
      344  
      345     if sys.platform == 'darwin' and fix_paths:  
      346         bindepend.fixOsxPaths(cachedfile)  
    340 347  
    341 348     # update cache index