def relativize_classpath(classpath, root_dir, followlinks=True):
 def relativize_url(url, root_dir):
  url = (os.path.realpath(url) if followlinks else url)
  root_dir = (os.path.realpath(root_dir) if followlinks else root_dir)
  url_in_bundle = os.path.relpath(url, root_dir)
  if os.path.isdir(url):
   url_in_bundle += u'/'
  return url_in_bundle
 return [relativize_url(url, root_dir) for url in classpath]

def relativize_classpath ( classpath , root_dir , followlinks = True ) : def relativize_url ( url , root_dir ) : url = ( os . path . realpath ( url ) if followlinks else url ) root_dir = ( os . path . realpath ( root_dir ) if followlinks else root_dir ) url_in_bundle = os . path . relpath ( url , root_dir ) if os . path . isdir ( url ) : url_in_bundle += u'/' return url_in_bundle return [ relativize_url ( url , root_dir ) for url in classpath ]
convert into classpath relative to a directory .