ó
'—^c           @   s£  d  Z  d d l 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 m Z d d l m Z 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 „  Z- d e f d „  ƒ  YZ. d S(   sI   
Create a wheel (.whl) distribution.

A wheel is a built archive format.
iÿÿÿÿN(   t   OrderedDict(   t	   Generator(   t   Command(   t   get_python_version(   t   log(   t   iglob(   t   rmtree(   t   warn(   t   ZIP_DEFLATEDt
   ZIP_STOREDi   (   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(    (    s0   /tmp/pip-build-eiI0Wo/wheel/wheel/bdist_wheel.pyt
   safer_name&   s    c         C   s   t  |  ƒ j d d ƒ S(   NR   R   (   t   safe_versionR   (   t   version(    (    s0   /tmp/pip-build-eiI0Wo/wheel/wheel/bdist_wheel.pyt   safer_version*   s    c         C   s0   t  | d ƒ GHt j | t j ƒ |  | ƒ d  S(   Ni   (   t   strt   ost   chmodt   statt   S_IWRITE(   t   funct   patht   excinfo(    (    s0   /tmp/pip-build-eiI0Wo/wheel/wheel/bdist_wheel.pyt   remove_readonly.   s    t   bdist_wheelc           B   s"  e  Z d  Z e d e f d e f g ƒ Z d1 d d d e d2 ƒ f d	 d
 d d f d3 d4 d5 d6 d7 d8 d d2 d j	 d j
 e ƒ ƒ f d d2 d  e ƒ  d! f d9 d: 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 d0 „  Z RS(;   s   create a wheel distributiont   storedt   deflateds
   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   compression=s6   zipfile compression (one of: {}) (default: 'deflated')s   , 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 |  _ d t ƒ  d |  _ d  |  _ t |  _ t |  _ d  S(   Nt   zipR'   t   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/   t   compressionR   t
   python_tagt   build_numbert   py_limited_apit   plat_name_supplied(   t   self(    (    s0   /tmp/pip-build-eiI0Wo/wheel/wheel/bdist_wheel.pyt   initialize_optionsg   s&    																	c         C   sª  |  j  d  k r< |  j d ƒ j } t j j | d ƒ |  _  n  |  j d |  _ |  j	 d  k	 |  _
 y |  j |  j |  _ Wn) t k
 r  t d j |  j ƒ ƒ ‚ n Xd } |  j d t | | ƒ Œ |  j j ƒ  pÛ |  j j ƒ  |  _ |  j rt j t |  j ƒ rt d t ƒ ‚ n  |  j j d ƒ } d	 | k rtt j d
 ƒ | d	 d j ƒ  } | j ƒ  d k rtt |  _  qtn  |  j! d  k	 r¦|  j! d  j" ƒ  r¦t d ƒ ‚ n  d  S(   Nt   bdistt   wheels   .datas   Unsupported compression: {}R:   R5   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.(   R:   R5   R=   (   RI   RJ   RK   (#   R3   R2   t   get_finalized_commandt
   bdist_baseR   R"   t   joint   wheel_dist_nameR4   R5   RD   t   supported_compressionsR@   t   KeyErrort
   ValueErrorR7   t   set_undefined_optionsR0   t   distributiont   has_ext_modulest   has_c_librariesR<   RC   t   ret   matcht   PY_LIMITED_API_PATTERNt   get_option_dictt   loggerR   t   stript   lowert   TrueR/   RB   t   isdigit(   RE   RM   t   need_optionsRH   t   val(    (    s0   /tmp/pip-build-eiI0Wo/wheel/wheel/bdist_wheel.pyt   finalize_options|   s0    	#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   RT   t   get_nameR   t   get_versionRB   RN   (   RE   t
   components(    (    s0   /tmp/pip-build-eiI0Wo/wheel/wheel/bdist_wheel.pyRO       s
    	c         C   sÆ  |  j  r |  j } nm |  j r' d } n[ |  j rO |  j j d ƒ rO |  j } n t |  j ƒ } | 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 |  j d |  j  rb| n d  ƒ} |  j s¡| | d k s¡t d | | d f ƒ ‚ n  | | k sÂt d j | ƒ ƒ ‚ | S(   Nt   anyt   macosxs   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_64Rh   (   RD   R5   R<   t
   startswithR   R3   t   syst   maxsizeR   R/   RA   R
   R   RC   R   R   R]   R   t   get_supportedR2   t   AssertionErrorR7   (   RE   R5   t   implt   tagt	   impl_namet   impl_vert   abi_tagt   supported_tags(    (    s0   /tmp/pip-build-eiI0Wo/wheel/wheel/bdist_wheel.pyt   get_tag©   s<    										
				-!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, ƒ  } | j- | ƒ Wd  QXt. |  j! d g  ƒ j/ d t0 ƒ  | f ƒ |  j1 s!t j d |  j ƒ |  j2 s!t3 |  j d t4 ƒ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 %st   onerror(   R‚   Rƒ   R„   R…   R†   (   R   R;   (5   t   reinitialize_commandt
   executableR^   t   forceR8   t   inplaceR=   t   run_commandR3   t   roott   compilet   warn_dirt   no_ept   setattrR   R"   RN   R4   R   t   normpatht   install_libbaset   install_libR<   R[   t   infoRz   R7   RO   R,   t   _ensure_relativet   install_baseRS   R   RT   Rc   R   Rd   t   egg2distR;   t   write_wheelfilet   existsR:   t   makedirsR   R@   t   write_filest   getattrt   appendR   R9   t   dry_runR   R$   (   RE   R{   R}   R   R   t   keyt   basedir_observedt   impl_tagRx   R6   t   archive_basenamet   archive_roott   distinfo_dirnamet   distinfo_dirt
   wheel_patht   wf(    (    s0   /tmp/pip-build-eiI0Wo/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   BuildRj   R   t   Tagt   WHEELs   creating %sRŽ   t   maxheaderleni    (   t   email.messageR´   R   R<   R]   RB   R2   Rz   t   splitRN   R   R"   R[   Rž   t   openR   t   flatten(   RE   t   wheelfile_baset	   generatorR´   t   msgR«   Rx   R6   Rt   t   abit   platt   wheelfile_patht   f(    (    s0   /tmp/pip-build-eiI0Wo/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(   RE   R"   t   drive(    (    s0   /tmp/pip-build-eiI0Wo/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(    (    s0   /tmp/pip-build-eiI0Wo/wheel/wheel/bdist_wheel.pys	   <setcomp>I  s   	 t   license_filesRˆ   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")(   Rˆ   Rˆ   (   s   LICEN[CS]E*s   COPYING*s   NOTICE*s   AUTHORS*(   RT   RZ   t   sett   sortedt   getRº   R   t   DeprecationWarningt   addR   R   R"   t   isfileR[   Rž   (   RE   RÇ   t   filest   patternst   patternR"   (    (    s0   /tmp/pip-build-eiI0Wo/wheel/wheel/bdist_wheel.pyt   license_pathsD  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)   (    (    s0   /tmp/pip-build-eiI0Wo/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(    (    s0   /tmp/pip-build-eiI0Wo/wheel/wheel/bdist_wheel.pyt   <lambda>‚  s   	s   dependency_links.txtt   rt   METADATA(   R   R"   R£   t   globRN   t   dirnamet   basenameRR   RÑ   R   t   mkdirRØ   t   copytreeR»   t   readR\   R   RÕ   t   copy(   RE   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(    (    s0   /tmp/pip-build-eiI0Wo/wheel/wheel/bdist_wheel.pyR¡   \  s:    	
!
#(   s
   bdist-dir=R(   s1   temporary directory for creating the distributionN(   s	   dist-dir=R+   s-   directory to put final built distributions in(   s
   skip-buildNs2   skip rebuilding everything (for testing/debugging)(   R,   Ns7   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](   R/   Ns'   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   RP   R   R2   R7   RN   R   t   user_optionst   boolean_optionsRF   Rb   t   propertyRO   Rz   R²   t   wheel_versionR¢   RŸ   RÕ   R¡   (    (    (    s0   /tmp/pip-build-eiI0Wo/wheel/wheel/bdist_wheel.pyR%   4   sX   	         			$		-	R	(/   t   __doc__R   RØ   R   Rp   RW   t   collectionsR    t   email.generatorR   t   distutils.coreR   t   distutils.sysconfigR   t	   distutilsR   R[   Rá   R   R   t   warningsR   t   zipfileR   R	   t   pkg_resourcesR   R
   R   R   R   t   pkginfoR   RÇ   R   t	   wheelfileR   Rˆ   R   Rû   R   R   RY   R   R   R$   R%   (    (    (    s0   /tmp/pip-build-eiI0Wo/wheel/wheel/bdist_wheel.pyt   <module>   s8   "					