3

U'íchã@sþddlZddlmZmZmZmZmZddlmZm	Z	ddl
mZmZeefee
effZedeƒZGdd„deƒZGd	d
„d
eƒZejdƒZejdƒZeed
œdd„Zeeefedœdd„Zeeeeeeefdœdd„Zeeeefdœdd„ZdS)éN)Ú	FrozenSetÚNewTypeÚTupleÚUnionÚcasté)ÚTagÚ	parse_tag)ÚInvalidVersionÚVersionÚNormalizedNamec@seZdZdZdS)ÚInvalidWheelFilenamezM
    An invalid wheel filename was found, users should refer to PEP 427.
    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__©rrú4/tmp/pip-build-gk9425m9/packaging/packaging/utils.pyr
sr
c@seZdZdZdS)ÚInvalidSdistFilenamez^
    An invalid sdist filename was found, users should refer to the packaging user guide.
    N)rrrrrrrrrsrz[-_.]+z	(\d+)(.*))ÚnameÚreturncCstjd|ƒjƒ}tt|ƒS)Nú-)Ú_canonicalize_regexÚsubÚlowerrr)rÚvaluerrrÚcanonicalize_name sr)ÚversionrcCsüt|tƒr.yt|ƒ}Wq2tk
r*|SXn|}g}|jdkrR|j|j›dƒ|jtjdddjdd„|j	Dƒƒƒƒ|j
dk	rž|jdjd	d„|j
Dƒƒƒ|jdk	rº|jd
|j›ƒ|jdk	rÖ|jd|j›ƒ|j
dk	rò|jd|j
›ƒdj|ƒS)
    This is very similar to Version.__str__, but has one subtle difference
    with the way it handles the release segment.
    rú!z(\.0)+$ÚÚ.css|]}t|ƒVqdS)N)Ústr)Ú.0Úxrrrú	<genexpr><sz'canonicalize_version.<locals>.<genexpr>Ncss|]}t|ƒVqdS)N)r!)r"r#rrrr$@sz.postz.devú+)Ú
isinstancer!rr
ÚepochÚappendÚrerÚjoinÚreleaseÚpreÚpostÚdevÚlocal)rÚparsedÚpartsrrrÚcanonicalize_version&s&

&



r2)Úfilenamerc
Cs|jdƒstd|›ƒ‚|dd…}|jdƒ}|dkrDtd|›ƒ‚|jd|dƒ}|d}d	|ksxtjd
|tjƒdkr†td|›ƒ‚t|ƒ}t|dƒ}|dkrò|d}t	j|ƒ}|dkrÒtd
|›d|›dƒ‚t
tt|j
dƒƒ|j
dƒfƒ}nf}t|dƒ}	||||	fS)Nz.whlz3Invalid wheel filename (extension must be '.whl'): éréz0Invalid wheel filename (wrong number of parts): érÚ__z^[\w\d._]*$zInvalid project name: rzInvalid build number: z in 'ú'éüÿÿÿ)r4r5éÿÿÿÿ)Úendswithr
ÚcountÚsplitr)ÚmatchÚUNICODErrÚ_build_tag_regexrÚBuildTagÚintÚgroupr	)
r3Zdashesr1Ú	name_partrrZ
build_partZbuild_matchÚbuildÚtagsrrrÚparse_wheel_filenameQs0


 rGcCs„|jdƒr|dtdƒ…}n,|jdƒr<|dtdƒ…}ntd|›ƒ‚|jdƒ\}}}|sltd|›ƒ‚t|ƒ}t|ƒ}||fS)Nz.tar.gzz.zipz@Invalid sdist filename (extension must be '.tar.gz' or '.zip'): rzInvalid sdist filename: )r;ÚlenrÚ
rpartitionrr)r3Z	file_stemrDÚsepZversion_partrrrrrÚparse_sdist_filenameus

rK)r)ÚtypingrrrrrrFrr	rr
rrBr!rArÚ
ValueErrorr
rÚcompilerr@rr2rGrKrrrrÚ<module>s


,"