U e@srddlmZddlZddlmZddlmZddlmZddl m Z ddl m Z m Z mZGdd d e Zd gZdS) ) annotationsN)contextmanager)Popen)LogCmd) BaseEmbed)Version get_wheelpip_wheel_env_runcsBeZdZddfdd ZddZeddZed d ZZ S) PipInvokeNone)returncst|dSN)super__init__)selfoptions __class__N/opt/hc_python/lib/python3.8/site-packages/virtualenv/seed/embed/pip_invoke.pyr szPipInvoke.__init__c CsN|js dS|jj}||j|$}t|j|j|j}| ||W5QRXdSr ) enabled interpreterZversion_release_strget_pip_install_cmdexer extra_search_dirapp_dataenv_execute)rZcreatorfor_py_versioncmdrrrrruns z PipInvoke.runcCsHtdt||t||d}||jdkrDd|j}t||S)Nzpip seed by running: %s)rrzfailed seed with code )loggingdebugrr communicate returncode RuntimeError)rrprocessmsgrrrrs   zPipInvoke._executec cst|dddddddg}|js(|dt}|D]h\}}t||||jd |j|j |j d }|dkr|d |}t || t|j j|t||jq:t|D]} |d t| gq|VdS) Nz-mpipz-qinstallz --only-binaryz:all:z--disable-pip-version-checkz --no-indexF) distributionversionrZ search_dirsdownloadrZdo_periodic_updaterz%could not get wheel for distribution z --find-links)strr,appendsetZdistribution_to_versionsitemsrrrZperiodic_updaterr%addpathparentrZ as_pip_reqr+sortedextend) rrrrfoldersdistr+wheelr'folderrrrr"s.    zPipInvoke.get_pip_install_cmd) __name__ __module__ __qualname__rr staticmethodrrr __classcell__rrrrr s  r ) __future__rr! contextlibr subprocessrZ#virtualenv.discovery.cached_py_inforZ virtualenv.seed.embed.base_embedrZvirtualenv.seed.wheelsrrr r __all__rrrrs     2