

W!ac            @  s   d  d l  m Z d  d l m Z m Z d  d l m Z d  d l Z d  d l	 Z
 d  d l Z d  d l m Z m Z d   Z d   Z d S(   i    (   t   absolute_import(   t   find_packagest   setup(   t   defaultdictN(   t   auto_find_packagest   find_package_datac         C@ s  |  d d } g  } g  } xD | d D]8 } t  j  |  \ } } |  |  |  |  q% Wd | k r t  d d | d     } y t |  } Wn  t k
 r t | d  } n Xn i  g  d 6i  d	 6} x | d D] }	 |	 	 d
 d  d k rq n  |	 	 d d  }
 t
 |
 d |	 d |	 d d f } | d  |  |
 d k rx= | D]5 } t j  |
 |  d t j j   | d	 | <q_Wq q Wt | 	 d g   | 	 d	 i    | d <d | k rt d   n  t t  } d | k r>x; | d    D]) \ } } | d  d  | |   qWn  d | k rxX | d    D]F \ } } x7 |    D]) \ } } | |  d  | |   qtWq[Wn  t d | d d | d d | d d d  |  d d  |  d | 	 d  d | 	 d g   d  t |  |  d! S("   sV   
    Handle pyproject.toml unserialized into data, using poetry build
    system.
    t   toolt   poetryt   authorst   packagess   [-.]t   _t   namet   srct   package_dirt   formatt    t   sdistt   froms   .t   includes   .*t   package_datat   excludes   exclude is not implemented yett   scriptst   console_scriptss   {} = {}t   pluginst   versiont   descriptiont   authors   , t   author_emailt   urlt   homepaget   classifierst   entry_pointsN(   t   emailt   utilst	   parseaddrt   appendt   ret   subt   lowerR   t   RuntimeErrort   getR   t   extendt   ost   patht   joint   replacet   sepR   t   NotImplementedErrorR   t   listt   itemsR   R   t   dict(   t   datat   metadataR   t   author_emailst   aR   t   addrt   canonical_namet   package_argst   pt   subdirR	   t   spR   t   contentt
   group_namet   group_contentR+   (    (    t?   /home/mgorny/git/pyproject2setup.py/pyproject2setuppy/poetry.pyt   handle_poetry   sl      ! 	1 
  


	c           C@ s   i  t  d 6t  d 6S(   s2   
    Return build-backend mapping for poetry.
    s   poetry.masonry.apis   poetry.core.masonry.api(   RA   (    (    (    R@   t   get_handlersX   s    
(   t
   __future__R    t
   setuptoolsR   R   t   collectionsR   t   email.utilsR    t   os.pathR*   R$   t   pyproject2setuppy.commonR   R   RA   RB   (    (    (    R@   t   <module>   s   	E