
    8xdU                         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ZmZm	Z	m
Z
mZ ej                            d          Zd Zd Zd Zd Zd
dZd	 ZdS )    N)basenamedirnameisdirisfilejoinwinc                 P    t          |           st          j        |            d S d S N)r   osmakedirs)r   s    9lib/python3.11/site-packages/conda_build/noarch_python.py
_force_dirr      s0    >> 
G     c                 4    t          j        d| z             d S )Nz[noarch_python] %s)sysexit)exit_messages    r   _error_exitr      s    H!L011111r   c                    t          |t          rdnd|           }t          j                    }|dk    rd}t	          ||          5 }	 |                                }n"# t          $ r t          d| z             Y nw xY wddd           n# 1 swxY w Y   t          j	        |          j
        }t          j        |           t          r|                     d          r
| dd	         } t          |d
          }t          |           t          ||           }t	          |d          5 }	|	                    |           ddd           n# 1 swxY w Y   t          j        ||           | S )zTake a file from the bin directory and rewrite it into the python-scripts
    directory with the same permissions after it passes some sanity checks for
    noarch pacakgesScriptsbinzANSI_X3.4-1968zUTF-8)encodingz)Noarch package contains binary script: %sN
-script.pyipython-scriptsw)r   ISWINlocalegetpreferredencodingopenreadUnicodeDecodeErrorr   r   statst_modeunlinkendswithr   writechmod)
fnprefixsrcr   fidatasrc_modedst_dirdstfos
             r   rewrite_scriptr1      s    vE4yyub
9
9C*,,H###	cH	%	%	% J	J7799DD! 	J 	J 	JCbHIIIII	JJ J J J J J J J J J J J J J J
 ws||#HIcNNN  \** X 6+,,Gw
w

C	c3 2
              HS(IsH   B	ABA=:B<A==BBB)EEEc                 H   t          ||           }|                     d          rt          j        |           dS |                     d          rmt	          t          j                             || dd         dz                       st          | dd                   |d         v rt          j        |           dS d| v rt          |d          }t          |           | |                     d          d         }t          ||          }t          |          }t          |           t          j        ||           |d                             |dd                    dS |                     d	          r<t          |          }t          ||          }|d                             |           dS |                     d
          r%|d                             | dd                    dS t          j        t"                    }	|	                    d| z             dS )z8Process a file for inclusion in a noarch python package.)z	.egg-infoz.pycz.pyoz.exeNr   r   site-packages   )zbin/r   )z	Examples/z	Examples\Examples	   z7Don't know how to handle file: %s.  Including it as-is.)r   r%   r   r$   r   pathr   r   findr   shutilmoveappend
startswithr1   logging	getLogger__name__debug)
fdr)   r8   nspgr/   r.   r(   logs
             r   handle_filerG   8   s   ??D 	zz/00 "Q
	$	
F		 Qrw||FAcrcF\$9::;;QAcrcFq!1222
	$	A		6?++3aff_%%''(61oo#,,7D#	/!!!BCC&))))) 
)	*	* Qd^^B''	
""2&&&&& 
1	2	2 Q	*QqrrU#####
 ))		KaOPPPPPr   c                    |                                  g g g d}|D ]}t          |||           t          rA|d         |d         fD ]0}t          |          D ]\  }}|                    dd          ||<   1|rH|D ]E}	t          ||	          }
t          j                            |
          rt          j	        |
           F|S )N)distr4   r   r6   r4   r6   \/)
rI   rG   r   	enumeratereplacer   r   r8   r   r$   )mfilesr)   entry_point_scriptsrC   rB   fnsir(   entry_pointr*   s              r   populate_filesrT   b   s    B"RTUUA  " "Aq&!!!!  /o&*6 	/ 	/C"3 / /2D#..A/  . 	 	Kv{++Cw~~c"" 	#Hr   c                    t          |d          }t          |           t          |d          }t          |           |                                 }t          t          |d|z            d          5 }|                    d           d d d            n# 1 swxY w Y   t          t          |d|z            d          5 }|                    d                    dd	                              d
                     d d d            n# 1 swxY w Y   t          | ||          }t          t                    }|d         r6dD ]3}	t          j        t          ||	          t          ||	                     4t          t          |d                    5 }
|
                                }d d d            n# 1 swxY w Y   t          t          |d          d          5 }|                    d           t          j        ||dd           |                    d           |                    |           d d d            d S # 1 swxY w Y   d S )Nr   r   z.%s-pre-link.shwbs?       #!/bin/bash
    $PREFIX/bin/python $SOURCE_DIR/link.py
    z.%s-pre-link.batzC    @echo off
    "%PREFIX%\python.exe" "%SOURCE_DIR%\link.py"
    
z
zutf-8r   )z
cli-32.exez
cli-64.exez_link.pyzlink.pyr   zDATA =    T)indent	sort_keysz
## END DATA

)r   r   namer   r&   rM   encoderT   r   __file__r:   copyfiler    jsondump)rN   rO   r)   bin_dirscripts_dirr[   r0   rC   this_dirr(   r+   	link_codes               r   	transformre   x   sB   65!!Gwvy))K{6688D 
d7-455t	<	< 

	
 	
 	

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d; 2T 9::D	A	A 

R
 	f	 	f 		
 		
 		


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 	q%((A x  H 		 B, 	B 	BBOD2..VR0@0@AAAA 
d8Z((	)	) RGGII	               
d69%%s	+	+ r
	!RT2222
$%%%
	                 sI   4BBB=DDDF77F;>F; AII	I	r
   )r_   r   r>   r   r:   r   os.pathr   r   r   r   r   platformr=   r   r   r   r1   rG   rT   re    r   r   <module>ri      s       				  



 : : : : : : : : : : : : : :&&  
2 2 2  B'Q 'Q 'QT   ,3 3 3 3 3r   