ó
Ð²Ebc           @   s¢  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z y d d l j Z Wn e	 k
 rt d d l
 Z n Xy d d l m Z Wn! e	 k
 r¬ d d l m Z n Xd d l m Z d d l m Z m Z d d l m Z m Z m Z d d l m Z m Z m Z e j e ƒ Z d	 „  Z d
 d d d „ Z e d „ Z  d „  Z! e j" ƒ  Z# e# j$ d d d ƒe# j$ d d d d ƒd „  Z% e d k rže% ƒ  n  d S(   s2   Build metadata for a project using PEP 517 hooks.
iÿÿÿÿN(   t   Pathi   (   t   BuildEnvironment(   t   Pep517HookCallert   quiet_subprocess_runner(   t   tempdirt   mkdir_pt   dir_to_zipfile(   t   validate_systemt   load_systemt   compat_systemc      
   C   s±   |  j  i  ƒ } t j d | ƒ | j | ƒ t j d ƒ t ƒ  i } t j d | ƒ |  j | i  ƒ } t j j | | ƒ } t	 j
 | t j j | t j j | ƒ ƒ ƒ Wd  QXd  S(   Ns   Got build requires: %ss$   Installed dynamic build dependenciess   Trying to build metadata in %s(   t   get_requires_for_build_wheelt   logt   infot   pip_installR   t    prepare_metadata_for_build_wheelt   ost   patht   joint   shutilt   movet   basename(   t   hookst   envt   destt   reqst   tdt   filenamet   source(    (    s4   /tmp/pip-build-UPPWic/pip/pip/_vendor/pep517/meta.pyt
   _prep_meta   s    t   .c         C   s­   | p t  |  ƒ } t j j |  | p' d ƒ } t | ƒ t | ƒ t |  | d | j d ƒ ƒ } | j t	 ƒ 8 t
 ƒ  ( } | j | d ƒ t | | | ƒ Wd  QXWd  QXd  S(   Nt   dists   build-backends   backend-patht   requires(   R   R   R   R   R   R   R   t   gett   subprocess_runnerR   R   R   R   (   t
   source_dirR   t   systemR   R   (    (    s4   /tmp/pip-build-UPPWic/pip/pip/_vendor/pep517/meta.pyt   build)   s    

c         C   s-   t  ƒ   } |  d | ƒ t | ƒ SWd  QXd  S(   NR   (   R   R   (   t   buildert   out_dir(    (    s4   /tmp/pip-build-UPPWic/pip/pip/_vendor/pep517/meta.pyt   build_as_zip8   s    c         C   sX   t  j j |  ƒ }  t |  ƒ } t j t d |  d | ƒ} t t | ƒ ƒ } t	 j
 | ƒ S(   s—   
    Given a source directory (root) of a package,
    return an importlib.metadata.Distribution object
    with metadata build from that package.
    R"   R#   (   R   R   t
   expanduserR	   t	   functoolst   partialR$   R    R'   t   imp_metat   PathDistribution(   t   rootR#   R%   R   (    (    s4   /tmp/pip-build-UPPWic/pip/pip/_vendor/pep517/meta.pyt   load>   s
    R"   t   helps%   A directory containing pyproject.tomls	   --out-dirs   -os>   Destination in which to save the builds relative to source dirc          C   s#   t  j ƒ  }  t |  j |  j ƒ d  S(   N(   t   parsert
   parse_argsR$   R"   R&   (   t   args(    (    s4   /tmp/pip-build-UPPWic/pip/pip/_vendor/pep517/meta.pyt   mainV   s    t   __main__(&   t   __doc__t   argparset   loggingR   R   R)   t   importlib.metadatat   metadataR+   t   ImportErrort   importlib_metadatat   zipfileR    t   zippt   envbuildR   t   wrappersR   R   t   dirtoolsR   R   R   R$   R   R   R	   t	   getLoggert   __name__R   R   t   NoneR'   R.   t   ArgumentParserR0   t   add_argumentR3   (    (    (    s4   /tmp/pip-build-UPPWic/pip/pip/_vendor/pep517/meta.pyt   <module>   s@   				