bg< BddlZddlZddlZddlZddlmZmZddlmZddl m Z ddl m Z ddl mZddlmZddlmZdd lmZdd lmZd d lmZeejejZed z ZGddZGddeZ dZ!ddgZ"dS)N)ABCMetaabstractmethod)ArgumentTypeError) literal_eval) OrderedDict)Path)LogCmd) safe_delete)run_cmd) __version__)PyEnvCfgzdebug.pyceZdZdZdS) CreatorMetacd|_dSN)errorselfs j/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/virtualenv/create/creator.py__init__zCreatorMeta.__init__s  N)__name__ __module__ __qualname__rrrrrs#rrceZdZdZdZdZdZedZedZ e dZ edZ d Z d Zd Zed Zed ZdS)CreatorzEA class that given a python Interpreter creates a virtual environmentc||_d|_t|j|_|j|_|j|_t j|j|_|j |_ |j |_ dS)zConstruct 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_debugrdestclear no_vcs_ignorer from_folder pyenv_cfgapp_dataenv)roptionsr s rrzCreator.__init__sc ' && ] $2!-di88( ;rc|jjddd|DdS)N(z, c3*K|]\}}|d|VdS)=Nr).0kvs r z#Creator.__repr__...s05Z5ZTQjjQjj5Z5Z5Z5Z5Z5Zr)) __class__rjoin_argsrs r__repr__zCreator.__repr__-sA.)]]DII5Z5ZTZZ\\5Z5Z5Z,Z,Z]]]]rcPdt|jfd|jfd|jfgS)Nr"r#r$)strr"r#r$rs rr5z Creator._args0s1 S^^ $ dj ! d0 1  rcdS)aDetermine 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_create7s trc|dd|j|ddddd |d d dd d d S)aAdd 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"actionr=defaultz--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_argumentsAs  4"     m       Q      rct)z)Perform the virtual environment creation.)NotImplementedErrorrs rcreatezCreator.create^s "!rc<d}tj}t}|dkrddini}t|D]N} |j|fi||}||kr+t |#t $rd||<YKwxYw|rAd|}d|d|d |} t| tj |vr%d |d tj d } t| d t|} | r'| rtd| dttjt| } | } | rq| r9tjt| tjrn0|| | | j| j} } | | kr || | | } | qt| S)zANo path separator in the path, valid chars and must be write-ablecttj|j|jg}t d||d|)Nthe destination z is not write-able at )rospath commonprefixpartsr relative_to)r"valuecommons rnon_write_ablez-Creator.validate_dest..non_write_ablegsS27//dj0IJJKF#$ot7G7G7O7O$o$ogm$o$opp prmbcserrorsignoreNzthe file system codec (z) cannot handle characters z within z destination z& must not contain the path separator (r2z+ as this would break the activation scriptsrLz already exists and is a file)sysgetfilesystemencodingrr8encodedecode ValueErrorr4keysrrMpathseprexistsis_filerNabspathresolveaccessW_OKparentname)r: raw_valuerTencodingrefusedkwargschartripbadmsgrRr"base_s rrCzCreator.validate_destcs] q q q ,..--)1V););(H%% NN % %D %"t{866v66==hGG4<< &&& % % % $  %  )''',,..))CmHmmQTmm`immC#C(( ( : " "aaaTVT^aaaC#s$W$W$WXX XY <<>> ]emmoo ]#$[u$[$[$[\\ \BGOOCJJ//0088:: {{}} 09SYY000"N4///k49!Dt||tU+++D 5zzs'A:+A::B  B c,|jr5|jr.tjd|jt |j|||js| dSdS)Nz delete %s) r"r`r#loggingdebugr rI set_pyenv_cfgr$setup_ignore_vcsrs rrunz Creator.runs 9     #$* # M+ty 1 1 1  " " "  ! $  ! ! # # # # # $ $rczt|j_tjtj|jj|jd<|jj |jd<d d|jj D|jd<t|jd<dS)Nhomeimplementation.c34K|]}t|VdSr)r8)r.is rr1z(Creator.set_pyenv_cfg..s(1`1`Q#a&&1`1`1`1`1`1`r version_info virtualenv) rr&contentrMrNdirnamerbr system_executablerzr4r~r rs rruzCreator.set_pyenv_cfgs!,!#AQAc1d1d!e!ev+/+;+J'(),1`1`$BRB_1`1`1`)`)`~&'2|$$$rct|jdz }|s|dddSdS)z9Generate ignore instructions for version control systems.z .gitignorez(# created by virtualenv automatically * zutf-8)riN)r"r` write_text)r git_ignores rrvzCreator.setup_ignore_vcssRY-   "" b  ! !"NY` ! a a a a a b brc|j?|j8t|j||j|j|_|jS)zt :return: debug information about the virtual environment (only valid after :meth:`create` has run) )r!exeget_env_debug_info debug_scriptr'r(rs rrtz Creator.debugsD ; 48#7,TXt7H7H7J7JDM[_[cddDK{rctSr) DEBUG_SCRIPTrrrrzCreator.debug_scriptsrN)rrr__doc__rr6r5 classmethodr;rFrrIrCrwrurvpropertyrt staticmethodrrrrrrsOO   ^^^   [  [ 8""^"++[+Z$$$333bbbX\rr) metaclassc|}|dd||5}t|t|g}t jdt |t|\}}}dddn #1swxYwY |dkr:|rt|}n<|dkrd|vrt|t|tj |}|r||d<n+#t$r} |||t| dcYd} ~ Sd} ~ wwxYwd|vrd |dvr|dd d=|S) N PYTHONPATHz debug via %rrfileerr)outr returncode exceptionrYrN)copypopensure_extractedr8rsrtr r rOSError Exceptionjsonloadsrepr) env_exerr'r(cmdcoderrresultrs rrrs ((**CGGL$  " "< 0 0&L7||S../ nfSkk222 c3&&&&&&&&&&&&&&& Z 199 %%c**1993!#,,&nn$Z__F  F5M ZZZ3diYYYYYYYYZ 6VE]22 5M& !! $ Ms2AB  B$'B$,AD D0D+%D0+D0)#rrsrMrYabcrrargparserastr collectionsrpathlibr#virtualenv.discovery.cached_py_infor virtualenv.util.pathr virtualenv.util.subprocessr virtualenv.versionr r&rrNrb__file__rfHERErrrr__all__rrrrs  ''''''''&&&&&&######666666,,,,,,......****** tBGOOH % %&&-j  ]]]]]]]]]@< r