§
    ƒÛgý  ã                   óÒ  — d dl Z d dlmZ d dlm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Z d dlmZ d dlmZ e j        j        j        Ze j        j        j        Ze j        j        j        Ze j        j        Zddd	œZd
„ Z ej        ed ¦  «        Z ej        ed¦  «        Zed„ ¦   «         Z ej        d¬¦  «        d„ ¦   «         Z G d„ de ¦  «        Z! G d„ de ¦  «        Z"d„ Z#d„ Z$dS )é    N)Ú	build_ext)ÚDistribution)Úmkdtemp)Úcontextmanager)ÚPath)z.dllz.pyd)ú.sor   )ÚwinÚdefaultc                 ó~   — t                                t          j        d d…         t           d         ¦  «        |          S )Né   r
   )Ú_configsÚgetÚsysÚplatform©Úargs    úI/granary/edev/quantum/lib/python3.11/site-packages/numba/pycc/platform.pyÚget_configsr      s+   € Ý�<Š<�œ R a RÔ(­(°9Ô*=Ñ>Ô>¸sÔCÐCó    é   c              #   ó®  K  — 	 t          ¦   «         }t          t          j                             |d| z  ¦  «        d¦  «        }|V — 	 |                     ¦   «          t          j        |¦  «         t          j        |¦  «         d S #  Y d S xY w# 	 |                     ¦   «          t          j        |¦  «         t          j        |¦  «         w #  Y w xY wxY w)Nztemp%sÚwt)r   ÚopenÚosÚpathÚjoinÚcloseÚremoveÚrmdir)ÚsuffixÚtmpdirÚntfs      r   Ú_gentmpfiler#   #   sÎ   è è € ðÝ‘”ˆÝ•2”7—<’< ¨°6Ñ(9Ñ:Ô:¸DÑAÔAˆØˆ	ˆ	ˆ	ð	Ø�IŠI‰KŒKˆKÝŒI�c‰NŒNˆNõ ŒH�VÑÔÐÐÐøð	ØˆDˆDøøøøð		Ø�IŠI‰KŒKˆKÝŒI�c‰NŒNˆNõ ŒH�VÑÔÐÐøð	ØˆDøøøøøøs0   „AB Á(B ÂBÂCÂ(CÂ8CÃCÃC)Úmaxsizec                  ó¤  — t          ¦   «         } t          | ¦  «         dD ]¯}	 t          |¦  «        5 }d}|                     |¦  «         |                     ¦   «          |                     ¦   «          |                      |j        gt          |j        ¦  «        j	        ¬¦  «         ddd¦  «         n# 1 swxY w Y   Œž# t          $ r Y  dS w xY wdS )zv
    Returns True if the "external compiler" bound in numpy.distutil is present
    and working, False otherwise.
    )z.cz.cxxzint main(void) { return 0; })Ú
output_dirNFT)Únew_compilerÚcustomize_compilerr#   ÚwriteÚflushr   ÚcompileÚnamer   ÚanchorÚ	Exception)Úcompilerr    r"   Úsimple_cs       r   Úexternal_compiler_worksr1   5   s&  € õ ‰~Œ~€HÝ�xÑ Ô Ð Ø ð ð ˆð
	Ý˜VÑ$Ô$ð O¨Ø9�Ø—	’	˜(Ñ#Ô#Ð#Ø—	’	‘”�Ø—	’	‘”�ð × Ò  #¤( ½¸S¼X¹¼Ô8MÐ ÑNÔNÐNðOð Oð Oñ Oô Oð Oð Oð Oð Oð Oð Oøøøð Oð Oð Oð Oøøõ ð 	ð 	ð 	Ø�5�5�5ð	øøøàˆ4s5   £B>²A4B2Â&B>Â2B6	Â6B>Â9B6	Â:B>Â>
CÃCc                   ó   — e Zd Zg ZdS )Ú_DummyExtensionN)Ú__name__Ú
__module__Ú__qualname__Ú	libraries© r   r   r3   r3   L   s   € € € € € Ø€I€I€Ir   r3   c                   ó‚   — e Zd Zd„ Zed„ ¦   «         Zej        d„ ¦   «         Zd„ Z	 	 dd„Z	 	 	 dd„Z	d	„ Z
d
„ Zd„ Zd„ ZdS )Ú	Toolchainc                 óÎ  — t          ¦   «         s|                      ¦   «          d| _        t          ¦   «         | _        t          | j        ¦  «         t          t          ¦   «         ¦  «        | _        | j         	                    ¦   «          | j        j
        | _        | j        j        | _        dt          j        ¦   «         gi}t           j        dk    rg |d<   ndg|d<   || _        d S )NFÚinclude_dirsÚwin32r7   Úm)r1   Ú_raise_external_compiler_errorÚ_verboser'   Ú	_compilerr(   r   r   Ú
