@staticmethod<EOL><INDENT>def get_tool_dir():<DEDENT>
def _is_comntools(name):<EOL><INDENT>return re.match(r'<STR_LIT>', name.lower())<EOL><DEDENT>def _get_version_from_name(name):<EOL><INDENT>return (re.search(r'<STR_LIT>', name).group(<NUM_LIT:0>), name)<EOL><DEDENT>names = [name for name in os.environ if _is_comntools(name)]<EOL>logging.debug(_('<STR_LIT>'), names)<EOL>versions = [_get_version_from_name(name) for name in names]<EOL>logging.debug(_('<STR_LIT>'), versions)<EOL>try:<EOL><INDENT>version = max(versions)<EOL><DEDENT>except ValueError:<EOL><INDENT>raise OSError(_('<STR_LIT>'<EOL>'<STR_LIT>'))<EOL><DEDENT>else:<EOL><INDENT>logging.info(_('<STR_LIT>'), version)<EOL>vscomntools = os.environ[version[<NUM_LIT:1>]]<EOL>logging.info(_('<STR_LIT>'), vscomntools)<EOL>return vscomntools<EOL><DEDENT>
Get the directory of Visual Studio
from environment variables.