
(°h?  ã               @   s_   d  d l  j j Z d  d l m Z d  d l m Z d  d l m	 Z	 Gd d „  d e j ƒ Z d S)é    N)ÚDistutilsSetupError)Úlog)Únewer_pairwise_groupc               @   s"   e  Z d  Z d Z d d „  Z d S)Ú
build_clibav  
    Override the default build_clib behaviour to do the following:

    1. Implement a rudimentary timestamp-based dependency system
       so 'compile()' doesn't run every time.
    2. Add more keys to the 'build_info' dictionary:
        * obj_deps - specify dependencies for each object compiled.
                     this should be a dictionary mapping a key
                     with the source filename to a list of
                     dependencies. Use an empty string for global
                     dependencies.
        * cflags   - specify a list of additional flags to pass to
                     the compiler.
    c             C   s#  x| D]\ } } | j  d ƒ } | d  k sD t | t t f ƒ rT t d | ƒ ‚ t | ƒ } t j d | ƒ | j  d t ƒ  ƒ } t | t ƒ s¤ t d | ƒ ‚ g  } | j  d t ƒ  ƒ } t | t t f ƒ sä t d | ƒ ‚ xx | D]p } | g }	 |	 j | ƒ | j  | t ƒ  ƒ }
 t |
 t t f ƒ sAt d | ƒ ‚ |	 j |
 ƒ | j	 |	 ƒ që W|  j
 j | d |  j ƒ} t | | ƒ g  g  f k rö| j  d ƒ } | j  d	 ƒ } | j  d
 ƒ } |  j
 j | d |  j d | d	 | d | d |  j ƒ|  j
 j | | d |  j d |  j ƒq Wd  S)NÚsourceszfin 'libraries' option (library '%s'), 'sources' must be present and must be a list of source filenameszbuilding '%s' libraryÚobj_depsz\in 'libraries' option (library '%s'), 'obj_deps' must be a dictionary of type 'source: list'Ú Ú
output_dirÚmacrosÚinclude_dirsÚcflagsZextra_postargsÚdebug)ÚgetÚ
isinstanceÚlistÚtupler   r   ÚinfoÚdictÚextendÚappendÚcompilerZobject_filenamesÚ
build_tempr   Úcompiler   Zcreate_static_libr   )ÚselfÚ	librariesZlib_nameZ
build_infor   r   ZdependenciesZglobal_depsÚsourceZsrc_depsZ
extra_depsZexpected_objectsr
   r   r   © r   úC/tmp/pip-build-kmztzv_d/setuptools/setuptools/command/build_clib.pyÚbuild_libraries   sb    "


	
			
		zbuild_clib.build_librariesN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r      s   r   )
Zdistutils.command.build_clibÚcommandr   ÚorigZdistutils.errorsr   Ú	distutilsr   Zsetuptools.dep_utilr   r   r   r   r   Ú<module>   s   