
    G/PhuK                     N   d Z ddlZddlmZ ddlZddlmZ ddlmZm	Z	m
Z
 ddlmZ ddlmZ ddlmZmZmZmZmZmZ dd	lmZ ej        Z e ee                    D ]8Zee         d         d
v r&ee         d         dz   fee         dd         z   ee<   9 G d de          ZdS )zC Modified version of build_clib that handles fortran source files.
    N)glob)
build_clib)DistutilsSetupErrorDistutilsErrorDistutilsFileError)log)newer_group)filter_sourcesget_lib_source_filesget_numpy_include_dirshas_cxx_sourceshas_f_sourcesis_sequence)new_ccompiler_opt)z
build-clibz
build-temp=   c                   x    e Zd ZdZej        g dz   Zej        g dz   Zd Zd Zd Z	d Z
d Zd	 Zd
 Zd Zd ZdS )r   z1build C/C++/F libraries used by Python extensions))z
fcompiler=Nz!specify the Fortran compiler type)inplaceizBuild in-place)z	parallel=jznumber of parallel jobs)
warn-errorNz'turn all warnings into errors (-Werror))zcpu-baseline=Nz4specify a list of enabled baseline CPU optimizations)zcpu-dispatch=Nz.specify a list of dispatched CPU optimizations)disable-optimizationNz1disable CPU optimized code(dispatch,simd,fast...))r   r   r   c                     t          j        |            d | _        d| _        d | _        d | _        d | _        d | _        d | _        d S )Nr   )	old_build_clibinitialize_options	fcompilerr   parallel
warn_errorcpu_baselinecpu_dispatchdisable_optimization)selfs    b/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/numpy/distutils/command/build_clib.pyr   zbuild_clib.initialize_options1   sM    )$///  $(!!!    c                     | j         r=	 t          | j                   | _         n"# t          $ r}t          d          |d }~ww xY wt          j        |            |                     dddddd           d S )Nz)--parallel/-j argument must be an integerbuild)r   r   )r   r   )r   r   )r    r    )r!   r!   )r   int
ValueErrorr   finalize_optionsset_undefined_options)r"   es     r#   r)   zbuild_clib.finalize_options<   s    = 	UU #DM 2 2 U U U !LMMSTTU'---""7(@(D(H(H(X	$ 	$ 	$ 	$ 	$s   # 
A=Ac                 l    | j         D ]+\  }}t          |                    dg                     r dS ,dS NsourcesTF)	librariesr   getr"   lib_name
build_infos      r#   have_f_sourceszbuild_clib.have_f_sourcesK   sG    &*n 	 	"XzZ^^Ir::;; ttur$   c                 l    | j         D ]+\  }}t          |                    dg                     r dS ,dS r-   )r/   r   r0   r1   s      r#   have_cxx_sourceszbuild_clib.have_cxx_sourcesQ   sG    &*n 	 	"Xzz~~i<<== ttur$   c                    | j         sd S g }|                     d           | j         D ]6\  }}|                    dd           }|r||vr|                    |           7ddlm}  || j        | j        | j                  | _        | j        	                    | j
        |                                            | j        r>| j        j                            d           | j        j                            d           | j         }d | _         | j                            |            || _         | j                                         | j        st"          j                            dd	d
d          }t"          j                            |                     d          j        |          }t"          j                            t"          j                            | j        d                    }t1          | d          r| j                                         t7          | j        || j        | j        |          | _        d }	dd l}
|
                    |	| j                   |                                  rddl!m"}  || j#        | j$        | j        | j        d|v | j                  | _%        | j%        g| j%        	                    | j
                   | j         }d | _         | j%                            |            || _         | j%                                         nd | _%        | &                    | j                    | j'        r| j
        j(        D ]}| j        )                    |j*                  }t"          j                            | j+        |          }t"          j                            |j,        |          }| -                    |j,                   t]          j/        ||           d S d S )N	build_srclanguager   )new_compiler)compilerdry_runforce)need_cxxz-Werrornumpy	distutilsincludeznpy_cpu_dispatch_config.hzccompiler_opt_cache_clib.pycompiler_opt)r;   dispatch_hpathr   r    
