g#pddlmZddlZddlZddlZddlZddlZddlmZm Z ddl m Z ddl m Z ddlmZddlmZddlmZdd lmZdd lmZdd lmZd d lmZeej8j;ej>Z e dz Z!ejDe#Z$GddZ%GddeZ&dZ'ddgZ(y)) annotationsN)ABCabstractmethod)ArgumentTypeError) literal_eval) OrderedDict)Path)LogCmd) safe_delete)run_cmd) __version__)PyEnvCfgzdebug.pyceZdZddZy) CreatorMetacd|_yN)errorselfs H/opt/hc_python/lib/python3.12/site-packages/virtualenv/create/creator.py__init__zCreatorMeta.__init__s  NreturnNone)__name__ __module__ __qualname__rrrrrsrrceZdZdZddZddZdZedZedZ e dZ edZ d Z d Zd Zd Zed ZedZy)CreatorzFA class that given a python Interpreter creates a virtual environment.c$||_d|_t|j|_|j|_|j |_t j|j|_|j|_ |j|_ y)z Construct a new virtual environment creator. :param options: the CLI option as parsed from :meth:`add_parser_arguments` :param interpreter: the interpreter to create virtual environment from N) interpreter_debugr destclear no_vcs_ignorer from_folder pyenv_cfgapp_dataenv)roptionsr$s rrzCreator.__init__"sj' & ]] $22!--dii8(( ;;rc|jjddjd|jDdS)N(z, c30K|]\}}|d|yw)=Nr ).0kvs r z#Creator.__repr__..3s5Z\TQ1QCj\s)) __class__rjoin_argsrs r__repr__zCreator.__repr__2s7..))*!DII5ZTZZ\5Z,Z+[[\]]rcfdt|jfd|jfd|jfgS)Nr&r'r()strr&r'r(rs rr9z Creator._args5s6 S^ $ djj ! d00 1  rcy)a Determine if we can create a virtual environment. :param interpreter: the interpreter in question :return: ``None`` if we can't create, any other object otherwise that will be forwarded to :meth:`add_parser_arguments` Tr )clsr$s r can_createzCreator.can_create<src|jdd|j|jddddd |jd d dd d y )a' Add CLI arguments for the creator. :param parser: the CLI parser :param app_data: the application data folder :param interpreter: the interpreter we're asked to create virtual environment for :param meta: value as returned by :meth:`can_create` r&z!directory to create virtualenv at)helptypez--clearr' store_truezZremove the destination directory if exist before starting (will overwrite files otherwise)F)r&actionrAdefaultz--no-vcs-ignorer(z>don't create VCS ignore directive in the destination directoryN) add_argument validate_dest)r>parserr$metar+s radd_parser_argumentszCreator.add_parser_argumentsGsn  4""   m     Q  rct)z)Perform the virtual environment creation.)NotImplementedErrorrs rcreatezCreator.createes "!rcd}tj}t}|dk7rddini}t|D]5} |j|fi|j |}||k(r,t ||r5dj|j}d|d|d |} t| tj|vr"d |d tjd } t| t|} | jr!| jrd | d} t| ttjj!t| j#} | } | r}| jrBtj$t| tj&r t| S|| | | j(| j*} } | | k(r || | | } | r}t| S#t $r d||<YwxYw)zBNo path separator in the path, valid chars and must be write-able.cttjj|j|jg}d|j |d|}t |)Nthe destination z is not write-able at )r ospath commonprefixparts relative_tor)r&valuecommonmsgs rnon_write_ablez-Creator.validate_dest..non_write_ablensT277//djj0IJKF$T%5%5f%=$>>TU[T\]C#C( (rmbcserrorsignoreNzthe file system codec (z) cannot handle characters z within z destination z& must not contain the path separator (z,) as this would break the activation scriptsrPz already exists and is a file)sysgetfilesystemencodingrr<encodedecode ValueErrorr8keysrrQpathsepr existsis_filerRabspathresolveaccessW_OKparentname)r> raw_valuerYencodingrefusedkwargschartripbadrXrVr&base_s rrGzCreator.validate_destjs ),,.-)1V);(H% ND %"t{{86v6==hG4< && # ''',,.)C+H:5PQTPWW_`i_lmC#C( ( :: "ym+QRTR\R\Q]^>? $C( (Y <<>emmo$UG+HIC#C( (BGGOOCJ/088:{{}99SY0 5z tU+kk499!Dt|tU+D5z9 % $  %s'G"$ G""G43G4cT|jjrA|jr5tj d|jt |j|j |j|j|js|jyy)Nz delete %s) r&rer'LOGGERdebugr rMadd_cachedir_tag set_pyenv_cfgr(setup_ignore_vcsrs rrunz Creator.runsq 99   $** LLdii 0  "   !!  ! ! #"rc|jdz }|js7tjdj }|j |dyy)zBGenerate a file indicating that this is not meant to be backed up.z CACHEDIR.TAGa Signature: 8a477f597d28d172789f06886806bc55 # This file is a cache directory tag created by Python virtualenv. # For information about cache directory tags, see: # https://bford.info/cachedir/ utf-8rnN)r&retextwrapdedentstrip write_text)rcachedir_tag_filecachedir_tag_texts rryzCreator.add_cachedir_tagsW II6 '') (1!    ( ():W ( M*rct|j_tjj tjj |jj|jd<|jj|jd<djd|jjD|jd<t|jd<y)Nhomeimplementation.c32K|]}t|ywr)r<)r2is rr5z(Creator.set_pyenv_cfg..s1`B_Q#a&B_s version_info virtualenv) rr*contentrQrRdirnamergr$system_executablerr8rr rs rrzzCreator.set_pyenv_cfgs!,!#AQAQAcAc1d!ev+/+;+;+J+J'(),1`$BRBRB_B_1`)`~&'2|$rcj|jdz }|js|jddyy)z9Generate ignore instructions for version control systems.z .gitignorez(# created by virtualenv automatically * r~rN)r&rer)r git_ignores rr{zCreator.setup_ignore_vcss8YY-   "  ! !"NY` ! a#rc|jK|j?t|j|j|j|j |_|jS)zb:return: debug information about the virtual environment (only valid after :meth:`create` has run))r%exeget_env_debug_info debug_scriptr+r,rs rrxz Creator.debugsK ;; 488#7,TXXt7H7H7JDMM[_[c[cdDK{{rctSr) DEBUG_SCRIPTr rrrzCreator.debug_scriptsrNr)rr<)rrr__doc__rr:r9 classmethodr?rJrrMrGr|ryrzr{propertyrx staticmethodrr rrr"r"sP ^   :""//b$ N3b rr"c0|j}|jdd|j|5}t|t|g}tj dt |t|\}}}ddd dk7r-r t|} n4|dk(rdvr t|ttj} r|| d<d| vrd | dvr | dd d=| S#1swYnxYw#t$r} t| dcYd} ~ Sd} ~ wwxYw) N PYTHONPATHz debug via %rrfileerr)outr returncode exceptionr^rR)copypopensure_extractedr<rwrxr r rOSError Exceptionjsonloadsrepr) env_exerr+r,debug_script_extractedcmdcoderrresultrs rrrs ((*CGGL$  " "< 04J7|S!789 ^VC[1 c3 1 Z 19%c*193!#,&n$ZZ_F F5M 6VE]2 5M& !! $ M- 1 0$ Z3diYYZs+AC&AC2&C/2 D;D DD)) __future__rrloggingrQr^rabcrrargparserastr collectionsrpathlibr #virtualenv.discovery.cached_py_infor virtualenv.util.pathr virtualenv.util.subprocessr virtualenv.versionr r*rrRrg__file__rkHEREr getLoggerrrwrr"r__all__r rrrs"  #&#6,.* BGGOOH %&--j   8 $ ocod< r