a :i@sddlZddlZddlmZddlmZddlmZddlm Z m Z ddl m Z ddl mZdd lmZd d lmZd d lmZd d lmZd dlmZd ddZd!ddZd"ddZd#ddZddZddZddZddZ ddgZ!dS)$N)partial) make_app_data)VirtualEnvConfigParser)LEVELS setup_report)Session)manual_upgrade) __version__)ActivationSelector)CreatorSelector) get_discover)SeederSelectorTcCsP|durtjn|}t||||}||Wdn1sB0Y|S)a Create a virtual environment given some command line interface arguments. :param args: the command line arguments :param options: passing in a ``VirtualEnvOptions`` object allows return of the parsed options :param setup_logging: ``True`` if setup logging handlers, ``False`` to use handlers already registered :param env: environment variables to use :return: the session object of the creation (its structure for now is experimental and might change on short notice) N)osenvironsession_via_clirun)argsoptions setup_loggingenv of_sessionr;/usr/lib/python3.9/site-packages/virtualenv/run/__init__.pycli_runs &rc sp|durtjn|}t|||\}}|||jj_tfdd|D\}}}tj j |j|||} | S)aq Create a virtualenv session (same as cli_run, but this does not perform the creation). Use this if you just want to query what the virtual environment would look like, but not actually create it. :param args: the command line arguments :param options: passing in a ``VirtualEnvOptions`` object allows return of the parsed options :param setup_logging: ``True`` if setup logging handlers, ``False`` to use handlers already registered :param env: environment variables to use :return: the session object of the creation (its structure for now is experimental and might change on short notice) Nc3s|]}|VqdS)N)Zcreate).0errr 1z"session_via_cli..) rr build_parser parse_args _interpreter version_infoZ py_versiontupler verbosityapp_data) rrrrparserelementsZcreatorZseederZ activatorsrrrrr"s   rc Cst||durtjn|}t||jddddddt|||t|||}t|t||}|j |_ }|durt d|t ||t ||t||g}||\}}|D]} | |q|||fS)Nz--with-tracebackwith_traceback store_trueFz>on failure also display the stacktrace internals of virtualenv)destactiondefaulthelpzfailed to find interpreter for )rrradd_version_flag add_argument_do_report_setup load_app_datahandle_extra_commandsr interpreterr# RuntimeErrorr rr parse_known_argsZhandle_selected_arg_parseZ enable_help) rrrrr(Zdiscoverr5r)_elementrrrr!6s2     r!cCs t|dS)z/Used to provide a parser for the doc generationr)r!)rrrrbuild_parser_onlyTsr:cCs|jrtdtddS)Nzvirtualenv installed from the RPM package uses wheels from RPM packages as well. Updating them via virtualenv is not possible. The RPM packaged wheels are updated together with other RPM packages of the system.r )Zupgrade_embed_wheelsloggingZwarning SystemExitrrrrr4Ys r4c Cs|jdddd|j||d\}}|jddtt|j|jdtd|j|jdd |jd dd d|jd dd d|j||d\}}|jr|j|S)Nz--read-only-app-datar+zMuse app data folder in read-only mode (write operations will fail with error))r-r/) namespacez --app-dataz-a data folder used as cache by the virtualenv)Z read_onlyr)r/typer.z--reset-app-dataz start with empty app data folderz--upgrade-embed-wheelsz.trigger a manual update of the embedded wheels) r1r7rrZread_only_app_datarZreset_app_datar'reset)rr(rr8rrrr3`s4 r3cCs,ddl}|jdddtd|jdddS)Nrz --versionversionz %(prog)s z from zIdisplay the version of the virtualenv package and its location, then exit)r-r@r/) virtualenvr1r __file__)r(rArrrr0sr0c CsdddttD}d}|jd|ttd|d}|}|j dd d d d d d|j ddd dddd| |\}}|rt |j dS)Nz, css&|]\}}t|d|VqdS)=N)r; getLevelName)rclrrrrr z#_do_report_setup..z6verbosity = verbose - quiet, default {}, mapping => {}r&)title descriptionz-vz --verbosecountverbosezincrease verbosityr)r-r,r/r.z-qz--quietquietzdecrease verbosityr) joinsortedritemsadd_argument_groupformatr;rDadd_mutually_exclusive_groupr1r7rr&) r(rrZ level_mapmsgZverbosity_groupr&optionr8rrrr2sr2)NTN)NTN)NNTN)N)"r;r functoolsrr'rZconfig.cli.parserrreportrrZ run.sessionrZseed.wheels.periodic_updater r@r Zplugin.activatorsr Zplugin.creatorsr Zplugin.discoveryrZplugin.seedersrrrr!r:r4r3r0r2__all__rrrrs.