cache_pathc                 ~    t          j        d           t          j        |                     d                     d S )Nz3
########### CLIB COMPILER OPTIMIZATION ###########T)full)r   inforeport)copts    r#   rH   zbuild_clib.run.<locals>.report   s7    OPPP$//00000r$   new_fcompilerf90r;   verboser<   r=   
requiref90
c_compiler)0r/   run_commandr0   appenddistutils.ccompilerr:   r;   r<   r=   	customizedistributionr6   r   compiler_socustomize_cmdshow_customizationr!   ospathjoinget_finalized_commandr8   abspath
build_temphasattrrB   cache_flushr   r   r    atexitregisterr4   numpy.distutils.fcompilerrK   r   rN   _f_compilerbuild_librariesr   installed_librarieslibrary_filenamenamer   
target_dirmkpathshutilcopy)r"   	languagesr2   r3   lr:   r/   rC   opt_cache_pathrH   ra   rK   libnamesourcetargets                  r#   runzbuild_clib.runW   s   ~ 	F 	 	%%%&*n 	$ 	$"Xzz400A $Qi''  ###444444$dm-1\+/:7 7 7 	 1)-)>)>)@)@ 	  	B 	B 	B ? 	8M")))444M%,,Y777N	##D)))"((***( 	7W\\';	KfggNW\\$*D*D[*Q*Q*[]kllNW__T_.KLL N t^,, 0 !--/// 1~!.T=N)! ! !D
1 1 1 MMMOOFD$5666   	$??????,}dn59\59\37:8=8J8< G  G  GD + **4+<=== N	!% ..t444!* 33555#DT^,,,< 	,&: , ,-88@@dow??alG<<AL)))FF++++	, 	,, ,r$   c                     |                      | j                   g }| j        D ]$}|                    t          |                     %|S N)check_library_listr/   extendr   )r"   	filenameslibs      r#   get_source_fileszbuild_clib.get_source_files   sT    ///	> 	8 	8C1#667777r$   c                 D    |D ]\  }}|                      |||           d S ru   )build_a_library)r"   r/   r2   r3   s       r#   re   zbuild_clib.build_libraries   s?    &/ 	B 	B"Xz  XyAAAA	B 	Br$   c                     |g S g }|D ]5}t          |          r| ||           z  } |                    |           6|S )ah   Assemble flags from flag list

        Parameters
        ----------
        in_flags : None or sequence
            None corresponds to empty list.  Sequence elements can be strings
            or callables that return lists of strings. Callable takes `self` as
            single parameter.

        Returns
        -------
        out_flags : list
        )callablerR   )r"   in_flags	out_flagsin_flags       r#   assemble_flagszbuild_clib.assemble_flags   sd     I	 	* 	*G   *WWT]]*		  ))))r$   c                 |  01 | j         }| j        }|                    d          }|t          |          st	          d|z            t          |          }t          |          \  }}}	}
|
  p|                    dd          dk    }g }|r|                    d           |r|                    d           |r|                    d           n|	r|                    d           ||d<   |                    || j	        	          }||                    d
g           z   }| j
        }| j        s/| j                                        st          j        d           d}|s(t!          ||d          st          j        d|           d S t          j        d|           |                    di           }||rt          j        d|           ddlm}  ||j        | j        | j        | j
        || j                   }|X| j        }|                    d                                          }|                    |           |                    |           |	s|
