
ó
w/’ac            @  s™   d  d l  m Z d  d l 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  d l m Z d „  Z d „  Z d	 „  Z d S(
   i    (   t   absolute_import(   t   setup(   t   defaultdictN(   t   auto_find_packagest   find_package_data(   t   get_pep621_metadatac         C@ s  t  |  d d g ƒ } d } | d k	 r“ d |  É d i  Ê É d i  Ê k rZ t d ƒ ‚ n  |  É d i  Ê É d i  Ê É d i  Ê É d	 d Ê } n@|  d d } | d } t t ƒ } d
 | k rx; | d
 É Ê  D]) \ } } | d É d É | | Ê Ê qÔ Wn  d | k rnxX | d É Ê  D]F \ } }	 x7 |	 É Ê  D]) \ } }
 | | É d É | |
 Ê Ê q:Wq!Wn  i  | d d	 6d d 6d d 6| d d 6| d d 6| É d Ê d 6| É d g  Ê d 6t | ƒ d 6} | d k rì| d	 } n  t	 j
 É | Ê \ } } | sd } n  d d Ë  D] } | | ^ qk r³t j
 É d | Ê t É | d Ê } | d d k r{| j | d <n  | d d k r°d É | j É Ê  É Ê  Ê | d <n  n  | É t | | ƒ Ê | GHt | É d g  Ê | É d i  Ê ƒ | d <t |   d S(   sT   
    Handle pyproject.toml unserialized into data, using flit build
    system.
    t   versiont   descriptionNt   metadatat   toolt   flitsC   [project] and [tool.flit.metadata] cannot be present simultaneouslyt   modulet   namet   scriptst   console_scriptss   {} = {}t   entrypointst   authors   author-emailt   author_emails	   home-paget   urlt   classifierst   entry_pointss   .(   R   R   i    t    s    t   packagest   package_dirt   package_data(   R   t   gett
   ValueErrorR   t   listt   itemst   appendt   formatt   dictt   ost   patht   splitt   syst   insertt	   importlibt   import_modulet   __version__t   joint   __doc__t   stript
   splitlinest   updateR   R   R   (   t   datat   setup_metadatat   modnamet   topdataR   R   R   t   contentt
   group_namet   group_contentR!   t   subdirt   xt   mod(    (    t=   /home/mgorny/git/pyproject2setup.py/pyproject2setuppy/flit.pyt   handle_flit   s`    $
 
  
	#(c         C@ sâ   |  d } | d } t  | t ƒ s/ | g } n  | t j t _ t É | d d Ê } | j } t | d É d Ê d ƒ } t	 d | j
 j d | j
 j d	 | j
 j d
 | d
 d | d d | É d Ê d | É d g  Ê |  d S(   s&   Handle flit_core.build_thyself backends   build-systems   backend-paths   build-backendR   s   .i    R   R   R   R   R   R   t	   home_pageR   N(   t
   isinstanceR   R#   R!   R%   R&   t   metadata_dictR   R"   R   R   R   R   t   summaryR   (   R-   t   bst   backend_pathR6   R   t   package_args(    (    R7   t   handle_flit_thyself^   s     

	

c           C@ s   i  t  d 6t  d 6t d 6S(   s0   
    Return build-backend mapping for flit.
    s   flit.buildapis   flit_core.buildapis   flit_core.build_thyself(   R8   R@   (    (    (    R7   t   get_handlerss   s    
(   t
   __future__R    t
   setuptoolsR   t   collectionsR   R%   t   os.pathR    R#   t   pyproject2setuppy.commonR   R   t   pyproject2setuppy.pep621R   R8   R@   RA   (    (    (    R7   t   <module>   s   	J	