def mac_set_relative_dylib_deps(libname, distname):
 from PyInstaller.lib.macholib import util
 from PyInstaller.lib.macholib.MachO import MachO
 if (os.path.basename(libname) in _BOOTLOADER_FNAMES):
  return
 parent_dir = ''
 if os.path.dirname(distname):
  parent_level = len(os.path.dirname(distname).split(os.sep))
  parent_dir = (parent_level * (os.pardir + os.sep))
 def match_func(pth):
  '\n        For system libraries is still used absolute path. It is unchanged.\n        '
  if (not util.in_system_path(pth)):
   return os.path.join('@loader_path', parent_dir, os.path.basename(pth))
 dll = MachO(libname)
 dll.rewriteLoadCommands(match_func)
 try:
  f = open(dll.filename, 'rb+')
  for header in dll.headers:
   f.seek(0)
   dll.write(f)
  f.seek(0, 2)
  f.flush()
  f.close()
 except Exception:
  pass

def mac_set_relative_dylib_deps ( libname , distname ) : from PyInstaller . lib . macholib import util from PyInstaller . lib . macholib . MachO import MachO if ( os . path . basename ( libname ) in _BOOTLOADER_FNAMES ) : return parent_dir = '' if os . path . dirname ( distname ) : parent_level = len ( os . path . dirname ( distname ) . split ( os . sep ) ) parent_dir = ( parent_level * ( os . pardir + os . sep ) ) def match_func ( pth ) : if ( not util . in_system_path ( pth ) ) : return os . path . join ( '@loader_path' , parent_dir , os . path . basename ( pth ) ) dll = MachO ( libname ) dll . rewriteLoadCommands ( match_func ) try : f = open ( dll . filename , 'rb+' ) for header in dll . headers : f . seek ( 0 ) dll . write ( f ) f . seek ( 0 , 2 ) f . flush ( ) f . close ( ) except Exception : pass
on mac os x set relative paths to dynamic library dependencies of libname .