r|t9          d|z            |8|                    d          pg |_        |                    d          pg |_        |                    d          }|g }|                    d          }|g }|                     |                    d                    }|                     |                    d                    }|                     |                    d                    }|                     tC                                 |                    d          pg }tD          j#        $                    |          }|r| %                    |           |j        dk    r||z  }g }||z  }g }g }g }g }| j        s| &                    d          j'        }tD          j#        (                    d d!d"          } tD          j#        (                    ||           } |                    |            |}!|f|d#f||f|d$ffD ]%\  }"}#0|"D ]1|#01fd%1d d          D             z  }#&| j        )                                }n|                    d&           g }$|rIt          j        d'           |$| j        *                    || j+        |!||z   || j        ||z   |%(          z  }$|rHt          j        d)           |$| j        *                    || j+        |!||z   || j        ||z   *          z  }$|rEt          j        d+           |$|,                    || j+        ||z   || j        ||z   |z   ,          z  }$|rkt          j        d-           |-                                }%|%,                    || j+        ||z   || j        ||z   |z   ,          }&|$                     |&           |	s|
rg }g }'|r/|j.        t_          d.          }(||0                    ||          z  }|
r<t          j        d/           |'|,                    |
| j+        ||| j        |,          z  }'|r| j        j.        t_          d.          D ]})|)|(v rtD          j#        (                    ||)          }*tD          j#        1                    |)          tD          j#        1                    |*          k    rhtD          j#        2                    |*          rtE          j3        |*           	 | 4                    |)|           # tj          $ r t          j6        d0|)d1|           Y w xY w|	r<t          j        d2           |'|,                    |	| j+        ||| j        |,          z  }'ng }'|'rq|7                    |          s[tD          j#        (                    | j	        |d3z             }+tq          |+d4          5 })|)9                    d5(                    d6 |'D                                  d d d            n# 1 swxY w Y   tD          j#        (                    | j	        |d7z             }+tq          |+d4          5 })|)9                    d5(                    d8 |$D                                  d d d            n# 1 swxY w Y   tD          j#        (                    | j	        ||j:        z             },tq          |,d9          5 })	 d d d            n# 1 swxY w Y   n8|$                     |'           |;                    |$|| j	        | j        :           |                    d;g           }-|D ]2\  }.}/|.|-v r)|-                     |/                    d;g                      3|-r|-|d;<   d S d S )<Nr.   zfin 'libraries' option (library '%s'), 'sources' must be present and must be a list of source filenamesr9   crL   zc++f77source_languages)
output_dirdependsz*Detected changes on compiler optimizationsTnewerz"skipping '%s' library (up-to-date)zbuilding '%s' library	config_fczCusing additional config_fc from setup script for fortran compiler: r   rJ   rM   z<library %s has Fortran sources but no Fortran compiler foundextra_f77_compile_argsextra_f90_compile_argsmacrosinclude_dirsextra_compiler_argsextra_cflagsextra_cxxflagsmodule_dirsmsvcr8   r?   r@   rA   )z.dispatch.c)z.dispatch.cppz.dispatch.cxxc                     g | ]?}|                                                                       |                    @S  )endswithpopindex).0s_ext_srcs     r#   
<listcomp>z.build_clib.build_a_library.<locals>.<listcomp>K  sP       AJJt,<,<A//  r$   )NPY_DISABLE_OPTIMIZATIONr   z#compiling C++ dispatch-able sources)r   src_dirr   r   debugextra_postargs	ccompilerz!compiling C dispatch-able sources)r   r   r   r   r   r   zcompiling C sources)r   r   r   r   r   zcompiling C++ sourcesz*.modz#compiling Fortran 90 module sourceszfailed to move z to zcompiling Fortran sourcesz	.fobjectsw
c              3   T   K   | ]#}t           j                            |          V  $d S ru   rY   rZ   r]   r   objs     r#   	<genexpr>z-build_clib.build_a_library.<locals>.<genexpr>  s0      !L!L3"'//#"6"6!L!L!L!L!L!Lr$   z	.cobjectsc              3   T   K   | ]#}t           j                            |          V  $d S ru   r   r   s     r#   r   z-build_clib.build_a_library.<locals>.<genexpr>  s0      !J!J3"'//#"6"6!J!J!J!J!J!Jr$   wb)r   r   r/   )<r;   rd   r0   r   r   listr
   rR   rg   r   r=   r!   rB   	is_cachedr   r   r	   rG   rc   rK   compiler_typerN   r<   rU   get_option_dictrl   updaterT   r   r   r   r   rw   r   rY   rZ   dirnamerj   r\   r8   r[   cpu_baseline_flagstry_dispatchr^   compilecxx_compilermodule_dir_switchr   module_optionsr]   isfileremove	move_filer   warncan_ccompiler_linkopenwritestatic_lib_extensioncreate_static_lib)2r"   r3   r2   r/   r;   r   r.   	c_sourcescxx_sources	f_sourcesfmodule_sourcesrO   r   lib_filer   force_rebuildr   rK   distbase_config_fcr   r   r   r   r   r   module_build_dircopt_c_sourcescopt_cxx_sourcescopt_baseline_flagscopt_macrosbsrc_dirrC   copt_build_src_srcs_dstobjectsr   cxx_objects	f_objectsexisting_modulesftlistfn	lib_fnameclib_librarieslnamebinfor   r   s2                                                   @@r#   r|   zbuild_clib.build_a_library   st   =$	..++?+g"6"6?% (DGO'P Q Q Q w-- W%% 	;	;	?,,, 5NN:s++u4 	  	)##C((( 	+##E*** 	+##E**** 	+##E***)9
