o ca$ @s\ddlmZddlZddlZddlZddlmZddlm Z e dZ e dZ ddZ dS) )print_functionN) WheelError) WheelFilez6^(?P(?P.+?)-(?P\d.*?))\.dist-info$sBuild: (\d\w*)$cstfddtD}t|dkrtd|s"td|d}t|d}d}tj |d }t |8}g} |D]"} | d rU| | d dqA| d rc| d d}qA| smtd |Wdn1swwY|dur|n|}|dur|r|d|7}||kr|rd|dnd} t |d(}|} t| | \} } | s| | 7} |d||| Wdn1swYtdd| D}tdd| D}tdd| D}d d |d |d |g}tj |d||}t|d}td|ddtj|Wdn 1s/wYtddS)aBRepack 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) cs0g|]}tjtj|rt|r|qS)ospathisdirjoin DIST_INFO_REmatch).0fn directoryr0/usr/lib/python3/dist-packages/wheel/cli/pack.py s  zpack..z+Multiple .dist-info directories found in {}z%No .dist-info directories found in {}rnameverNWHEELzTag:  zBuild: zCNo tags present in {}/WHEEL; cannot determine target wheel filename-z Build: %s asciizrb+cSh|] }|ddqS)rrsplitr tagrrr Fzpack..cSr)rrrrrrrrGrcSr)rrrrrrrHr.z {}-{}.whlwzRepacking wheel as {}...)endOK)rlistdirlenrformatr r grouprr open startswithappendrrstripencoderead BUILD_NUM_REsubnseektruncatewritesortedrprintsysstdoutflush write_files)rdest_dir build_numberdist_info_dirs dist_info_dir name_versionexisting_build_numberwheel_file_pathftagsline replacementwheel_file_content num_replacedimplsabivers platformstagline wheel_pathwfrrrpacksf          "    rN) __future__ros.pathrrer7 wheel.clirwheel.wheelfilercompiler r0rNrrrrs