_build_extÚfinalize_optionsÚlibrary_dirsÚ_py_lib_dirsr<   Ú_py_include_dirsÚnpÚget_includer   r   Ú
_math_info)ÚselfÚnp_compile_argss     r   Ú__init__zToolchain.__init__R   sË   € Ý&Ñ(Ô(ð 	2Ø×/Ò/Ñ1Ô1Ð1àˆŒÝ%™œˆŒÝ˜4œ>Ñ*Ô*Ð*Ý#¥L¡N¤NÑ3Ô3ˆŒØŒ×(Ò(Ñ*Ô*Ð*Ø œOÔ8ˆÔØ $¤Ô <ˆÔØ)­B¬NÑ,<Ô,<Ð+>Ð@ˆÝŒ<˜7Ò"Ð"Ø+-ˆO˜KÑ(Ð(à,/¨6ˆO˜KÑ(Ø)ˆŒˆˆr   c                 ó   — | j         S ©N)r@   ©rJ   s    r   ÚverbosezToolchain.verbosed   s
   € àŒ}Ðr   c                 óx   — || _         t                               |rt          j        nt          j        ¦  «         d S rN   )r@   ÚlogÚset_thresholdÚINFOÚWARN)rJ   Úvalues     r   rP   zToolchain.verboseh   s2   € àˆŒõ 	×Ò eÐ9�#œ(˜(µ´Ñ:Ô:Ð:Ð:Ð:r   c                 óŽ  — d}d}t           j        }|                     d¦  «        r7t           j        dk    rddg}nddg}|›d	|d	                     |¦  «        z  ›�}n[|                     d
¦  «        r"ddg}|›d	|d	                     |¦  «        z  ›�}n$|                     d¦  «        r
d}|›d	|›�}nd|z  }t          |¦  «        ‚)NzYAttempted to compile AOT function without the compiler used by `numpy.distutils` present.z(If using conda try:

#> conda install %sÚlinuxl        zgcc_linux-32zgxx_linux-32zgcc_linux-64zgxx_linux-64ú Údarwinzclang_osx-64zclangxx_osx-64r=   zCannot find suitable msvc.zUnknown platform %s)r   r   Ú
startswithr$   r   ÚRuntimeError)rJ   ÚbasemsgÚ	conda_msgÚpltÚ	compilersÚmsgÚwinmsgs          r   r?   z(Toolchain._raise_external_compiler_erroro   s÷   € ðAˆà@ˆ	ÝŒlˆØ�>Š>˜'Ñ"Ô"ð 	.ÝŒ{˜gÒ%Ð%Ø+¨^Ð<�	�	à+¨^Ð<�	Ø$˜W˜W i°#·(²(¸9Ñ2EÔ2EÑ&EÐ&EÐFˆCˆCØ�^Š^˜HÑ%Ô%ð 	.Ø'Ð)9Ð:ˆIØ$˜W˜W i°#·(²(¸9Ñ2EÔ2EÑ&EÐ&EÐFˆCˆCØ�^Š^˜GÑ$Ô$ð 	.Ø1ˆFØ$˜W˜W f fÐ-ˆCˆCà'¨#Ñ-ˆCÝ˜3ÑÔÐr   r8   Nc                 óJ   — | j                              |||||pg |¬¦  «        }|S )aÖ  
        Compile the given source files into a separate object file each,
        all beneath the *output_dir*.  A list of paths to object files
        is returned.

        *macros* has the same format as in distutils: a list of 1- or 2-tuples.
        If a 1-tuple (name,), the given name is considered undefined by
        the C preprocessor.
        If a 2-tuple (name, value), the given name is expanded into the
        given value by the C preprocessor.
        )r&   r<   ÚdependsÚmacrosÚextra_preargs)rA   r+   )rJ   Úsourcesr&   r<   rd   re   Úextra_cflagsÚobjectss           r   Úcompile_objectszToolchain.compile_objects„   s>   € ð ”.×(Ò(¨Ø4>Ø6BØ18Ø06°¸"Ø7Cð )ñ Eô Eˆð ˆr   c           
      ó¢   — t           j                             |¦  «        \  }}| j                             t
          j        |||||||¬¦  «         dS )zu
        Create a shared library *output* linking the given *objects*
        and *libraries* (all strings).
        )Úexport_symbolsrf   N)r   r   ÚsplitrA   ÚlinkÚ	CCompilerÚSHARED_OBJECT)	rJ   Úoutputri   r7   rD   rl   Úextra_ldflagsr&   Úoutput_filenames	            r   Úlink_sharedzToolchain.link_sharedš   s\   € õ ')¤g§m¢m°FÑ&;Ô&;Ñ#ˆ