%&,,X8< - I IJNN9b999
( 	!1B1L1L1N1N 	!IBCCC M 	8Wh!H!H 	8I:HEEEFH,h777NN;33	 Y HH!	$ % % % @?????%y/F.2l.2l,0J1;15@ @ @I $(!%!5!5k!B!B!G!G!I!I%%i000##N333  	P 	Pi.?  "BEM"O P P P  /9~~(0* 0* 00-/ ,/9~~(0* 0* 00-/ , ))>F!~~n55L,,NN0113 3**NN>**, ,,,NN+,,. . 	244555 nn]339r7??844 	*KK()))!V++ $IKN*L  ( 	@11+>>HHW\\';	JJNW\\(NCCN///%N~/?@[)+;68& 	 	!tT
 "  D     !%aaa   DD
 #'"3"F"F"H"H>??? 	H:;;;t(55?&+)j->& 6 	 	 	G  		>H8999t(55?&+)j-< 6 > > >G  
	/H*+++x''?+)j . 3!4 ,!- ( / / /G  	(H,---#0022L&..?+)j . 3!4 .!/ / 1 1K NN;''' ,	 ,	NI 3.6'+G}}$)":":!1#3 #3 3  N>???Y..:>/6<<H59Z>L / N N N	  :d.@Hg : :A,,, %5q99Awq))RW__Q-?-??? w~~a(( %	!:q*:;;;;- : : :$%AA'7'7"9 : : : : ::  N4555Y..y:>/6<<H59Z>L / N N N	 I 	9Y99(CC 	9 W\\$/"*["8: :Ffc"" Na		!L!L)!L!L!LLLMMMN N N N N N N N N N N N N N N W\\$/"*["8: :Ffc"" La		!J!J'!J!J!JJJKKKL L L L L L L L L L L L L L L T_%-0M%MO OIi&& !              
 NN9%%%&&w26/-1Z ' 9 9 9
 $R88% 	B 	BLE5&&%%eiiR&@&@AAA 	5&4J{###	5 	5sH   :]$]87]83aaa3cccd$$d(+d(N)__name__
__module____qualname__descriptionr   user_optionsboolean_optionsr   r)   r4   r6   rs   rz   re   r   r|   r   r$   r#   r   r      s        EK!. 2 2 2 L  %45556O) ) )$ $ $    X, X, X,t  B B B  0A5 A5 A5 A5 A5r$   r   )__doc__rY   r   rk   distutils.command.build_clibr   r   distutils.errorsr   r   r   numpy.distutilsr   distutils.dep_utilr	   numpy.distutils.misc_utilr
   r   r   r   r   r   numpy.distutils.ccompiler_optr   r   _lrangelen_ir   r$   r#   <module>r      s    				        E E E E E E                 * * * * * *                < ; ; ; ; ;  
%B.. 1 1B	"vay000R&)c/#bfQRRj02{5 {5 {5 {5 {5 {5 {5 {5 {5 {5r$   