

def relativize_classpath(classpath, root_dir, followlinks=True):
    'Convert into classpath relative to a directory.\n\n  This is eventually used by a jar file located in this directory as its manifest\n  attribute Class-Path. See\n  https://docs.oracle.com/javase/7/docs/technotes/guides/extensions/spec.html#bundled\n\n  :param list classpath: Classpath to be relativized.\n  :param string root_dir: directory to relativize urls in the classpath, does not\n    have to exist yet.\n  :param bool followlinks: whether to follow symlinks to calculate relative path.\n\n  :returns: Converted classpath of the same size as input classpath.\n  :rtype: list of strings\n  '

    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 += '/'
        return url_in_bundle
    return [relativize_url(followlinks, root_dir) for url in classpath]

dataset/ETHPy150Open pantsbuild/pants/src/python/pants/java/util.py relativize_classpath/VarMisuse@101/364 `url`->`followlinks`