3 ]@s8ddlZddlZddlmZddZddZddZdS) N)sixc CsVt|tjrtjd|Sy$|jd}tjd|}|jd}Wntk rPYnX|S)NZNFDzutf-8) isinstancer text_type unicodedata normalizedecodeencode UnicodeError)pathr >/tmp/pip-build-8jg9gmni/setuptools/setuptools/unicode_utils.py decomposes    r c CsXt|tjr|Stjpd}|df}x.|D]&}y |j|Stk rNw*Yq*Xq*WdS)zY Ensure that the given path is decoded, NONE when no expected encoding works zutf-8N)rrrsysgetfilesystemencodingrUnicodeDecodeError)r Zfs_enc candidatesencr r r filesys_decodes    rc Cs$y |j|Stk rdSXdS)z/turn unicode encoding into a functional routineN)rUnicodeEncodeError)stringrr r r try_encode's r)rrZsetuptools.externrr rrr r r r s