
    d                        d dl mZ d dlZd dlZd dlmZ d dlmZ  ej	        d          Z
 ej	        d          ZddZddZddZddZdS )    )annotationsN)
WheelError)	WheelFilez6^(?P<namever>(?P<name>.+?)-(?P<ver>\d.*?))\.dist-info$s   Build: (\d\w*)$	directorystrdest_dirbuild_number
str | Nonec                     fdt          j                   D             }t          |          dk    rt          d            |st          d            |d         }t                              |                              d          }d}t           j                             |d          }t          |d	          5 }t          |                                          \  }	}|	s"t          d
                    |                    	 ddd           n# 1 swxY w Y   ||n|}||r|d|z   z  }||k    rt          |d          5 }|                                }
t          |
|          }
|                    d           |                                 |                    |
           ddd           n# 1 swxY w Y   t#          |	          }t           j                            || d| d          }t%          |d          5 }t'          d| ddd           |                                ddd           n# 1 swxY w Y   t'          d           dS )aB  Repack a previously unpacked wheel directory into a new wheel file.

    The .dist-info/WHEEL file must contain one or more tags so that the target
    wheel file name can be determined.

    :param directory: The unpacked wheel directory
    :param dest_dir: Destination directory (defaults to the current directory)
    c                    g | ][}t           j                            t           j                            |                    ?t                              |          Y|\S  )ospathisdirjoinDIST_INFO_REmatch).0fnr   s     J/var/www/html/t/fyr/venv311/lib/python3.11/site-packages/wheel/cli/pack.py
<listcomp>zpack.<locals>.<listcomp>   sf       7==i4455 ;G:L:LR:P:P
         z)Multiple .dist-info directories found in z#No .dist-info directories found in r   nameverNWHEELrbzCNo tags present in {}/WHEEL; cannot determine target wheel filename-zrb+z.whlwzRepacking wheel as z... T)endflushOK)r   listdirlenr   r   r   groupr   r   open	read_tagsreadformatset_build_numberseektruncatewritecompute_tagliner   printwrite_files)r   r   r	   dist_info_dirsdist_info_dirname_versionexisting_build_numberwheel_file_pathftagswheel_file_contenttagline
wheel_pathwfs   `             r   packr<      sB      *Y''  N
 >QPYPPQQQ LJyJJKKK #1%M%%m44::9EEL !gll9mWEEO	ot	$	$ &/&9&9## 	!6-00  	               $0#;<<AVL 	/C,..L000ou-- ,%&VVXX"%56H,%W%W"q			

*+++, , , , , , , , , , , , , , , d##G h<(G(G'(G(G(GHHJ	:s	#	# "r3J3334HHHH
y!!!" " " " " " " " " " " " " " " 
$KKKKKs8   A	DD DA#F;;F?F?,II
I	input_strbytesreturntuple[list[str], str | None]c                   g }d}|                                  D ]}|                    d          rT|                    |                    d          d                                                             d                     k|                    d          r@|                    d          d                                                             d          }||fS )zRead tags from a string.

    :param input_str: A string containing one or more tags, separated by spaces
    :return: A list of tags and a list of build tags
    Ns   Tag:     r   asciis   Build: )
splitlines
startswithappendsplitrstripdecode)r=   r7   r4   lines       r   r'   r'   L   s     D $$&& Q Q??8$$ 	QKK

4((+2244;;GDDEEEE__Z(( 	Q$(JJt$4$4Q$7$>$>$@$@$G$G$P$P!&&&r   r8   c                    |rd|z                       d          nd}t                              ||           \  } }|s| |z  } | S )zCompute a build tag and add/replace/remove as necessary.

    :param wheel_file_content: The contents of .dist-info/WHEEL
    :param build_number: The build tags present in .dist-info/WHEEL
    :return: The (modified) contents of .dist-info/WHEEL
    zBuild: %s
rC   r   )encodeBUILD_NUM_REsubn)r8   r	   replacementnum_replaceds       r   r*   r*   ^   sh     =IQ<	'//888c  (4'8'8'( ($  *k)r   r7   	list[str]c                :   t          d | D                       }t          d | D                       }t          d | D                       }d                    d                    |          d                    |          d                    |          g          S )zcCompute a tagline from a list of tags.

    :param tags: A list of tags
    :return: A tagline
    c                D    h | ]}|                     d           d         S )r   r   rG   r   tags     r   	<setcomp>z"compute_tagline.<locals>.<setcomp>y   s'    666#CIIcNN1%666r   c                D    h | ]}|                     d           d         S )r   r   rT   rU   s     r   rW   z"compute_tagline.<locals>.<setcomp>z   s'    888CciinnQ'888r   c                D    h | ]}|                     d           d         S )r      rT   rU   s     r   rW   z"compute_tagline.<locals>.<setcomp>{   s'    :::c		#q):::r   r   .)sortedr   )r7   implsabivers	platformss       r   r.   r.   s   s     6666677E88488899G::T:::;;I88SXXe__chhw&7&7)9L9LMNNNr   )r   r   r   r   r	   r
   )r=   r>   r?   r@   )r8   r>   r	   r
   r?   r>   )r7   rQ   r?   r   )
__future__r   os.pathr   re	wheel.clir   wheel.wheelfiler   compiler   rM   r<   r'   r*   r.   r   r   r   <module>rf      s    " " " " " "  				             % % % % % %rzSTTrz-..< < < <~' ' ' '$   *	O 	O 	O 	O 	O 	Or   