
    .Ph1              
           d 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 ddlmZ dd	lmZmZmZmZ d
gZdedefdZdedededeeef         fdZdede	deeef         ddfdZdS )zCore wheel installation logic.    N)BytesIO)DictTuplecast)WheelDestination)InvalidWheelSource)RecordEntry)WheelSource)SCHEME_NAMESSchemeparse_entrypointsparse_metadata_fileinstallsourcereturnc                 R   |                      d          }t          |          }|d         r|d                             d          s+d}t          | |                    |d                             |d         dk    rt          t          d          S t          t          d          S )	ziProcess the WHEEL file, from ``source``.

    Returns the scheme that the archive root should go in.
    WHEELzWheel-Versionz1.z?Incompatible Wheel-Version {}, only support version 1.x wheels.zRoot-Is-Purelibtruepurelibplatlib)read_dist_infor   
startswithr   formatr   r   )r   streammetadatamessages       O/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/installer/_core.py_process_WHEEL_filer      s    
 ""7++F"6**H _% T(?*C*N*Nt*T*T TS 8Q)R)RSSS !"f,,FI&&&FI&&&    pathroot_schemec                    |j         }t          j        || g          |k    r|| fS g }d}| }	 t          j        |          \  }}|                    |           ||j         k    r|}n;|t
          vr&d}t          ||                    |                     t          t          |          t          j
        t          |dd                    fS )z;Determine which scheme to place given path in, from source.NTz6{path} is not contained in a valid .data subdirectory.)r    )data_dir	posixpathcommonprefixsplitappendr   r   r   r   r   joinreversed)	r    r   r!   r$   partsscheme_nameleftrightmsg_fmts	            r   _determine_schemer0   $   s     H x.//8;;D   EKDod++eU6?""K ,&&J T)B)BCCC$$inhuSbSz6J6J&KKKr   destinationadditional_metadatac                    t          |           }t          j        | j        d          }g }d| j        v ri|                     d          }t          |          D ]D\  }}}	}
|                    |||	|
          }|                    t          d          |f           E| 
                                D ]g\  }}}t          j        | }|j        }||k    r"t          || |          \  }}|                    ||||          }|                    ||f           h|                                D ]v\  }}t          j        | j        |          }t#          |          5 }|                    |||d          }ddd           n# 1 swxY w Y   |                    ||f           w|                    |t          |dd          f           |                    |||	           dS )
a!  Install wheel described by ``source`` into ``destination``.

    :param source: wheel to install.
    :param destination: where to write the wheel.
    :param additional_metadata: additional metadata files to generate, usually
                                generated by the caller.

    RECORDzentry_points.txt)namemoduleattrsectionscripts)r    r   r!   )schemer    r   is_executableFN)r:   record_file_pathrecords)r   r%   r)   dist_info_dirdist_info_filenamesr   r   write_scriptr(   r   get_contentsr	   from_elementsr    r0   
write_fileitemsr   finalize_installation)r   r1   r2   r!   r<   written_recordsentrypoints_textr5   r6   r7   r8   recordrecord_elementsr   r;   source_recordr    r:   destination_pathfilenamecontentsother_streams                         r   r   r   @   s    &f--K !~f&:HEEO V777!001CDD+<=M+N+N 	@ 	@'D&$ --	 .  F ""F9$5$5v#>???? 392E2E2G2G 1 1.#1?C!### $5#$
 $
 $
  
 ''!'	 ( 
 
 	/0000 27799 
6 
6(~f2H==X 	, ++"##	 ,  F	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	V45555K5EtT)R)RSTTT%%) &     s   FF		F	)__doc__r%   ior   typingr   r   r   installer.destinationsr   installer.exceptionsr   installer.recordsr	   installer.sourcesr
   installer.utilsr   r   r   r   __all__r   strr0   bytesr    r   r   <module>r[      sv   $ $           $ $ $ $ $ $ $ $ $ $ 3 3 3 3 3 3 3 3 3 3 3 3 ) ) ) ) ) ) ) ) ) ) ) ) X X X X X X X X X X X X+' ' ' ' ' '(L
L"L17L
63;L L L L8GG!G c5j)G 
	G G G G G Gr   