�OØŒ×Ò�IÔ3°WØ+¨ZØ% |Ø+9Ø*7ð	 	ñ 	9ô 	9ð 	9ð 	9ð 	9r   c                 óš   — | j                              t          ¦   «         ¦  «        }t          j        dk    r|dgz   }|| j        d         z   S )zJ
        Get the library arguments necessary to link with Python.
        r=   Úmsvcrtr7   )rB   Úget_librariesr3   r   r   rI   )rJ   Úlibss     r   Úget_python_librarieszToolchain.get_python_libraries¨   sL   € ð Œ×,Ò,­_Ñ->Ô->Ñ?Ô?ˆÝŒ<˜7Ò"Ð"ð ˜8˜*Ñ$ˆDØ�d”o kÔ2Ñ2Ð2r   c                 ó*   — t          | j        ¦  «        S )zL
        Get the library directories necessary to link with Python.
        )ÚlistrE   rO   s    r   Úget_python_library_dirsz!Toolchain.get_python_library_dirs´   s   € õ �DÔ%Ñ&Ô&Ð&r   c                 óF   — t          | j        ¦  «        | j        d         z   S )zo
        Get the include directories necessary to compile against the Python
        and Numpy C APIs.
        r<   )r{   rF   rI   rO   s    r   Úget_python_include_dirsz!Toolchain.get_python_include_dirsº   s!   € õ
 �DÔ)Ñ*Ô*¨T¬_¸^Ô-LÑLÐLr   c                 ó6   — | j                              |¦  «        S )zR
        Given a C extension's module name, return its intended filename.
        )rB   Úget_ext_filename)rJ   Úext_names     r   r€   zToolchain.get_ext_filenameÁ   s   € ð Œ×/Ò/°Ñ9Ô9Ð9r   )r8   r8   r8   N)r4   r5   r6   rL   ÚpropertyrP   Úsetterr?   rj   rt   ry   r|   r~   r€   r8   r   r   r:   r:   P   sä   € € € € € ð*ð *ð *ð$ ðð ñ „Xðð „^ð;ð ;ñ „^ð;ð ð  ð  ð, =?Ø%)ðð ð ð ð, 68Ø46Ø"&ð9ð 9ð 9ð 9ð
3ð 
3ð 
3ð'ð 'ð 'ðMð Mð Mð:ð :ð :ð :ð :r   r:   c                 ó    — d| vr	d| v rd| z  S | S )zB
    Quote the argument for safe use in a shell command line.
    ú"rY   z"%s"r8   r   s    r   Ú
_quote_argr†   È   s$   € ð �#€~€~˜# ˜*˜*Ø˜‰|ÐØ€Jr   c                 ó„   — t          | t          t          f¦  «        rdS 	 t          | ¦  «         dS # t          $ r Y dS w xY w)NFT)Ú
isinstanceÚstrÚbytesÚlenr.   r   s    r   Ú_is_sequencerŒ   Ó   sT   € Ý�#��U�|Ñ$Ô$ð ØˆuðÝˆC‰ŒˆØˆtøÝð ð ð Øˆuˆuðøøøs    1 ±
?¾?)%Ú
setuptoolsÚsetuptools.command.build_extr   Úsetuptools.distr   ÚnumpyrG   Ú	functoolsr   Ú
subprocessr   Útempfiler   Ú
contextlibr   Úpathlibr   Ú	distutilsÚ	ccompilerro   r'   Ú	sysconfigr(   rR   r   r   ÚpartialÚfind_shared_endingÚfind_pyext_endingr#   Ú	lru_cacher1   Úobjectr3   r:   r†   rŒ   r8   r   r   ú<module>rž      sõ  ðØ Ð Ð Ð Ø 2Ð 2Ð 2Ð 2Ð 2Ð 2Ø (Ð (Ð (Ð (Ð (Ð (Ø Ð Ð Ð à Ð Ð Ð Ø 	€	€	€	Ø Ð Ð Ð Ø 
€
€
€
Ø Ð Ð Ð Ð Ð Ø %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ð Ð ð Ô!Ô+Ô5€	ØÔ$Ô.Ô;€ØÔ)Ô3ÔFÐ ØÔÔ€ð
 Øðð €ðDð Dð Dð '�YÔ& {°AÑ6Ô6Ð Ø%�IÔ% k°1Ñ5Ô5Ð àðð ñ „ðð" €Ô˜QÐÑÔðð ñ  Ôðð,ð ð ð ð �fñ ô ð ðu:ð u:ð u:ð u:ð u:�ñ u:ô u:ð u:ðpð ð ðð ð ð ð r   