U e`@sbdZddlmZddlZddlZddlZddlmZddlm Z e dZ GdddZ dgZ dS) zOA Python specification is an abstract requirement definition of an interpreter.) annotationsN) OrderedDict)fs_is_case_sensitivez@^(?P[a-zA-Z]+)?(?P[0-9.]+)?(?:-(?P32|64))?$c@sTeZdZdZddddZeddZdd Zed d Z d d Z ddddZ dS) PythonSpecz2Contains specification about a Python Interpreter.None)returncCs.||_||_||_||_||_||_||_dSN)str_specimplementationmajorminormicro architecturepath)selfr r r r r rrrJ/opt/hc_python/lib/python3.8/site-packages/virtualenv/discovery/py_spec.py__init__szPythonSpec.__init__cCsPd\}}}}}}tj|r$|}nd}tt|} | r2dd} z| } | d} | dk rtdd| dD} t | d krt t | d kr| \}}}nVt | d kr| \}}n@t | d kr| d }t t |d }|d krt t |d d}d}Wnt k rYn$X| d}|dkr&d}| | d}|s<|}||||||||S)N)NNNNNNFcSs|dkr dSt|Srint)valrrr _int_or_none%sz1PythonSpec.from_string_spec.._int_or_noneversioncss|]}|rt|VqdSrr.0irrr ,sz.PythonSpec.from_string_spec...r Timpl>pypythonarch) osrisabsrematchPATTERN groupdicttuplesplitlen ValueErrorrstr)clsZ string_specr"r r r r%rokr)rgroupsrversionsZ version_datarrrfrom_string_specsB          zPythonSpec.from_string_specc cst}|jr8d||j<tr8d||j<d||j<d|d<|j|j|jf}t t |d| d}W5QRX| D]P\}}t t|ddD]6}|d|}|ddd|D}||fVqqdS) NFTr$rrcss|]}t|VqdSr)r0rrrrrXsz,PythonSpec.generate_names..)rr rlowerupperr r r contextlibsuppressr/indexitemsranger.join)rZimplsrr"r)atZcur_verspecrrrgenerate_namesFs   zPythonSpec.generate_namescCs|jdk otj|jSr)rr&r'rrrris_abs[szPythonSpec.is_abscCs|jr|jr|j|jkrdS|jdk r>|j|jkr>dS|jdk rX|j|jkrXdSt|j|j|jf|j|j|jfD]&\}}|dk rz|dk rz||krzdSqzdS)z]Called when there's a candidate metadata spec to see if compatible - e.g. PEP-514 on Windows.FNT) rCrr r7rzipr r r )rr@Zourreqrrr satisfies_s*zPythonSpec.satisfiesr0cs2tj}d}|ddfdd|DdS)N)r r r r rr(z, c3s0|](}t|dk r|dt|VqdS)N=)getattr)rkrBrrrpsz&PythonSpec.__repr__..))type__name__r>)rnameparamsrrBr__repr__ms zPythonSpec.__repr__N) rM __module__ __qualname____doc__r classmethodr5rApropertyrCrFrPrrrrrs  * r)rS __future__rr9r&r( collectionsrZvirtualenv.inforcompiler*r__all__rrrrs    e