
`@_                 @   sV   y d  d l  Z Wn e k
 r$ Yn Xe   Z d d   Z d d   Z d d   Z d S)    Nc               C   sO   d t    k r d St r d St j t t j   t t j _ t t j _ d S)z
    Patch functions in distutils.msvc9compiler to use the standalone compiler
    build for Python (Windows only). Fall back to original behavior when the
    standalone compiler is not available.
    	distutilsN)globals	unpatchedupdatevarsr   msvc9compilerfind_vcvarsallquery_vcvarsall r
   r
   >/tmp/pip-build-tw3_dw7d/setuptools/setuptools/msvc9_support.pypatch_for_specialized_compiler   s    r   c             C   s   t  j j } d } | d |  f } y | j | d  } WnS t k
 r y& | d |  f } | j | d  } Wn t k
 r d  } Yn XYn X| r d d  l } | j j | d  } | j j |  r | St	 d |   S)Nz-Software\%sMicrosoft\DevDiv\VCForPython\%0.1f Z
installdirzWow6432Node\r   zvcvarsall.batr   )
r   r   Reg	get_valueKeyErrorospathjoinisfiler   )versionr   ZVC_BASEkeyZ
productdirr   Z	vcvarsallr
   r
   r   r      s"    r   c             O   s   y t  d |  | |  SWn t j j k
 r } zr | r d | j d k r d |  | j d f } t |   d k r t j j | d   t j j |     WYd  d  } ~ Xn Xd  S)Nr	   zvcvarsall.batr   z,Microsoft Visual C++ %0.1f is required (%s).	   z% Get it from http://aka.ms/vcpython27)r   r   errorsDistutilsPlatformErrorargsint)r   r   kwargsexcmessager
   r
   r   r	   2   s    	r	   )Zdistutils.msvc9compilerr   	Exceptiondictr   r   r   r	   r
   r
   r
   r   <module>   s   	