
    /_i                        d dl Z d dlZd dlZd dlZd dlZd dlZd dlmc m	Z
 e j                  j                  e j                  j                  e            Ze j                   j#                  dd      Ze j&                  dk(  rdgZne j&                  dk(  rddgZng Zd	Zd
 Zej.                  j0                  ej.                  j2                  d               Zej.                  j0                  ej.                  j2                  d               Zy)    NPYARROW_TEST_LD_PATH posixz
-std=c++17ntz"-D_ENABLE_EXTENDED_ALIGNED_STORAGEz
/std:c++17a[  if 1:
    from setuptools import setup
    from Cython.Build import cythonize

    import numpy as np

    import pyarrow as pa

    ext_modules = cythonize({pyx_file!r})
    compiler_opts = {compiler_opts!r}
    custom_ld_path = {test_ld_path!r}

    for ext in ext_modules:
        # XXX required for numpy/numpyconfig.h,
        # included from arrow/python/api.h
        ext.include_dirs.append(np.get_include())
        ext.include_dirs.append(pa.get_include())
        ext.libraries.extend(pa.get_libraries())
        ext.library_dirs.extend(pa.get_library_dirs())
        if custom_ld_path:
            ext.library_dirs.append(custom_ld_path)
        ext.extra_compile_args.extend(compiler_opts)
        print("Extension module:",
              ext, ext.include_dirs, ext.libraries, ext.library_dirs)

    setup(
        ext_modules=ext_modules,
    )
c                 T   t        j                  g d      }| j                  |      dk(  sJ t        j                  t
        d      5  | j                  d        d d d        t        j                  d      }| j                  |t        j                               }|t        j                  d      k(  sJ t        j                  t        d      5  | j                  |t        j                  t        j                                      d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)N)         r
   znot an arraymatch{   123z<Unsupported cast from int64 to list using function cast_list)paarrayget_array_lengthpytestraises	TypeErrorscalarcast_scalarutf8NotImplementedErrorlist_int64)modarrscal	cast_scals       X/var/www/html/land_sniper/venv/lib/python3.12/site-packages/pyarrow/tests/test_cython.pycheck_cython_example_moduler    D   s    
((9
C$)))	y	7 #T"# 99S>Dbggi0I		%((((	*)
* 4 	bhhrxxz234 4# #4 4s   	D8DDD'c           	         ddl }| j                         5  d}t        j                  t        j
                  j                  t        |      t        j
                  j                  t        |       |             t        j                  |t        t              }t        dd      5 }|j                  |       ddd       t        j                          }t#        j$                  t&        j(                  dddg|	       t&        j
                  dd }t&        j
                  j+                  dt        |              	 t-        d
      }t/        |       |t&        _        dt1        j2                          d}d}	t&        j4                  dk(  rt7        t        d      s$d\  }
}	nt&        j4                  dk(  rd\  }
}	nd\  }
}	|	rct&        j
                  }|t1        j2                         z  }||j9                  |	d      gz  }|D cg c]  }|s|	 }}
j                  |      ||	<   t#        j$                  t&        j(                  d|gt"        j:                  |       ddd       y# 1 sw Y   xY w# |t&        _        w xY wc c}w # 1 sw Y   yxY w)z(
    Basic test for the Cython API.
    r   Nzpyarrow_cython_example.pyxpyx_filecompiler_optstest_ld_pathsetup.pyw	build_ext	--inplaceenvpyarrow_cython_examplezif 1:
            import sys
            import os

            try:
                # Add dll directory was added on python 3.8
                # and is required in order to find extra DLLs
                # only for win32
                for dir in a*  :
                    os.add_dll_directory(dir)
            except AttributeError:
                pass

            mod = __import__('pyarrow_cython_example')
            arr = mod.make_null_array(5)
            assert mod.get_array_length(arr) == 5
            assert arr.null_count == 5
        win32add_dll_directory);PATHdarwin):DYLD_LIBRARY_PATH)r2   LD_LIBRARY_PATHr   z-c)stdoutr+   )cythonas_cwdshutilcopyfileospathjoinherestrsetup_templateformatr$   r%   openwrite	test_util get_modified_env_with_pythonpath
subprocess
check_callsys
executableinsert
__import__r    r   get_library_dirsplatformhasattrgetPIPE)tmpdirr6   r#   
setup_codefsubprocess_env	orig_pathr   codepath_vardelimpathsr;   s                r   test_cython_apirY   U   s/    	 F2/T84S[(;	= $**H9F8D + F
 *c" 	 aGGJ	 
 #CCE 	s~~z*K9"0	2
 HHQK	3v;'	!56C', CH //12 	3	& <<7"223 #.x\\X%6OE84OE8HHER((**En((2677E&+4dtT4E4',zz%'8N8$s~~tT:%/__"0	2IF2 F2	  	 & !CHL 5EF2 F2sQ   BJ #I5BJ 7I+B/J <I;I;AJ I(	#J +I88J  J	c           	      r   | j                         5  d}t        j                  t        j                  j                  t        |      t        j                  j                  t        |       |             t        j                  |t        t              }t        dd      5 }|j                  |       d d d        t        j                         }t!        j"                  t$        j&                  dddg|       d d d        t$        j                  j)                  dt        |              t+        d	      }g d
}g }|j-                  ||j.                         ||k(  sJ t1        j2                  t4        d      5  d }|j-                  ||       d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)Nz bound_function_visit_strings.pyxr"   r&   r'   r(   r)   r*   r   bound_function_visit_strings)abcwtfr   c                 $    | dk(  rt        d      y )Nr]   r_   )
ValueError)ss    r   
raise_on_bz&test_visit_strings.<locals>.raise_on_b   s    Cx ''     )r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   r$   r%   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   _visit_stringsappendr   r   ra   )	rP   r#   rQ   rR   rS   r   stringsvisitedrc   s	            r   test_visit_stringsri      sl    
 25T84S[(;	= $**H9F8D + F
 *c" 	 aGGJ	  #CCE 	s~~z*K9"0	22& HHOOAs6{#
3
4CGGw/g	z	/ 0	( 	7J/0 0'	  	 2 280 0s1   BF!F1AF!6F-F	F!!F*-F6)r:   r8   rE   rG   r   pyarrowr   pyarrow.tests.utiltestsutilrC   r;   dirnameabspath__file__r=   environrN   r%   namer$   r?   r    marknumpyr6   rY   ri    rd   r   <module>rv      s   $ 
   
   & &	wwrwwx01zz~~4b977g!NMWW_9<HMM>4" M2  M2` "0  "0rd   