ó
"j]c           @   sh  d  Z  d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l	 m
 Z
 d d l m Z d d l m Z d d l m Z d d	 l m Z d d l Z d
 d l m Z m Z m Z m Z d
 d l m Z d
 d l m Z d
 d l m Z d
 d l m Z d
 d l m  Z! e j" Z" e j# Z# d Z$ d „  Z% d „  Z& d e f d „  ƒ  YZ' d S(   sI   
Create a wheel (.whl) distribution.

A wheel is a built archive format.
iÿÿÿÿN(   t	   Generator(   t   Command(   t   get_python_version(   t   log(   t   iglob(   t   rmtree(   t   warni   (   t   get_abbr_implt   get_impl_vert   get_abi_tagt   get_platform(   t   write_pkg_info(   t   pkginfo_to_metadata(   t	   WheelFile(   t
   pep425tags(   t   __version__s   cp3\dc         C   s   t  |  ƒ j d d ƒ S(   Nt   -t   _(   t	   safe_namet   replace(   t   name(    (    s2   /tmp/pip-install-MqWfHP/wheel/wheel/bdist_wheel.pyt
   safer_name#   s    c         C   s   t  |  ƒ j d d ƒ S(   NR   R   (   t   safe_versionR   (   t   version(    (    s2   /tmp/pip-install-MqWfHP/wheel/wheel/bdist_wheel.pyt   safer_version'   s    t   bdist_wheelc           B   sã   e  Z d  Z d, d d d e ƒ  f d d d	 d
 f d- d/ d0 d1 d2 d3 d d. d e ƒ  d f d4 d5 g Z d d d d g Z d! „  Z d" „  Z	 e
 d# „  ƒ Z d$ „  Z d% „  Z d& e d' d( „ Z d) „  Z e
 d* „  ƒ Z d+ „  Z RS(6   s   create a wheel distributions
   bdist-dir=t   bs1   temporary directory for creating the distributions
   plat-name=t   ps;   platform name to embed in generated filenames (default: %s)s	   keep-tempt   ks/   keep the pseudo-installation tree around after s!   creating the distribution archives	   dist-dir=t   ds-   directory to put final built distributions ins
   skip-builds2   skip rebuilding everything (for testing/debugging)t   relatives7   build the archive using relative paths (default: false)s   owner=t   us@   Owner name used when creating a tar file [default: current user]s   group=t   gsA   Group name used when creating a tar file [default: current group]t	   universals'   make a universal wheel (default: false)s   python-tag=s7   Python implementation compatibility tag (default: py%s)i    s   build-number=sq   Build number for this particular version. As specified in PEP-0427, this must start with a digit. [default: None]s   py-limited-api=s?   Python tag (cp32|cp33|cpNN) for abi3 wheel tag (default: false)c         C   s±   d  |  _ d  |  _ d  |  _ d  |  _ d |  _ t |  _ d  |  _ d  |  _	 d  |  _
 d  |  _ t |  _ d  |  _ d  |  _ t |  _ d t ƒ  d |  _ d  |  _ t |  _ t |  _ d  S(   Nt   zipt   pyi    (   t   Nonet	   bdist_dirt   data_dirt	   plat_namet   plat_tagt   formatt   Falset	   keep_tempt   dist_dirt   egginfo_dirt   root_is_puret
   skip_buildR   t   ownert   groupR!   R   t
   python_tagt   build_numbert   py_limited_apit   plat_name_supplied(   t   self(    (    s2   /tmp/pip-install-MqWfHP/wheel/wheel/bdist_wheel.pyt   initialize_optionsU   s$    																c         C   sg  |  j  d  k r< |  j d ƒ j } t j j | d ƒ |  _  n  |  j d |  _ |  j	 d  k	 |  _
 d } |  j d t | | ƒ Œ |  j j ƒ  p˜ |  j j ƒ  |  _ |  j rÑ t j t |  j ƒ rÑ t d t ƒ ‚ n  |  j j d ƒ } d | k r1t j d	 ƒ | d d
 j ƒ  } | j ƒ  d k r1t |  _ q1n  |  j d  k	 rc|  j d
  j ƒ  rct d ƒ ‚ n  d  S(   Nt   bdistt   wheels   .dataR,   R'   R/   s   py-limited-api must match '%s'R!   s=   The [wheel] section is deprecated. Use [bdist_wheel] instead.i   t   1t   truet   yess1   Build tag (build-number) must start with a digit.(   s   dist_dirs	   plat_names
   skip_build(   R:   s   trues   yes(   R%   R$   t   get_finalized_commandt
   bdist_baset   ost   patht   joint   wheel_dist_nameR&   R'   R5   t   set_undefined_optionsR"   t   distributiont   has_ext_modulest   has_c_librariesR.   R4   t   ret   matcht   PY_LIMITED_API_PATTERNt
   ValueErrort   get_option_dictt   loggerR   t   stript   lowert   TrueR!   R3   t   isdigit(   R6   R>   t   need_optionsR9   t   val(    (    s2   /tmp/pip-install-MqWfHP/wheel/wheel/bdist_wheel.pyt   finalize_optionsi   s(    	#c         C   sS   t  |  j j ƒ  ƒ t |  j j ƒ  ƒ f } |  j rF | |  j f 7} n  d j | ƒ S(   s4   Return distribution full name with - replaced with _R   (   R   RD   t   get_nameR   t   get_versionR3   RA   (   R6   t
   components(    (    s2   /tmp/pip-install-MqWfHP/wheel/wheel/bdist_wheel.pyRB   ˆ   s
    	c         C   s›  |  j  r |  j } nH |  j r' d } n6 |  j p6 t ƒ  } | d k r] t j d k r] d } n  | j d d ƒ j d d ƒ } |  j r± |  j r– d	 } n	 |  j } | d
 | f } næ t	 ƒ  } t
 ƒ  } | | } |  j rû | | j d ƒ rû |  j } d } n t t ƒ  ƒ j ƒ  } | | | f } t j d |  j  r7| n d  ƒ } |  j sv| | d k svt d | | d f ƒ ‚ n  | | k s—t d j | ƒ ƒ ‚ | S(   Nt   anys   linux-x86_64t   linux_x86_64iÿÿÿt
   linux_i686R   R   t   .s   py2.py3t   nonet   cp3t   abi3t   supplied_platformi    s   %s != %ss)   would build wheel with unsupported tag {}(   s   linux-x86_64s   linux_x86_64(   R5   R'   R.   R
   t   syst   maxsizeR   R!   R2   R   R   R4   t
   startswitht   strR	   RN   R   t   get_supportedR$   t   AssertionErrorR)   (   R6   R'   t   implt   tagt	   impl_namet   impl_vert   abi_tagt   supported_tags(    (    s2   /tmp/pip-install-MqWfHP/wheel/wheel/bdist_wheel.pyt   get_tag‘   s6    										
				-!c         C   s  |  j  d ƒ } d | _ t | _ |  j  d ƒ } t | _ |  j sR |  j d ƒ n  |  j  d d t ƒ} |  j | _	 t | _
 |  j | _ t | _ |  j  d ƒ } t | _ x4 d D], } t | d | t j j |  j | ƒ ƒ q° Wd } t j d k r,t j j t j j |  j d ƒ ƒ } | |  _ |  _ n  t | |  j rAd n d | ƒ t j d |  j ƒ |  j d ƒ |  j ƒ  \ } } }	 d j |  j | | |	 ƒ }
 |  j s°|  j } n$ t j j |  j |  j | j ƒ ƒ } |  j d d ƒ d j t  |  j! j" ƒ  ƒ t# |  j! j$ ƒ  ƒ ƒ } t j j |  j | ƒ } |  j% |  j& | ƒ |  j' | ƒ t j j( |  j) ƒ stt j* |  j) ƒ n  t j j |  j) |
 d ƒ } t+ | d ƒ  } | j, | ƒ Wd  QXt- |  j! d g  ƒ j. d t/ ƒ  | f ƒ |  j0 st j d |  j ƒ |  j1 st2 |  j ƒ qn  d  S(    Nt   build_scriptst   pythont	   build_extt   buildt   installt   reinit_subcommandst   install_scriptst   headerst   scriptst   datat   purelibt   platlibt   install_t    t   nts   ..t   install_purelibt   install_platlibs   installing to %ss   {}-{}-{}-{}t   install_egg_infot   targetR-   s   {}-{}.dist-infos   .whlt   wt
   dist_filesR   s   removing %s(   s   headerss   scriptss   datas   purelibs   platlib(   s   targets   egginfo_dir(3   t   reinitialize_commandt
   executableRO   t   forceR*   t   inplaceR/   t   run_commandR%   t   roott   compilet   warn_dirt   no_ept   setattrR?   R@   RA   R&   R   t   normpatht   install_libbaset   install_libR.   RL   t   infoRk   R)   RB   R   t   _ensure_relativet   install_baseRC   R   RD   RT   R   RU   t   egg2distR-   t   write_wheelfilet   existsR,   t   makedirsR   t   write_filest   getattrt   appendR   R+   t   dry_runR   (   R6   Rl   Rn   Rp   Rr   t   keyt   basedir_observedt   impl_tagRi   R(   t   archive_basenamet   archive_roott   distinfo_dirnamet   distinfo_dirt
   wheel_patht   wf(    (    s2   /tmp/pip-install-MqWfHP/wheel/wheel/bdist_wheel.pyt   run·   sj    								$				s   bdist_wheel (t   )c         C   s>  d d l  m } | ƒ  } d | d <| | d <t |  j ƒ j ƒ  | d <|  j d  k	 re |  j | d <n  |  j ƒ  \ } } } xg | j d ƒ D]V } xM | j d ƒ D]< }	 x3 | j d ƒ D]" }
 d	 j	 | |	 |
 f ƒ | d
 <q¶ Wq  WqŠ Wt
 j j	 | d ƒ } t j d | ƒ t | d ƒ   } t | d d ƒj | ƒ Wd  QXd  S(   Niÿÿÿÿ(   t   Messages   1.0s   Wheel-VersionR    s   Root-Is-Purelibt   BuildRZ   R   t   Tagt   WHEELs   creating %sR   t   maxheaderleni    (   t   email.messageR¤   Rb   R.   RN   R3   R$   Rk   t   splitRA   R?   R@   RL   RŽ   t   openR    t   flatten(   R6   t   wheelfile_baset	   generatorR¤   t   msgR›   Ri   R(   Re   t   abit   platt   wheelfile_patht   f(    (    s2   /tmp/pip-install-MqWfHP/wheel/wheel/bdist_wheel.pyR’   	  s     	

(c         C   sC   t  j j | ƒ \ } } | d d !t  j k r? | | d } n  | S(   Ni    i   (   R?   R@   t
   splitdrivet   sep(   R6   R@   t   drive(    (    s2   /tmp/pip-install-MqWfHP/wheel/wheel/bdist_wheel.pyR     s    c         C   s  |  j  j d ƒ } t ƒ  } t d „  | j d d ƒ d j ƒ  Dƒ ƒ } d | k rx t d t ƒ | j | d d ƒ n  d | k r™ d | k r™ d } n  xf | D]^ } xU t	 | ƒ D]G } | | k r³ t
 j j | ƒ r³ t j d | | ƒ | j | ƒ q³ q³ Wq  W| S(   Nt   metadatac         S   s   h  |  ] } | ’ q S(    (    (   t   .0t   option(    (    s2   /tmp/pip-install-MqWfHP/wheel/wheel/bdist_wheel.pys	   <setcomp>*  s   	 t   license_filesRy   i   t   license_filesE   The "license_file" option is deprecated. Use "license_files" instead.s   LICEN[CS]E*s   COPYING*s   NOTICE*s   AUTHORS*s/   adding license file "%s" (matched pattern "%s")(   Ry   Ry   (   s   LICEN[CS]E*s   COPYING*s   NOTICE*s   AUTHORS*(   RD   RK   t   sett   sortedt   getRª   R   t   DeprecationWarningt   addR   R?   R@   t   isfileRL   RŽ   (   R6   R·   t   filest   patternst   patternR@   (    (    s2   /tmp/pip-install-MqWfHP/wheel/wheel/bdist_wheel.pyt   license_paths%  s     	)	c         C   sâ  d „  } | | ƒ t  j j | ƒ s­ d d l } t  j j t  j j | ƒ d ƒ } | j | ƒ } d | f } | rž t  j j | d ƒ } | d | f 7} n  t | ƒ ‚ n  t  j j | ƒ rä | }	 t	 | | ƒ }
 t  j
 | ƒ n t  j j | d ƒ }	 t	 | |	 ƒ }
 t j | | d	 d
 „  ƒt  j j | d ƒ } t | d ƒ  } | j ƒ  j ƒ  } Wd QX| ss| | ƒ n  t t  j j | d ƒ |
 ƒ xB |  j D]7 } t  j j | ƒ } t j | t  j j | | ƒ ƒ q™W| | ƒ d S(   s:   Convert an .egg-info directory into a .dist-info directoryc         S   sm   t  j j |  ƒ rG t  j j |  ƒ rG t  j j |  ƒ rG t j |  ƒ n" t  j j |  ƒ ri t  j |  ƒ n  d S(   s-   Appropriately delete directory, file or link.N(   R?   R@   R“   t   islinkt   isdirt   shutilR   t   unlink(   R   (    (    s2   /tmp/pip-install-MqWfHP/wheel/wheel/bdist_wheel.pyt   adios?  s    7iÿÿÿÿNs
   *.egg-infos)   Egg metadata expected at %s but not foundi    s-    (%s found - possible misnamed archive file?)s   PKG-INFOt   ignorec         S   s   d d d d h S(   Ns   PKG-INFOs   requires.txts   SOURCES.txts   not-zip-safe(    (   t   xt   y(    (    s2   /tmp/pip-install-MqWfHP/wheel/wheel/bdist_wheel.pyt   <lambda>c  s   	s   dependency_links.txtt   rt   METADATA(   R?   R@   R“   t   globRA   t   dirnamet   basenameRJ   RÁ   R   t   mkdirRÈ   t   copytreeR«   t   readRM   R   RÅ   t   copy(   R6   t   egginfo_patht   distinfo_pathRÊ   RÑ   t   patt   possiblet   errt   altt   pkginfo_patht   pkg_infot   dependency_links_patht   dependency_links_filet   dependency_linkst   license_patht   filename(    (    s2   /tmp/pip-install-MqWfHP/wheel/wheel/bdist_wheel.pyR‘   =  s:    	
!
#(   s
   bdist-dir=R   s1   temporary directory for creating the distribution(   s	   dist-dir=R   s-   directory to put final built distributions inN(   s
   skip-buildNs2   skip rebuilding everything (for testing/debugging)(   s   relativeNs7   build the archive using relative paths (default: false)(   s   owner=R   s@   Owner name used when creating a tar file [default: current user](   s   group=R    sA   Group name used when creating a tar file [default: current group](   s	   universalNs'   make a universal wheel (default: false)(   s   build-number=Nsq   Build number for this particular version. As specified in PEP-0427, this must start with a digit. [default: None](   s   py-limited-api=Ns?   Python tag (cp32|cp33|cpNN) for abi3 wheel tag (default: false)(   t   __name__t
   __module__t   descriptionR
   R$   R   t   user_optionst   boolean_optionsR7   RS   t   propertyRB   Rk   R¢   t   wheel_versionR’   R   RÅ   R‘   (    (    (    s2   /tmp/pip-install-MqWfHP/wheel/wheel/bdist_wheel.pyR   +   sL    
        					&	R	((   t   __doc__R?   RÈ   R_   RG   t   email.generatorR    t   distutils.coreR   t   distutils.sysconfigR   t	   distutilsR   RL   RÑ   R   R   t   warningsR   t   pkg_resourcesR   R   R   R	   R
   t   pkginfoR   R·   R   t	   wheelfileR   Ry   R   Rë   R   R   RI   R   R   R   (    (    (    s2   /tmp/pip-install-MqWfHP/wheel/wheel/bdist_wheel.pyt   <module>   s0   "				