
Xc        #   @` s  d  d l  m Z m Z m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l m	 Z	 d Z
 d Z d e f d     YZ d   Z d	   Z d
   Z d d d d d d d d d d d d d d d d d d d d g Z d d  d! d" d# d$ d% d& d' d( d) d* d+ d, d- d. d/ d0 d1 d2 d3 g Z d4 d5 d6 g Z d d d d d d d d d d d d d d g Z d d d d d g Z d] d^ g Z d d  d! d# d" d( d+ d- 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 d d d d& d' d+ d, d1 g# Z g  e D] Z e d_ ^ qZ g  e D] Z e d` ^ q4Z da db dc g Z dd de df dg dh di dj dk dl dm dn do dp dq dr ds dt du dv dw dx dy g Z dz   Z d{   Z d|   Z  d}   Z! d~ Z" d   Z# d d d d d d d d d d d d d d d d g Z$ d d d d d d d d g Z% d d d d d d d d g Z& e& d d d  Z' d d d d d d d d d d d d g Z( d d d d d d d d d d d d d d d d g Z) d d d d d d d d d d d d g Z* d d d d d d d d d d d d d d d d g Z+ e+ d d d  Z, d d d d d d d d g d g d Z- d d d d d d d d g d g d Z. d   Z/ d S(   i    (   t   divisiont   absolute_importt   print_functionN(   t   mingw32i	  i
   t   MismatchCAPIWarningc           B` s   e  Z RS(    (   t   __name__t
   __module__(    (    (    s6   /tmp/pip-build-X4mzal/numpy/numpy/core/setup_common.pyR   +   s   c         C` sf   d d l  m } |  j d  } | d k r: t d   n  | d |  j } t |  d k rb t St S(   s7   Return True if a released version of numpy is detected.i    (   t   LooseVersions   ../version.pys   Could not get versiont   vstringi   N(	   t   distutils.versionR   t   get_versiont   Nonet
   ValueErrort   versiont   lent   Falset   True(   t   configR   t   vt   pv(    (    s6   /tmp/pip-build-X4mzal/numpy/numpy/core/setup_common.pyt   is_released.   s    c         C` si   t  j j d |  z: t d  } t d  } | j | j  } | j   } Wd t  j d =X| | |  f S(   s   
    Return current C API checksum and the recorded checksum.

    Return current C API checksum and the recorded checksum for the given
    version of the C API version.

    i    t   genapit	   numpy_apiN(   t   syst   patht   insertt
   __import__t   fullapi_hasht   full_apit   get_versions_hash(   t
   apiversiont   codegen_dirt   mR   t   curapi_hasht	   apis_hash(    (    s6   /tmp/pip-build-X4mzal/numpy/numpy/core/setup_common.pyt   get_api_versions:   s    
c         C` sW   t  |  |  \ } } | | k sS d } t j | |  | |  | t f t d d n  d S(   s@   Emits a MismacthCAPIWarning if the C API version needs updating.s  API mismatch detected, the C API version numbers have to be updated. Current C api version is %d, with checksum %s, but recorded checksum for C API version %d in codegen_dir/cversions.txt is %s. If functions were added in the C API, you have to update C_API_VERSION  in %s.t
   stackleveli   N(   R#   t   warningst   warnt   __file__R   (   R   R   R!   t   api_hasht   msg(    (    s6   /tmp/pip-build-X4mzal/numpy/numpy/core/setup_common.pyt   check_api_versionO   s    t   sint   cost   tant   sinht   cosht   tanht   fabst   floort   ceilt   sqrtt   log10t   logt   expt   asint   acost   atant   fmodt   modft   frexpt   ldexpt   expm1t   log1pt   acosht   asinht   atanht   rintt   trunct   exp2t   log2t   hypott   atan2t   powt   copysignt	   nextaftert   ftellot   fseekot   strtollt   strtoullt   cbrtt	   strtold_lt	   fallocates   xmmintrin.hs   emmintrin.hs
   features.ht   __builtin_isnans   5.t   __builtin_isinft   __builtin_isfinitet   __builtin_bswap32t   5ut   __builtin_bswap64t   __builtin_expects   5, 0t   __builtin_mul_overflows   5, 5, (int*)5s'   volatile int r = __builtin_cpu_supportss   "sse"s   stdio.ht   __BUILTIN_CPU_SUPPORTSt   _mm_load_pss	   (float*)0t   _mm_prefetchs   (float*)0, _MM_HINT_NTAt   _mm_load_pds
   (double*)0t   __builtin_prefetchs   (float*)0, 0, 3s   __asm__ volatiles   "vpand %xmm1, %xmm2, %xmm3"t   LINK_AVXs   "vpand %ymm1, %ymm2, %ymm3"t	   LINK_AVX2s)   __attribute__((optimize("unroll-loops")))t   attribute_optimize_unroll_loopss   __attribute__((optimize("O3")))t   attribute_optimize_opt_3s   __attribute__((nonnull (1)))t   attribute_nonnulls   __attribute__((target ("avx")))t   attribute_target_avxs    __attribute__((target ("avx2")))t   attribute_target_avx2t   __threads   __declspec(thread)t   ft   ls   complex doubles   complex floats   complex long doublet   cabst   cacost   cacosht   cargt   casint   casinht   catant   catanht   ccost   ccosht   cexpt   cimagt   clogt   conjt   cpowt   cprojt   crealt   csint   csinht   csqrtt   ctant   ctanhc         C` s   d |  j    S(   Ns   HAVE_%s(   t   upper(   t   name(    (    s6   /tmp/pip-build-X4mzal/numpy/numpy/core/setup_common.pyt	   fname2def   s    c         C` s   |  j  d d  } | j   S(   Nt    t    (   t   replaceR   (   t   symbolt   define(    (    s6   /tmp/pip-build-X4mzal/numpy/numpy/core/setup_common.pyt   sym2def   s    c         C` s   |  j  d d  } | j   S(   NR   t   _(   R   R   (   R   R   (    (    s6   /tmp/pip-build-X4mzal/numpy/numpy/core/setup_common.pyt   type2def   s    c         C` s=  |  j    t i d d 6} t j d k rh t   rh y |  j j j d  Wqh t t	 f k
 rd qh Xn  |  j
 | d  d  d  \ } } z y t t |   } | SWn t	 k
 r)| j d d  } | d 7} |  j
 | d  d  d  \ } } |  j j d	  |  j j | g d	  t t d	   } | SXWd  |  j   Xd  S(
   Ns   long doublet   typet   win32s   /GLt   ct   structs   volatile structs   int main(void) { return 0; }
t   _configtest(   t   _check_compilert   LONG_DOUBLE_REPRESENTATION_SRCR   t   platformR   t   compilert   compile_optionst   removet   AttributeErrorR   t   _compileR   t   long_double_representationt   pyodR   t
   temp_filest   appendt   link_executablet   _clean(   t   cmdt   bodyt   srct   objt   ltype(    (    s6   /tmp/pip-build-X4mzal/numpy/numpy/core/setup_common.pyt    check_long_double_representation   s*    
 
	sA  
/* "before" is 16 bytes to ensure there's no padding between it and "x".
 *    We're not expecting any "long double" bigger than 16 bytes or with
 *       alignment requirements stricter than 16 bytes.  */
typedef %(type)s test_type;

struct {
        char         before[16];
        test_type    x;
        char         after[8];
} foo = {
        { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
          '\001', '\043', '\105', '\147', '\211', '\253', '\315', '\357' },
        -123456789.0,
        { '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' }
};
c         ` sC     f d   }   f d   } t  j d d k  r8 |   S|   Sd S(   s  Python implementation of the od UNIX utility (od -b, more exactly).

    Parameters
    ----------
    filename : str
        name of the file to get the dump from.

    Returns
    -------
    out : seq
        list of lines of od output

    Note
    ----
    We only implement enough to get the necessary information for long double
    representation, this is not intended as a compatible replacement for od.
    c          ` s   g  }  t    d  } z g  | j   D]* } t t t t j |  d    ^ q% } x~ t d t |  d  D]d } d t t |   g } | j g  | | | d !D] } d | ^ q  |  j	 d j
 |   qn W|  SWd  | j   Xd  S(   Nt   rbi   i    s   %07ds   %03dR   (   t   opent   readt   intt   octt   binasciit   b2a_hext   rangeR   t   extendR   t   joint   close(   t   outt   fidt   ot   yot   it   lineR   (   t   filename(    s6   /tmp/pip-build-X4mzal/numpy/numpy/core/setup_common.pyt   _pyod2
  s    =/c          ` s   g  }  t    d  } z g  | j   D] } t |  d ^ q% } x t d t |  d  D]n } d t t |  d  g } | j g  | | | d !D] } d t |  ^ q  |  j d j |   qZ W|  SWd  | j	   Xd  S(   NR   i   i    i   s   %07ds   %03dR   (
   R   R   R   R   R   R   R   R   R   R   (   R   R   R   t   yo2R   R   R   (   R   (    s6   /tmp/pip-build-X4mzal/numpy/numpy/core/setup_common.pyt   _pyod3  s    )5i    i   N(   R   t   version_info(   R   R   R   (    (   R   s6   /tmp/pip-build-X4mzal/numpy/numpy/core/setup_common.pyR      s
    t   000t   001t   043t   105t   147t   211t   253t   315t   357t   376t   334t   272t   230t   166t   124t   062t   020t   301t   235t   157t   064it   240t   242t   171t   353t   031t   300t   326t   363t   100i   c         C` s  d g d } d } xu|  D]m} xd| j   d D]R} | j d  | j |  | d t k r1 t j |  } | d  t d k r | d d !t k r d S| d d !t k rd	 Sq| d
  t d
 k r?| d
 d !t	 k r d S| d
 d !t
 k r d S| d
 d !t k rd S| d
 d !t k r%d S| d
 d !t k rd Sq| d  t k r| d d !t k rfd S| d d !t k rd Sqq1 q1 Wq W| d k	 rt d |   n t d |   d S(   sS   Given a binary dump as given by GNU od -b, look for long double
    representation.R   i    i   i    ii   i   t   INTEL_EXTENDED_12_BYTES_LEt   MOTOROLA_EXTENDED_12_BYTES_BEi   t   INTEL_EXTENDED_16_BYTES_LEt   IEEE_QUAD_BEt   IEEE_QUAD_LEt   DOUBLE_DOUBLE_BEt   DOUBLE_DOUBLE_LEi   t   IEEE_DOUBLE_LEt   IEEE_DOUBLE_BEs   Unrecognized format (%s)s   Could not lock sequences (%s)N(   R   t   splitt   popR   t
   _AFTER_SEQt   copyt   _BEFORE_SEQt   _INTEL_EXTENDED_12Bt   _MOTOROLA_EXTENDED_12Bt   _INTEL_EXTENDED_16Bt   _IEEE_QUAD_PREC_BEt   _IEEE_QUAD_PREC_LEt   _DOUBLE_DOUBLE_BEt   _DOUBLE_DOUBLE_LEt   _IEEE_DOUBLE_LEt   _IEEE_DOUBLE_BER   (   t   linesR   t   sawR   t   w(    (    s6   /tmp/pip-build-X4mzal/numpy/numpy/core/setup_common.pyR   ?  s@    (   RT   s   5.(   RU   s   5.(   RV   s   5.(   RW   RX   (   RY   RX   (   RZ   s   5, 0(   R[   s   5, 5, (int*)5(   s'   volatile int r = __builtin_cpu_supportss   "sse"s   stdio.hR\   (   R]   s	   (float*)0s   xmmintrin.h(   R^   s   (float*)0, _MM_HINT_NTAs   xmmintrin.h(   R_   s
   (double*)0s   emmintrin.h(   R`   s   (float*)0, 0, 3(   s   __asm__ volatiles   "vpand %xmm1, %xmm2, %xmm3"s   stdio.hRa   (   s   __asm__ volatiles   "vpand %ymm1, %ymm2, %ymm3"s   stdio.hRb   (   s)   __attribute__((optimize("unroll-loops")))Rc   (   s   __attribute__((optimize("O3")))Rd   (   s   __attribute__((nonnull (1)))Re   (   s   __attribute__((target ("avx")))Rf   (   s    __attribute__((target ("avx2")))Rg   (0   t
   __future__R    R   R   R   R%   R   R   t   numpy.distutils.misc_utilR   t   C_ABI_VERSIONt   C_API_VERSIONt   WarningR   R   R#   R*   t   MANDATORY_FUNCSt   OPTIONAL_STDFUNCSt   OPTIONAL_HEADERSt   OPTIONAL_INTRINSICSt   OPTIONAL_FUNCTION_ATTRIBUTESt   OPTIONAL_VARIABLE_ATTRIBUTESt   OPTIONAL_STDFUNCS_MAYBEt	   C99_FUNCSRi   t   C99_FUNCS_SINGLEt   C99_FUNCS_EXTENDEDt   C99_COMPLEX_TYPESt   C99_COMPLEX_FUNCSR   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s6   /tmp/pip-build-X4mzal/numpy/numpy/core/setup_common.pyt   <module>   s   				    	     					/	3