def git_versions_from_vcs(tag_prefix, root, verbose=False):
<EOL>if not os.path.exists(os.path.join(root, "<STR_LIT>")):<EOL><INDENT>if verbose:<EOL><INDENT>print("<STR_LIT>" % root)<EOL><DEDENT>return {}<EOL><DEDENT>GITS = ["<STR_LIT>"]<EOL>if sys.platform == "<STR_LIT:win32>":<EOL><INDENT>GITS = ["<STR_LIT>", "<STR_LIT>"]<EOL><DEDENT>versions = {}<EOL>full_revisionid = run_command(GITS, ["<STR_LIT>", "<STR_LIT>"], cwd=root)<EOL>if full_revisionid is None:<EOL><INDENT>return {}<EOL><DEDENT>versions["<STR_LIT>"] = full_revisionid.strip()<EOL>d = run_command(GITS,<EOL>["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"],<EOL>cwd=root)<EOL>if d is None:<EOL><INDENT>return {}<EOL><DEDENT>d = d.strip()<EOL>versions["<STR_LIT>"] = d<EOL>mo1 = re.search(r"<STR_LIT>", d)<EOL>mo2 = re.search(r"<STR_LIT>", d)<EOL>if mo1:<EOL><INDENT>rawtag = mo1.group(<NUM_LIT:1>)<EOL>if not rawtag.startswith(tag_prefix):<EOL><INDENT>if verbose:<EOL><INDENT>print("<STR_LIT>" % (rawtag, tag_prefix))<EOL><DEDENT>return {}<EOL><DEDENT>tag = rawtag[len(tag_prefix):]<EOL>versions["<STR_LIT>"] = tag<EOL>versions["<STR_LIT>"] = int(mo1.group(<NUM_LIT:2>))<EOL>versions["<STR_LIT>"] = mo1.group(<NUM_LIT:3>)<EOL>versions["<STR_LIT>"] = bool(mo1.group(<NUM_LIT:4>))<EOL>versions["<STR_LIT>"] = tag<EOL>if versions["<STR_LIT>"]:<EOL><INDENT>versions["<STR_LIT>"] = d<EOL>versions["<STR_LIT>"] += "<STR_LIT>" % versions["<STR_LIT>"]<EOL><DEDENT>else:<EOL><INDENT>versions["<STR_LIT>"] = tag<EOL>if versions["<STR_LIT>"]:<EOL><INDENT>versions["<STR_LIT>"] += "<STR_LIT>"<EOL><DEDENT><DEDENT>if versions["<STR_LIT>"]:<EOL><INDENT>versions["<STR_LIT>"] += "<STR_LIT>"<EOL><DEDENT>versions["<STR_LIT:default>"] = versions["<STR_LIT>"]<EOL><DEDENT>elif mo2: <EOL><INDENT>versions["<STR_LIT>"] = None<EOL>versions["<STR_LIT>"] = mo2.group(<NUM_LIT:1>)<EOL>versions["<STR_LIT>"] = bool(mo2.group(<NUM_LIT:2>))<EOL>commits = run_command(GITS, ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>"], cwd=root)<EOL>if commits is None:<EOL><INDENT>return {}<EOL><DEDENT>versions["<STR_LIT>"] = int(commits.strip())<EOL>versions["<STR_LIT>"] = "<STR_LIT:0>"<EOL>if versions["<STR_LIT>"]:<EOL><INDENT>versions["<STR_LIT>"] += "<STR_LIT>" % versions["<STR_LIT>"]<EOL><DEDENT>if versions["<STR_LIT>"]:<EOL><INDENT>versions["<STR_LIT>"] += "<STR_LIT>" <EOL><DEDENT>versions["<STR_LIT>"] = d<EOL>versions["<STR_LIT:default>"] = "<STR_LIT>" % (versions["<STR_LIT>"], d)<EOL><DEDENT>else:<EOL><INDENT>return {}<EOL><DEDENT>versions["<STR_LIT>"] = "<STR_LIT>" if versions["<STR_LIT>"] else "<STR_LIT>"<EOL>versions["<STR_LIT>"] = versions["<STR_LIT>"] or "<STR_LIT:0>"<EOL>if versions["<STR_LIT>"] == <NUM_LIT:0>:<EOL><INDENT>versions["<STR_LIT>"] = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>versions["<STR_LIT>"] = "<STR_LIT>" % versions["<STR_LIT>"]<EOL><DEDENT>return versions<EOL>
Return a dictionary of values derived directly from the VCS. This is the
    third attempt to find information by get_versions().