{"action":"created","issue":{"url":"https://api.github.com/repos/conda/conda-build/issues/560","labels_url":"https://api.github.com/repos/conda/conda-build/issues/560/labels{/name}","comments_url":"https://api.github.com/repos/conda/conda-build/issues/560/comments","events_url":"https://api.github.com/repos/conda/conda-build/issues/560/events","html_url":"https://github.com/conda/conda-build/issues/560","id":103690760,"number":560,"title":"Idea: More robust detection of Visual Studio","user":{"login":"ikalev","id":3067425,"avatar_url":"https://avatars.githubusercontent.com/u/3067425?v=3","gravatar_id":"","url":"https://api.github.com/users/ikalev","html_url":"https://github.com/ikalev","followers_url":"https://api.github.com/users/ikalev/followers","following_url":"https://api.github.com/users/ikalev/following{/other_user}","gists_url":"https://api.github.com/users/ikalev/gists{/gist_id}","starred_url":"https://api.github.com/users/ikalev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ikalev/subscriptions","organizations_url":"https://api.github.com/users/ikalev/orgs","repos_url":"https://api.github.com/users/ikalev/repos","events_url":"https://api.github.com/users/ikalev/events{/privacy}","received_events_url":"https://api.github.com/users/ikalev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-28T10:09:36Z","updated_at":"2015-09-12T00:14:22Z","closed_at":null,"body":"I'm looking into the source code of ``conda_build.windows.msvc_env_cmd()``:\r\n\r\n  https://github.com/conda/conda-build/blob/master/conda_build/windows.py#L56\r\n\r\nI've just implemented something similar, not realizing that such functionality already exists in ``conda-build`` (this is something worth mentioning in the documentation by the way). The only thing that concerns me a bit is ``msvc_env_cmd()`` assumes that Visual Studio is installed in Program Files rather than getting it from the registry. Perhaps you can refactor that by relying on ``setuptools``:\r\n\r\n```python\r\nfrom distutils.msvc9compiler import VERSION, PLAT_TO_VCVARS, get_platform\r\nfrom setuptools.msvc9_support import find_vcvarsall\r\n\r\nvc = find_vcvarsall(VERSION)\r\nplat = PLAT_TO_VCVARS[get_platform()]\r\n\r\nheader = 'call \"{vc}\" {plat}\".format(vc=vc, plat=plat)\r\n```\r\n\r\nThis code gives you the full path to ``vcvarsall.bat`` matching the version of the current Python interpreter and its ``plat`` argument. The generated ``header`` can be inserted in ``bld.bat``. It needs to be executed using ``%PYTHON%`` to produce correct results as it decides what version of Visual Studio to look for based on the version of the current interpreter.\r\n"},"comment":{"url":"https://api.github.com/repos/conda/conda-build/issues/comments/139691092","html_url":"https://github.com/conda/conda-build/issues/560#issuecomment-139691092","issue_url":"https://api.github.com/repos/conda/conda-build/issues/560","id":139691092,"user":{"login":"Korijn","id":1882046,"avatar_url":"https://avatars.githubusercontent.com/u/1882046?v=3","gravatar_id":"","url":"https://api.github.com/users/Korijn","html_url":"https://github.com/Korijn","followers_url":"https://api.github.com/users/Korijn/followers","following_url":"https://api.github.com/users/Korijn/following{/other_user}","gists_url":"https://api.github.com/users/Korijn/gists{/gist_id}","starred_url":"https://api.github.com/users/Korijn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Korijn/subscriptions","organizations_url":"https://api.github.com/users/Korijn/orgs","repos_url":"https://api.github.com/users/Korijn/repos","events_url":"https://api.github.com/users/Korijn/events{/privacy}","received_events_url":"https://api.github.com/users/Korijn/received_events","type":"User","site_admin":false},"created_at":"2015-09-12T00:14:22Z","updated_at":"2015-09-12T00:14:22Z","body":":+1:"}}