B
    q\                 @   s   d dl Z d dlmZ d dlmZ d dlmZ d dlmZm	Z	 d dl
mZ e	eddd	Ze je jeZeed
ZeedegZeedgZddd d dd d dddd d d d d dddddd d d d dd dZdd Zdd Zdd Zdd Zdd Zdd ZdS )    N)join)	Extension)log)setup_helpersutils)get_pkg_version_moduleastropyZwcszsetup_package.pysrczprojections.c.templzprojections.c         )ZazpZszpZtanZstgZsinZarcZzeaZairZcypZceaZmerZsflZparZmolZaitZcopZcoeZcodZcooZbonZpcoZtscZcscZqscZhpxZxphc             C   s
   t   d S )N)preprocess_source)cmd_obj r   =lib/python3.7/site-packages/astropy/modeling/setup_package.pypre_build_py_hook:   s    r   c             C   s
   t   d S )N)r   )r   r   r   r   pre_build_ext_hook>   s    r   c             C   s
   t   d S )N)r   )r   r   r   r   pre_sdist_hookB   s    r   c        
   	   C   s   t dd tD rtdd tD } tdd tD }td}|| krJd S |jr^td d S ydd l	}W n t
k
r   td d S X dd	l	m}m} ||td
}|d}|jtd}tttdd}	|	| W d Q R X d S )Nc             s   s   | ]}t j|V  qd S )N)ospathexists).0filenamer   r   r   	<genexpr>L   s    z$preprocess_source.<locals>.<genexpr>c             s   s   | ]}t j|V  qd S )N)r   r   getmtime)r   r   r   r   r   r   N   s    c             s   s   | ]}t j|V  qd S )N)r   r   r   )r   r   r   r   r   r   O   s    r   am  WARNING: The autogenerated wrappers in astropy.modeling._projections seem to be older than the source templates used to create them. Because this is a release version we will use them anyway, but this might be a sign of some sort of version mismatch or other tampering. Or it might just mean you moved some files around or otherwise accidentally changed timestamps.r   z`WARNING: jinja2 could not be imported, so the existing modeling _projections.c file will be used)EnvironmentFileSystemLoader)loaderzprojections.c.templ)projectionszprojections.cw)all	GEN_FILESmax	SRC_FILESminr   releaser   warnjinja2ImportErrorr   r   MODELING_SRCZget_templateZrenderr   openr   write)
Z	src_mtimeZ	gen_mtimeversionr'   r   r   envZc_inZc_outfdr   r   r   r   F   s(    
	

r   c               C   s   ddddgiS )Nzastropy.modeling.testszdata/*.fitsz
data/*.hdrz../../wcs/tests/maps/*.hdrr   r   r   r   r   get_package_datay   s    r/   c              C   s   ddddg} t tdg}t }t|| | |d t dg}|d d	d
 |D  dd |d D |d< tdd
 |	 D }t
tdf|gS )Nzprj.czwcserr.czwcsprintf.cz	wcsutil.czwcsconfig.hZinclude_dirszprojections.cZsourcesc             s   s   | ]}t t|V  qd S )N)r   r)   )r   xr   r   r   r      s    z!get_extensions.<locals>.<genexpr>c             S   s   g | ]}t |qS r   )str)r   r0   r   r   r   
<listcomp>   s    z"get_extensions.<locals>.<listcomp>c             s   s   | ]\}}t ||fV  qd S )N)r1   )r   keyvalr   r   r   r      s    zastropy.modeling._projections)r   r)   r   ZDistutilsExtensionArgswcs_setup_packageZget_wcslib_cfgappendextenddictitemsr   r1   )Zwcslib_filesZwcslib_config_pathsZcfgZastropy_filesr   r   r   get_extensions   s    r:   )r   os.pathr   Zdistutils.corer   Z	distutilsr   Zastropy_helpersr   r   Zastropy_helpers.version_helpersr   Zimport_filer5   r   relpathdirname__file__ZMODELING_ROOTr)   r#   r!   r   r   r   r   r   r/   r:   r   r   r   r   <module>   sV   

3