+
    i#'                         R t ^ RIt^ RIt^ RIHtHt ^ RIHt ^ RIH	t	 ^ RI
HtHtHt ^ RIHtHt ^ RIHt ^ RIHtHtHtHtHtHt ]'       d	   ^ R	IHtHt  ! R
 R4      t] ! R R]4      4       tR# )z:Handles all file writing and post-installation processing.N)
CollectionIterable)	dataclass)Path)TYPE_CHECKINGBinaryIOUnion)HashRecordEntry)Script)_WINDOWSSchemeconstruct_record_filecopyfileobj_with_hashingfix_shebangmake_file_executable)LauncherKindScriptSectionc                   Z   a  ] tR t^t o RtV 3R lR ltV 3R lR ltV 3R lR ltRtV t	R	# )
WheelDestinationzHandles writing the unpacked files, script generation and ``RECORD`` generation.

Subclasses provide the concrete script generation logic, as well as the RECORD file
(re)writing.
c          
      6   < V ^8  d   QhRS[ RS[ RS[ RRRS[/#    namemoduleattrsectionr   returnstrr
   )format__classdict__s   "G/root/miniconda3/lib/python3.14/site-packages/installer/destinations.py__annotate__WheelDestination.__annotate__$   s5     " ""!$",/":I"	"    c                    \         h)a  Write a script in the correct location to invoke given entry point.

:param name: name of the script
:param module: module path, to load the entry point from
:param attr: final attribute access, for the entry point
:param section: Denotes the "entry point section" where this was specified.
    Valid values are ``"gui"`` and ``"console"``.
:type section: str

Example usage/behaviour::

    >>> dest.write_script("pip", "pip._internal.cli", "main", "console")

NotImplementedError)selfr   r   r   r   s   &&&&&r"   write_scriptWheelDestination.write_script$   s
    " "!r%   c          
      L   < V ^8  d   QhRS[ RS[S[R3,          RS[RS[RS[/# r   schemepathzos.PathLike[str]streamis_executabler   r   r   r   r   boolr
   )r    r!   s   "r"   r#   r$   7   sH     " "" C++," 	"
 " 
"r%   c                    \         h)a  Write a file to correct ``path`` within the ``scheme``.

:param scheme: scheme to write the file in (like "purelib", "platlib" etc).
:param path: path within that scheme
:param stream: contents of the file
:param is_executable: whether the file should be made executable

The stream would be closed by the caller, after this call.

Example usage/behaviour::

    >>> with open("__init__.py") as stream:
    ...     dest.write_file("purelib", "pkg/__init__.py", stream)

r'   )r)   r.   r/   r0   r1   s   &&&&&r"   
write_fileWheelDestination.write_file7   s
    , "!r%   c          	      V   < V ^8  d   QhRS[ RS[RS[S[S[ S[3,          ,          RR/# r   r.   record_file_pathrecordsr   Nr   r   r   tupler
   )r    r!   s   "r"   r#   r$   O   sB     " "" " % 345	"
 
"r%   c                    \         h)ae  Finalize installation, after all the files are written.

Handles (re)writing of the ``RECORD`` file.

:param scheme: scheme to write the ``RECORD`` file in
:param record_file_path: path of the ``RECORD`` file with that scheme
:param records: entries to write to the ``RECORD`` file

Example usage/behaviour::

    >>> dest.finalize_installation("purelib")

r'   )r)   r.   r9   r:   s   &&&&r"   finalize_installation&WheelDestination.finalize_installationO   s
    & "!r%    N)
__name__
__module____qualname____firstlineno____doc__r*   r5   r>   __static_attributes____classdictcell__r!   s   @r"   r   r      s(     " "&" "0" "r%   r   c                      a  ] tR t^et o Rt   Rt Rt Rt Rt V 3R lR lt	V 3R lR lt
V 3R	 lR
 ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R ltRtV tR# )SchemeDictionaryDestinationz>Destination, based on a mapping of {scheme: file-system-path}.sha256NFc                ,   < V ^8  d   QhRS[ RS[RS[/# )r   r.   r/   r   )r   r   r   )r    r!   s   "r"   r#   (SchemeDictionaryDestination.__annotate__   s"       s t r%   c                \   \        V P                  V,          4      P                  4       pW2,          P                  4       pVP                  V4      '       g   \	        R V R24      hV P
                  e8   VP                  VP                  4      p\        V P
                  4      V,          # V# )zAttempting to write z  outside of the target directory)r   scheme_dictresolveis_relative_to
ValueErrordestdirrelative_toanchor)r)   r.   r/   
target_dirfilerel_paths   &&&   r"   _path_with_destdir.SchemeDictionaryDestination._path_with_destdir   s    $**623;;=
!**,"":..&tf,LM  <<#''4H%00r%   c          
      8   < V ^8  d   QhRS[ RS[RS[RS[RS[/# )r   r.   r/   r0   r1   r   )r   r   r   r3   r
   )r    r!   s   "r"   r#   rM      sD      I  I I  I 	 I
  I 
 Ir%   c                    V P                  W4      pV P                  '       g(   VP                  4       '       d   RV: 2p\        V4      hVP                  pVP                  4       '       g   VP                  RR7       VP                  R4      ;_uu_ 4       p\        W8V P                  4      w  rRRR4       V'       d   \        V4       \        V\        V P                  X	4      X
4      #   + '       g   i     LD; i)a  Write contents of ``stream`` to the correct location on the filesystem.

:param scheme: scheme to write the file in (like "purelib", "platlib" etc).
:param path: path within that scheme
:param stream: contents of the file
:param is_executable: whether the file should be made executable

- Ensures that an existing file is not being overwritten.
- Hashes the written content, to determine the entry in the ``RECORD`` file.
zFile already exists: T)parentswbN)rY   overwrite_existingexistsFileExistsErrorparentmkdiropenr   hash_algorithmr   r
   r	   )r)   r.   r/   r0   r1   target_pathmessageparent_folderfhash_sizes   &&&&&      r"   write_to_fs'SchemeDictionaryDestination.write_to_fs   s    " --f;&&&;+=+=+?+?-k_=G!'**#**##%%-d##q26d>Q>QRKE $  -4d&9&95!A4HH $#s   C--C=	c          
      L   < V ^8  d   QhRS[ RS[S[R3,          RS[RS[RS[/# r-   r2   )r    r!   s   "r"   r#   rM      sO     F FF C++,F 	F
 F 
Fr%   c                    \         P                  ! V4      pVR8X  d;   \        W0P                  4      ;_uu_ 4       pV P	                  WWd4      uuRRR4       # V P	                  WW44      #   + '       g   i     L"; i)a  Write a file to correct ``path`` within the ``scheme``.

:param scheme: scheme to write the file in (like "purelib", "platlib" etc).
:param path: path within that scheme
:param stream: contents of the file
:param is_executable: whether the file should be made executable

- Changes the shebang for files in the "scripts" scheme.
- Uses :py:meth:`SchemeDictionaryDestination.write_to_fs` for the
  filesystem interaction.
scriptsN)osfspathr   interpreterrl   )r)   r.   r/   r0   r1   path_stream_with_different_shebangs   &&&&&  r"   r5   &SchemeDictionaryDestination.write_file   sg    $ 		$YV%5%566:W''#@ 76
 vEE 76s   A**A:	c          
      6   < V ^8  d   QhRS[ RS[ RS[ RRRS[/# r   r   )r    r!   s   "r"   r#   rM      s5      !$,/:I	r%   c           	        \        WW44      pVP                  V P                  V P                  4      w  rg\        P
                  ! V4      ;_uu_ 4       pV P                  \        R4      WhRR7      p	V P                  \        R4      V4      p
V
P                  4       P                  pWR,          ^,	          ,          pV
P                  V4       V	uuRRR4       #   + '       g   i     R# ; i)a   Write a script to invoke an entrypoint.

:param name: name of the script
:param module: module path, to load the entry point from
:param attr: final attribute access, for the entry point
:param section: Denotes the "entry point section" where this was specified.
    Valid values are ``"gui"`` and ``"console"``.
:type section: str

- Generates a launcher using :any:`Script.generate`.
- Writes to the "scripts" scheme.
- Uses :py:meth:`SchemeDictionaryDestination.write_to_fs` for the
  filesystem interaction.
rp   Tr1   i$  N)r   generaters   script_kindioBytesIOrl   r   rY   statst_modechmod)r)   r   r   r   r   scriptscript_namedatar0   entryr/   modes   &&&&&       r"   r*   (SchemeDictionaryDestination.write_script   s    " d4"OOD,<,<d>N>NOZZ$$y!;d % E **6)+<kJD99;&&DE\a''DJJt s   A;CC*	c                *   < V ^8  d   QhRS[ RS[RR/# )r   r.   recordr   N)r   r
   )r    r!   s   "r"   r#   rM      s"         r%   c                   VR9  d   R# ^ RI pV P                  WP                  4      p\        V P                  V,          4      VP                  ,          P
                  pV P                   F  pVP                  WF^VR7       K  	  R# )z'Compile bytecode for a single .py file.N)optimizequietddir)purelibplatlib)
compileallrY   r/   r   rO   rb   bytecode_optimization_levelscompile_file)r)   r.   r   r   rf   dir_path_to_embedlevels   &&&    r"   _compile_bytecode-SchemeDictionaryDestination._compile_bytecode   su    //--fkkB!$"2"26":;fkkIQQ66E##1;L $  7r%   c          	      V   < V ^8  d   QhRS[ RS[RS[S[S[ S[3,          ,          RR/# r8   r;   )r    r!   s   "r"   r#   rM     sB      3  3 3  3 % 345	 3
 
 3r%   c           	        a a R VV 3R llp\        V4      p\        WT4      ;_uu_ 4       pS P                  SW&RR7       RRR4       V F  w  opS P                  SV4       K  	  R#   + '       g   i     L0; i)a  Finalize installation, by writing the ``RECORD`` file & compiling bytecode.

:param scheme: scheme to write the ``RECORD`` file in
:param record_file_path: path of the ``RECORD`` file with that scheme
:param records: entries to write to the ``RECORD`` file
c                >    V ^8  d   QhR\         R\         R,          /# )r   file_schemer   N)r   )r    s   "r"   r#   GSchemeDictionaryDestination.finalize_installation.<locals>.__annotate__  s     
	 
	3 
	3: 
	r%   c                 8  < V S8X  d   R # \         '       d:   \        P                  P                  SP                  V ,          4      pVR,           # \        P                  P                  SP                  V ,          SP                  S,          R7      pVR,           # )N)start/)r   rq   r/   abspathrO   relpath)r   r/   r.   r)   s   & r"   prefix_for_schemeLSchemeDictionaryDestination.finalize_installation.<locals>.prefix_for_scheme  s}    f$xwwt'7'7'DE #:	 ww$$[1**62 '  #:r%   Fry   N)listr   rl   r   )r)   r.   r9   r:   r   record_listrecord_streamr   s   ff&&    r"   r>   1SchemeDictionaryDestination.finalize_installation  sp    
	 
	 7m";BBm(u   C
 *NFF""662 * CBs   A((A8	c                   < V ^8  d   Qh/ S[ S[S[3,          ;R&   S[;R&   R;R&   S[;R&   S[S[,          ;R&   S[R,          ;R&   S[;R	&   # )
r   rO   rs   r   r{   re   r   NrS   r_   )dictr   r   intr3   )r    r!   s   "r"   r#   rM   e   sr      c3h	       " ( #-S/6) 6 4Z7 D $E r%   r@   )rA   rB   rC   rD   rE   re   r   rS   r_   rY   rl   r5   r*   r   r>   __annotate_func__rF   rG   rH   s   @r"   rJ   rJ   e   s     H 2 9 0"N 57  G  %,  I  IDF F8 @  3  3A  r%   rJ   )rE   r|   rq   collections.abcr   r   dataclassesr   pathlibr   typingr   r   r   installer.recordsr	   r
   installer.scriptsr   installer.utilsr   r   r   r   r   r   r   r   r   rJ   r@   r%   r"   <module>r      sg    @ 	 	 0 !   0 $  =E" E"P 3"2 3 3r%   