U e@s~ddlmZddlZddlZddlmZddlmZddlm Z m Z ddl m Z Gddde Z Gd d d e eZd dgZdS) ) annotationsN)ABC)Path)Creator CreatorMeta)fs_supports_symlinkcs:eZdZddfdd ZeddZeddZZS) ViaGlobalRefMetaNonereturncs&td|_d|_ts"d|_dS)Nz(the filesystem does not supports symlink)super__init__ copy_error symlink_errorrself __class__R/opt/hc_python/lib/python3.8/site-packages/virtualenv/create/via_global_ref/api.pyr s  zViaGlobalRefMeta.__init__cCs|j SN)rrrrrcan_copyszViaGlobalRefMeta.can_copycCs|j Sr)rrrrr can_symlinkszViaGlobalRefMeta.can_symlink)__name__ __module__ __qualname__r propertyrr __classcell__rrrrr s  rcsneZdZddfdd ZeddZefddZd d Zd d Z d dZ fddZ fddZ Z S)ViaGlobalRefApir r cs&t|||||_|j|_dSr)r r _should_symlinksymlinks system_siteenable_system_site_package)roptions interpreterrrrr s zViaGlobalRefApi.__init__cCst|ddt|dd}}|d|d}}dD]V}||krD|nd}||krT|nd}|dkrn|dkrndS|dkr|dS|dkr4dSq4dS)NcopiesFr )clizenv varfiledefaultT)getattr get_source)r#r%r Zcopy_srcZsym_srclevelZs_optZc_optrrrr#szViaGlobalRefApi._should_symlinkcst|||||jdddddd|js>|js>d}t||}|jr`|jdd dd d d|jr|jd d |j dddddS)Nz--system-site-packagesF store_truer!zCgive the virtual environment access to the system site-packages dir)r(actiondesthelpz(neither symlink or copy method supportedz --symlinksTr zZtry to use symlinks rather than copies, when symlinks are not the default for the platformz--copiesz --always-copyr%z[try to use copies rather than symlinks, even when symlinks are the default for the platform)r add_parser_arguments add_argumentrr RuntimeErroradd_mutually_exclusive_group)clsparserr$metaapp_datamsggrouprrrr04s: z$ViaGlobalRefApi.add_parser_argumentscCs |dSr) install_patchrrrrcreateTszViaGlobalRefApi.createcCsX|}|rT|jd}td||jddd|jd}td||j|dddS)Nz_virtualenv.pthz%create virtualenv import hook file %szimport _virtualenvutf-8encoding_virtualenv.pyz create %s)env_patch_textpurelibloggingdebug write_text)rtextpth dest_pathrrrr:Ws    zViaGlobalRefApi.install_patchc Cs`|jttjd@}|jdd}|dttj t |j t |j W5QRSQRXdS)zJPatch the distutils package to not be derailed by its configuration files.r?r<r=z"__SCRIPT_DIR__"N)r7Zensure_extractedr__file__parent read_textreplacereprospathrelpathstrZ script_dirrA)r resolved_pathrErrrr@as zViaGlobalRefApi.env_patch_textcstd|jffS)Nglobal)r _argsr"rrrrrSgszViaGlobalRefApi._argscs"t|jrdnd|jd<dS)Ntruefalsezinclude-system-site-packages)r set_pyenv_cfgr"Z pyenv_cfgrrrrrVjs zViaGlobalRefApi.set_pyenv_cfg)rrrr staticmethodr classmethodr0r;r:r@rSrVrrrrrrs   r) __future__rrBrMabcrpathlibrZvirtualenv.create.creatorrrZvirtualenv.inforrr__all__rrrrs    S