U
    Df                     @   sr   d dl m  mZ d dlmZ d dlmZ zd dlm	Z	 W n  e
k
rZ   ddlm	Z	 Y nX G dd dejZdS )    N)DistutilsSetupError)log)newer_pairwise_group   c                   @   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   sv  |D ]j\}}| d}|d ks.t|ttfs:td| tt|}td| | dt }t|tsvtd| g }| dt }t|ttfstd| |D ]P}|g}	|		| | |t }
t|
ttfstd| |		|
 |
|	 q| jj|| jd}t||g g fkrX| d}| d	}| d
}| jj|| j|||| jd | jj||| j| jd qd 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cflags)r
   r   r   Zextra_postargsdebug)r
   r   )get
isinstancelisttupler   sortedr   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   A/tmp/pip-unpacked-wheel-wqy06g0s/setuptools/command/build_clib.pybuild_libraries   sv    






   zbuild_clib.build_librariesN)__name__
__module____qualname____doc__r    r   r   r   r   r      s   r   )Zdistutils.command.build_clibcommandr   origdistutils.errorsr   	distutilsr   Zdistutils._modifiedr   ImportErrorZ_distutils._modifiedr   r   r   r   <module>   s   