def get_version_from_build()

in ccmlib/dse/dse_node.py [0:0]


    def get_version_from_build(install_dir=None, node_path=None, cassandra=False):
        if install_dir is None and node_path is not None:
            install_dir = node.get_install_dir_from_cluster_conf(node_path)
        if install_dir is not None:
            # Binary cassandra installs will have a 0.version.txt file
            version_file = os.path.join(install_dir, '0.version.txt')
            if os.path.exists(version_file):
                with open(version_file) as f:
                    return LooseVersion(f.read().strip())
            # For DSE look for a dse*.jar and extract the version number
            dse_version = get_dse_version(install_dir)
            if (dse_version is not None):
                if cassandra:
                    from ccmlib.dse.dse_cluster import get_dse_cassandra_version
                    return get_dse_cassandra_version(install_dir)
                else:
                    return LooseVersion(dse_version)
        raise common.CCMError("Cannot find version")