
    z-Ph                        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                            e j                            e                    Ze 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        j        ej        j        d                         Zej        j        ej        j        d                         ZdS )    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          j        g d          }|                     |          dk    sJ t          j        t
          d          5  |                     d            d d d            n# 1 swxY w Y   t          j        d          }|                     |t          j                              }|t          j        d          k    sJ t          j        t          d          5  |                     |t          j
        t          j                                         d d d            d S # 1 swxY w Y   d S )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       Y/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pyarrow/tests/test_cython.pycheck_cython_example_moduler    D   s   
(999

C$$))))	y	7	7	7 # #T"""# # # # # # # # # # # # # # # 9S>>Dbgii00I	%((((((	*)
* 
* 
* 4 4 	bhrxzz223334 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4s$   A//A36A3*:D11D58D5c           	      d   ddl }|                                 5  d}t          j        t          j                            t          |          t          j                            t          |           |                     t          
                    |t          t                    }t          dd          5 }|                    |           ddd           n# 1 swxY w Y   t          j                    }t#          j        t&          j        dddg|	           t&          j        dd         }t&          j                            dt          |                      	 t-          d
          }t/          |           |t&          _        n# |t&          _        w xY wd
                    d
t1          j                              }d}	t&          j        dk    rt7          t          d          sd\  }
}	nt&          j        dk    rd\  }
}	nd\  }
}	|	r`t&          j        }|t1          j                    z  }||                    |	d          gz  }d |D             }|
                    |          ||	<   t#          j        t&          j        d|gt"          j        |           ddd           dS # 1 swxY w Y   dS )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_examplea'  if 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 {library_dirs}:
                    os.add_dll_directory(dir)
            except AttributeError:
                pass

            mod = __import__({mod_name!r})
            arr = mod.make_null_array(5)
            assert mod.get_array_length(arr) == 5
            assert arr.null_count == 5
        )mod_namelibrary_dirswin32add_dll_directory);PATHdarwin):DYLD_LIBRARY_PATH)r4   LD_LIBRARY_PATHr   c                     g | ]}||S  r8   ).0paths     r   
<listcomp>z#test_cython_api.<locals>.<listcomp>   s    444dt4T444    z-c)stdoutr+   )cythonas_cwdshutilcopyfileosr:   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)tmpdirr>   r#   
setup_codefsubprocess_env	orig_pathr   codepath_vardelimpathss               r   test_cython_apir`   U   s5    MMM	 G2 G2/T844S[[(;;	= 	= 	= $**H9F8D + F F
 *c"" 	 aGGJ	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 
 #CEE 	s~z*K9"0	2 	2 	2 	2
 HQQQK	3v;;'''	!566C',,, CHHyCH    " F4 " 3 5 5  7 7# 	( <7""2233 . #.x\X%%6OE884OE8 	9HER(***En((26677E44e444E',zz%'8'8N8$s~tT:%/_"0	2 	2 	2 	2KG2 G2 G2 G2 G2 G2 G2 G2 G2 G2 G2 G2 G2 G2 G2 G2 G2 G2sP   BJ%6CJ%C	J%C	 A;J%F:J%FDJ%%J),J)c           	         |                                  5  d}t          j        t          j                            t          |          t          j                            t          |           |                     t          	                    |t          t                    }t          dd          5 }|                    |           d d d            n# 1 swxY w Y   t          j                    }t!          j        t$          j        dddg|           d d d            n# 1 swxY w Y   t$          j                            dt          |                      t+          d	          }g d
}g }|                    ||j                   ||k    sJ t1          j        t4          d          5  d }|                    ||           d d d            d S # 1 swxY w Y   d S )Nz bound_function_visit_strings.pyxr"   r&   r'   r(   r)   r*   r   bound_function_visit_strings)abcwtfr   c                 0    | dk    rt          d          d S )Nrd   rf   )
ValueError)ss    r   
raise_on_bz&test_visit_strings.<locals>.raise_on_b   s     Cxx ''' xr<   )r?   r@   rA   rB   r:   rC   rD   rE   rF   rG   r$   r%   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   _visit_stringsappendr   r   rh   )	rW   r#   rX   rY   rZ   r   stringsvisitedrj   s	            r   test_visit_stringsro      s    
 2 25T844S[[(;;	= 	= 	= $**H9F8D + F F
 *c"" 	 aGGJ	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  #CEE 	s~z*K9"0	2 	2 	2 	22 2 2 2 2 2 2 2 2 2 2 2 2 2 2& HOOAs6{{###
3
4
4CooGGw///g	z	/	/	/ 0 0	( 	( 	( 	7J///0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0sH   BD"2CD"C	D"C	:D""D&)D&-GGG)rB   r@   rL   rN   r   pyarrowr   pyarrow.tests.utiltestsutilrJ   r:   dirnameabspath__file__rD   environrU   r%   namer$   rF   r    marknumpyr>   r`   ro   r8   r<   r   <module>r{      sM  $ 
			      



      & & & & & & & & &	wrwx0011z~~4b997g!NMMW__9<HMMM>4 4 4" N2 N2  N2b "0 "0  "0 "0 "0r<   