σ
ίΘ[c           @` sU  d  d l  m Z m Z m Z m Z d Z d Z d  d l Z d  d l m	 Z	 d  d l Z
 d  d l Z d  d l Z d  d l m Z d  d l m Z d  d l m Z d  d	 l m Z d  d
 l m Z e
 j j e
 j j e   Z d Z d   Z e j r d   Z n	 d   Z d   Z  d   Z! d   Z" d   Z# d   Z$ d   Z% d   Z& d   Z' d S(   i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsu   Michael Droettboomu   mdroe@stsci.eduN(   t   join(   t	   Extension(   t   newer_group(   t   setup_helpers(   t   get_distutils_build_option(   t   sixu   5.16c         C` s   |  j  d  S(   Nu   ascii(   t   encode(   t   s(    (    s8   lib/python2.7/site-packages/astropy/wcs/setup_package.pyt   b   s    c         C` s1   |  j  d  }  |  j d d  }  |  j d d  S(   Nu   string_escapeu   \x00u   \0u   \'u   '(   R
   t   replace(   R   (    (    s8   lib/python2.7/site-packages/astropy/wcs/setup_package.pyt   string_escape   s    c         C` sL   |  j  d  j d d  }  |  j d d  }  |  j d d  }  |  j  d  S(   Nu   asciiu   backslashreplaces   
s   \ns    s   \0(   t   decodeR
   R   (   R   (    (    s8   lib/python2.7/site-packages/astropy/wcs/setup_package.pyR   &   s    c          C` s§   y y d d l  }  Wn t k
 r/ t    n X|  j |  j  d k rL d S|  j |  j  d k rh d S|  j |  j  d k r d St    Wn t k
 r’ d SXd S(   uΉ  
    The only configuration parameter needed at compile-time is how to
    specify a 64-bit signed integer.  Python's ctypes module can get us
    that information, but it is only available in Python 2.5 or later.
    If we can't be absolutely certain, we default to "long long int",
    which is correct on most platforms (x86, x86_64).  If we find
    platforms where this heuristic doesn't work, we may need to
    hardcode for them.
    i    Ni   u   long long intu   long intu   int(   t   ctypest   ImportErrort
   ValueErrort   sizeoft
   c_longlongt   c_longt   c_int(   R   (    (    s8   lib/python2.7/site-packages/astropy/wcs/setup_package.pyt   determine_64_bit_int-   s    
c         C` sb   t  j   } | j d j t t     | j   j d  } x |  D] } t j	 | |  qD Wd S(   uE   
    Writes out the wcsconfig.h header with local configuration.
    uy  
    /* The bundled version has WCSLIB_VERSION */
    #define HAVE_WCSLIB_VERSION 1

    /* WCSLIB library version number. */
    #define WCSLIB_VERSION {0}

    /* 64-bit integer data type. */
    #define WCSLIB_INT64 {1}

    /* Windows needs some other defines to prevent inclusion of wcsset()
       which conflicts with wcslib's wcsset().  These need to be set
       on code that *uses* astropy.wcs, in addition to astropy.wcs itself.
       */
    #if defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__) || defined (__MINGW64__)

    #ifndef YY_NO_UNISTD_H
    #define YY_NO_UNISTD_H
    #endif

    #ifndef _CRT_SECURE_NO_WARNINGS
    #define _CRT_SECURE_NO_WARNINGS
    #endif

    #ifndef _NO_OLDNAMES
    #define _NO_OLDNAMES
    #endif

    #ifndef NO_OLDNAMES
    #define NO_OLDNAMES
    #endif

    #ifndef __STDC__
    #define __STDC__ 1
    #endif

    #endif
    u   asciiN(
   t   iot   StringIOt   writet   formatt
   WCSVERSIONR   t   getvalueR
   R   t   write_if_different(   t   pathst   h_filet   contentt   path(    (    s8   lib/python2.7/site-packages/astropy/wcs/setup_package.pyt   write_wcsconfig_hJ   s    %c    
      C` sX  d d l  m }  |  j }  g  |  j   D]4 \ } } | j d  r& t | t j  r& | ^ q& } | j   i  } x/ | D]' } |  | j	 d  j
   d | | <qw Wt j   } | j d  x7 | D]/ } | | } | j d j | t |    qΒ W| j d  t j t t d	 d
 d  | j   j	 d   t j   } | j d  xέ | D]Υ } | | } | j d j | t |    x t d t |  d  D]| } | | | d !} t j rΪg  | D] }	 t |	  ^ qΏ} n  | j d  | j d j d   | D   | j d  qW| j d  qPWt j t t d d  | j   j	 d   d  S(   Ni    (   t
   docstringsu   __u   utf8s    uΊ   /*
DO NOT EDIT!

This file is autogenerated by astropy/wcs/setup_package.py.  To edit
its contents, edit astropy/wcs/docstrings.py
*/

#ifndef __DOCSTRINGS_H__
#define __DOCSTRINGS_H__

u   extern char doc_{0}[{1}];
u	   
#endif

u   includeu   astropy_wcsu   docstrings.hu   utf-8uH  /*
DO NOT EDIT!

This file is autogenerated by astropy/wcs/setup_package.py.  To edit
its contents, edit astropy/wcs/docstrings.py

The weirdness here with strncpy is because some C compilers, notably
MSVC, do not support string literals greater than 256 characters.
*/

#include <string.h>
#include "astropy_wcs/docstrings.h"

u   char doc_{0}[{1}] = {{
i   u       u    c         s` s   |  ] } d  j  |  Vq d S(   u   0x{0:02x}, N(   R   (   t   .0t   x(    (    s8   lib/python2.7/site-packages/astropy/wcs/setup_package.pys	   <genexpr>΅   s    u   
u       };

u   srcu   docstrings.c(   t   astropy.wcsR$   t   __dict__t   itemst
   startswitht
   isinstanceR	   t   string_typest   sortR
   t   lstripR   R   R   R   t   lenR   R   R   t   WCSROOTR   t   ranget   PY2t   ord(
   R$   t   keyt   valt   keyst   docsR    t   c_filet   it   sectionR&   (    (    s8   lib/python2.7/site-packages/astropy/wcs/setup_package.pyt   generate_c_docstrings~   sF    	.
%

#
	" c         ` s7  d d l  m } |  d j d  |  d j d) d* d+ d, g  t j d
  s] t j d k rΊ t	 |  t
 d d
  } t
 | d    |  d j   f d   | D  |  d j    nS t
 t d d  } t j j |  rξ t j |  n  |  j t j d
 g d g   | rx|  d j d-  |  d j d  t j j d  rt j d k r|  d j d d d g  qn" |  d j d.  |  d j d  t j d k rΜ|  d j d/ d0 d1 d2 d3 g  n  t j j d   rς|  d j d4  n  t j   d5 k r3t d$  s3|  d j d% d& d' d( g  q3n  d  S(6   Ni    (   t   debugu   include_dirsu   numpyu   define_macrosu   ECHOu   WCSTRIG_MACROu   ASTROPY_WCS_BUILDu   _GNU_SOURCEu   wcslibu   win32u   cexternu   Cu   sourcesc         3` s   |  ] } t    |  Vq d  S(   N(   R   (   R%   R&   (   t   wcslib_cpath(    s8   lib/python2.7/site-packages/astropy/wcs/setup_package.pys	   <genexpr>Ο   s    u   includeu   wcsconfig.hu   wcsu   DEBUGu   undef_macrosu   NDEBUGu   sunu   extra_compile_argsu   -fno-inlineu   -O0u   -gu   YY_NO_UNISTD_Hu   _CRT_SECURE_NO_WARNINGSu   _NO_OLDNAMESu   NO_OLDNAMESu   __STDC__u   linuxu   HAVE_SINCOSu   unixu   mingw32u   debugu   -Wno-strict-prototypesu   -Wno-unused-functionu   -Wno-unused-valueu   -Wno-uninitialized(   u   ECHON(   u   WCSTRIG_MACRON(   u   ASTROPY_WCS_BUILDN(   u   _GNU_SOURCEN(   u   DEBUGN(   u   NDEBUGN(   u   YY_NO_UNISTD_HN(   u   _CRT_SECURE_NO_WARNINGSN(   u   _NO_OLDNAMESN(   u   NO_OLDNAMESN(   u   __STDC__N(   u   HAVE_SINCOSN(   u   unixu   mingw32(   t   astropy.versionR<   t   appendt   extendt   NoneR   t   use_system_libraryt   syst   platformR#   R   R0   t   osR"   t   existst   unlinkt   updatet
   pkg_configR*   t   get_compiler_optionR   (   t   cfgt   wcslib_filest   include_pathsR<   t   wcslib_patht   wcsconfig_h_path(    (   R=   s8   lib/python2.7/site-packages/astropy/wcs/setup_package.pyt   get_wcslib_cfgΏ   sT    


! 

c          C` sM  t    t j   }  d d d d d d d d d	 d
 d d d d d d d d d d g } t t d d d  t t d d  g } t |  | |  |  d j t t d   d d d d d d d d  d! d" d# d$ d% d& g } |  d' j d(   | D  g  |  d' D] } t |  ^ qό |  d' <t	 d)   t
 j |   D  }  t t d*  |   g S(+   Nu   flexed/wcsbth.cu   flexed/wcspih.cu   flexed/wcsulex.cu   flexed/wcsutrn.cu   cel.cu   dis.cu   lin.cu   log.cu   prj.cu   spc.cu   sph.cu   spx.cu   tab.cu   wcs.cu   wcserr.cu   wcsfix.cu   wcshdr.cu   wcsprintf.cu
   wcsunits.cu	   wcsutil.cu   includeu   astropy_wcsu   wcsconfig.hu   include_dirsu   distortion.cu   distortion_wrap.cu   docstrings.cu
   pipeline.cu   pyutil.cu   astropy_wcs.cu   astropy_wcs_api.cu   sip.cu
   sip_wrap.cu   str_list_proxy.cu   unit_list_proxy.cu   util.cu   wcslib_wrap.cu   wcslib_tabprm_wrap.cu   sourcesc         s` s!   |  ] } t  t d  |  Vq d S(   u   srcN(   R   R0   (   R%   R&   (    (    s8   lib/python2.7/site-packages/astropy/wcs/setup_package.pys	   <genexpr>1  s    c         s` s'   |  ] \ } } t  |  | f Vq d  S(   N(   t   str(   R%   R4   R5   (    (    s8   lib/python2.7/site-packages/astropy/wcs/setup_package.pys	   <genexpr>4  s    u   astropy.wcs._wcs(   R;   R   t   DistutilsExtensionArgsR   R0   RP   R?   R@   RQ   t   dictR	   t	   iteritemsR   (   RK   RL   t   wcslib_config_pathst   astropy_wcs_filesR&   (    (    s8   lib/python2.7/site-packages/astropy/wcs/setup_package.pyt   get_extensionsϋ   sX    		'c       
   C` sD  d d d d d d d d d	 g	 }  g  |  D] } t  d
 d |  ^ q( }  |  j t  d
 d   d d d d d d d d d d g
 } t j d  sx | D]t } t  d d d |  } t  d d d
 d |  } t | g | d  rρ t j | |  n  |  j t  d
 d |   q Wn  i d d d d d  d! d" g t d#  6|  t d$  6S(%   Nu   astropy_wcs.hu   astropy_wcs_api.hu   distortion.hu   isnan.hu
   pipeline.hu   pyutil.hu   sip.hu   util.hu   wcsconfig.hu   includeu   astropy_wcsu   cel.hu   lin.hu   prj.hu   spc.hu   spx.hu   tab.hu   wcs.hu   wcserr.hu	   wcsmath.hu   wcsprintf.hu   wcslibu   cexternu   Cu   astropyu   wcsu   neweru
   data/*.hdru   data/*.fitsu
   data/*.txtu   data/*.fits.gzu
   maps/*.hdru   spectra/*.hdru   extension/*.cu   astropy.wcs.testsu   astropy.wcs(   R   R?   R   RB   R   t   shutilt   copyRQ   (   t	   api_filesR&   t   wcslib_headerst   headert   sourcet   dest(    (    s8   lib/python2.7/site-packages/astropy/wcs/setup_package.pyt   get_package_data9  sD    	%	 c           C` s   d g S(   Nu   wcslib(    (    (    (    s8   lib/python2.7/site-packages/astropy/wcs/setup_package.pyt   get_external_librariesf  s    c           C` s   t  S(   N(   t   False(    (    (    s8   lib/python2.7/site-packages/astropy/wcs/setup_package.pyt   requires_2to3j  s    ((   t
   __future__R    R   R   R   t   CONTACTt   EMAILR   t   os.pathR   RE   RX   RC   t   distutils.coreR   t   distutils.dep_utilR   t   astropy_helpersR   t!   astropy_helpers.distutils_helpersR   t   astropy.externR	   R"   t   relpatht   dirnamet   __file__R0   R   R   R2   R   R   R#   R;   RP   RW   R_   R`   Rb   (    (    (    s8   lib/python2.7/site-packages/astropy/wcs/setup_package.pyt   <module>   s4   "					4	A	<	>	-	