PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  qY2N@s dZddlZddlZddlZddlZddlZddlZejeZ GdddZ ddddddZ ddd Z ed krd Z ye dZ Wn<ek rZzed ed ejWYddZ[XnXeje dS)a Virtual environment (venv) package for Python. Based on PEP 405. Copyright (C) 2011-2014 Vinay Sajip. Licensed to the PSF under a contributor agreement. usage: python -m venv [-h] [--system-site-packages] [--symlinks] [--clear] [--upgrade] ENV_DIR [ENV_DIR ...] Creates virtual Python environments in one or more target directories. positional arguments: ENV_DIR A directory to create the environment in. optional arguments: -h, --help show this help message and exit --system-site-packages Give the virtual environment access to the system site-packages dir. --symlinks Attempt to symlink rather than copy. --clear Delete the contents of the environment directory if it already exists, before environment creation. --upgrade Upgrade the environment directory to use this version of Python, assuming Python has been upgraded in-place. --without-pip Skips installing or upgrading pip in the virtual environment (pip is bootstrapped by default) Nc@seZdZdZdddddddZddZddZd d Zd d Ze j d krxddZ dddZ ddZ ddZddZddZddZddZdS) EnvBuilderaR This class exists to allow virtual environment creation to be customized. The constructor parameters determine the builder's behaviour when called upon to create a virtual environment. By default, the builder makes the system (global) site-packages dir *un*available to the created environment. If invoked using the Python -m option, the default is to use copying on Windows platforms but symlinks elsewhere. If instantiated some other way, the default is to *not* use symlinks. :param system_site_packages: If True, the system (global) site-packages dir is available to created environments. :param clear: If True, delete the contents of the environment directory if it already exists, before environment creation. :param symlinks: If True, attempt to symlink rather than copy files into virtual environment. :param upgrade: If True, upgrade an existing virtual environment. :param with_pip: If True, ensure pip is installed in the virtual environment FcCs1||_||_||_||_||_dS)N)system_site_packagesclearsymlinksupgradewith_pip)selfrrrrrr '/opt/python35/lib/python3.5/__init__.py__init__?s     zEnvBuilder.__init__cCstjj|}|j|}|j}d|_|j||j||jrc|j||j s|j ||j ||rd|_|j|dS)z Create a virtual environment in a directory. :param env_dir: The target directory to create an environment in. FTN) ospathabspathensure_directoriesrcreate_configuration setup_pythonr _setup_pipr setup_scripts post_setup)renv_dircontextZtrue_system_site_packagesr r r createGs          zEnvBuilder.createcCsxtj|D]n}tjj||}tjj|sOtjj|r_tj|qtjj|rtj |qWdS)N) r listdirr joinislinkisfileremoveisdirshutilrmtree)rr fnr r r clear_directoryas $zEnvBuilder.clear_directorycCsEdd}tjj|r4|jr4|j|tj}||_tjj|d|_ d|j |_ ||tj }t j dkrd|krtj d}n t j}tjjtjj|\}}||_||_||_t j dkr.d}d } tjj|d d } n8d }d } tjj|ddt jddd } tjj|| |_} || || t jdkrtjdkrt j dkrtjj|d} tjj| stjd| tjj|||_} ||_tjj| ||_|| |S)z Create the directories for the environment. Returns a context object which holds paths in the environment, for use by subsequent logic. cSsZtjj|s"tj|n4tjj|sFtjj|rVtd|dS)NzUnable to create directory %r)r r existsmakedirsrr ValueError)dr r r create_if_neededqs$z7EnvBuilder.ensure_directories..create_if_neededz(%s) darwin__PYVENV_LAUNCHER__win32ZScriptsZIncludeLibz site-packagesbinincludelibz python%d.%dN posixZlib64l)r r r"rr!typesSimpleNamespacersplitenv_namepromptenvironsysplatform executabler python_dirZ python_exer version_infoZinc_pathmaxsizenamesymlinkbin_pathbin_nameenv_exe)rrr&renvr:dirnameZexenameZbinnameZincpathZlibpathr Z link_pathbinpathr r r risL       $        zEnvBuilder.ensure_directoriesc Cstjj|jd|_}t|dddb}|jd|j|jr]d}nd}|jd||jd t j d d Wd QRXd S) aA Create a configuration file indicating where the environment's Python was copied from, and whether the system site-packages should be made available in the environment. :param context: The information for the environment creation request being processed. z pyvenv.cfgwencodingzutf-8z home = %s truefalsez"include-system-site-packages = %s zversion = %d.%d.%d N) r r rrZcfg_pathopenwriter;rr8r<)rrr fZinclr r r rs   zEnvBuilder.create_configurationntcCs:|jdrd}n|jdo3|jd}|S)N.pyd.dllTpythonz.exe)rOrP)endswith startswith)rrMresultr r r include_binarys zEnvBuilder.include_binaryc Cs|j }|syutjj|s|rttjj|tjj|ksUttjtjj||ntj||Wn+tk rt j d||d}YnX|rt j ||dS)zQ Try symlinking a file, and if that fails, fall back to copying. zUnable to symlink %r to %rTN) rr r rrDAssertionErrorr?basename Exceptionloggerwarningrcopyfile)rsrcdstrelative_symlinks_okZ force_copyr r r symlink_or_copys *  zEnvBuilder.symlink_or_copycs|j}|j}|j}||j||j}tjdkrtjj|setj |dxBdD]e}tjj ||}tjj |sl||j|ddtjj|sltj |dqlWnd}|j fdd tj |D}xT|D]L} tjj || } tjj || } | |jkr|| | qWtjj ||}tjj|rfd d tj |D}xE|D]=} tjj || } tjj || } || | qWxtj|jD]\} } }d |krtjj| }tjj |jd |}tjj |sktj|tjj | d } tjj |d } tj| | PqWd S)z Set up a Python executable in the environment. :param context: The information for the environment creation request being processed. rNirQpython3r^TZDLLscs"g|]}|r|qSr r ).0rM)r-r r s z+EnvBuilder.setup_python..cs"g|]}|r|qSr r )rarM)r-r r rbs zinit.tclr+N)rQr`)r@rBr_r:r;r r>r rchmodrr"rUrrwalkrWrr#rr[)rrrEr copierrDsuffixZsubdirfilesrMr\r]rootdirsZtcldirr )r-r rsN      " " "  zEnvBuilder.setup_pythoncCs2|jddddg}tj|dtjdS)z1Installs or upgrades pip in a virtual environmentz-ImZ ensurepipz --upgradez --default-pipstderrN)rB subprocess check_outputSTDOUT)rrcmdr r r rs zEnvBuilder._setup_pipcCsGtjjtjjt}tjj|d}|j||dS)a Set up scripts into the created environment from a directory. This method installs the default scripts into the environment being created. You can prevent the default installation by overriding this method if you really need to, or if you need to specify a different location for the scripts to install. By default, the 'scripts' directory in the venv package is used as the source of scripts to install. scriptsN)r r rrD__file__rinstall_scripts)rrr r r r r s zEnvBuilder.setup_scriptscCsdS)a Hook for post-setup modification of the venv. Subclasses may install additional packages or scripts here, add activation shell scripts, etc. :param context: The information for the environment creation request being processed. Nr )rrr r r rszEnvBuilder.post_setupcCsm|jd|j}|jd|j}|jd|j}|jd|j}|jd|j}|S)ai Replace variable placeholders in script text with context-specific variables. Return the text passed in , but with variables replaced. :param text: The text in which to replace placeholder variables. :param context: The information for the environment creation request being processed. Z __VENV_DIR__Z __VENV_NAME__Z__VENV_PROMPT__Z__VENV_BIN_NAME__Z__VENV_PYTHON__)replacerr5r6rArB)rtextrr r r replace_variables#s zEnvBuilder.replace_variablesc!Cs|j}t|}xtj|D]\}}}||krx:|ddD](}|dtjfkrQ|j|qQWq%x|D]} tjj|| } ||djtj dd} | s|} ntjj|| } tjj | s tj | tjj| | } t | d} | j }WdQRX| jdsy4|jd}|j||}|jd}Wn>tk r}zd}tjd| |WYdd}~XnX|dk rt | d} | j|WdQRXtj| | qWq%WdS) as Install scripts into the created environment from a directory. :param context: The information for the environment creation request being processed. :param path: Absolute pathname of a directory containing script. Scripts in the 'common' subdirectory of this directory, and those in the directory named for the platform being run on, are installed in the created environment. Placeholder variables are replaced with environment- specific values. Ncommonr/rbz.exezutf-8z+unable to copy script %r, may be binary: %swb)r@lenr rdr>rr rr4sepr"r#rKreadrRdecodertencode UnicodeErrorrYrZrLrcopymode)rrr rEZplenrhrirgr%rMZsrcfilerfZdstdirZdstfiledataer r r rq5s@    &    zEnvBuilder.install_scriptsN)__name__ __module__ __qualname____doc__r rr!rrr r>rUr_rrrrrtrqr r r r r's    7   3  rFc Cs2td|d|d|d|}|j|dS)aL Create a virtual environment in a directory. By default, makes the system (global) site-packages dir *un*available to the created environment, and uses copying rather than symlinking for files obtained from the source Python installation. :param env_dir: The target directory to create an environment in. :param system_site_packages: If True, the system (global) site-packages dir is available to the environment. :param clear: If True, delete the contents of the environment directory if it already exists, before environment creation. :param symlinks: If True, attempt to symlink rather than copy files into virtual environment. :param with_pip: If True, ensure pip is installed in the virtual environment rrrrN)rr)rrrrrbuilderr r r res rc Cs"d}tjd,krd}nttds3d}|sHtdnddl}|jdtdd d d }|jd d ddddd|jdddddddddtj dkrd}nd}|j }|jdd|dddddd|jdd| dddddd |jd!dddddd"dd#|jd$dddddd%dd&|jd'dd(dddddd)|j |}|j r|j rtd*td+|jd"|j d|jd%|j d(|j}x|jD]}|j|qWdS)-NTrJF base_prefixz.This script is only for use with Python >= 3.3rprog descriptionzFCreates virtual Python environments in one or more target directories.epilogz|Once an environment has been created, you may wish to activate it, e.g. by sourcing an activate script in its bin directory.rimetavarZENV_DIRnargs+helpz)A directory to create the environment in.z--system-site-packagesdefaultaction store_truedest system_sitezDGive the virtual environment access to the system site-packages dir.rNz --symlinksrz[Try to use symlinks rather than copies, when symlinks are not the default for the platform.z--copies store_falsez\Try to use copies rather than symlinks, even when symlinks are the default for the platform.z--clearrzcDelete the contents of the environment directory if it already exists, before environment creation.z --upgraderzlUpgrade the environment directory to use this version of Python, assuming Python has been upgraded in-place.z --without-piprz]Skips installing or upgrading pip in the virtual environment (pip is bootstrapped by default)z1you cannot supply --upgrade and --clear together.r)rJrJ)r8r<hasattrr$argparseArgumentParserr add_argumentr r>add_mutually_exclusive_group parse_argsrrrrrrrir) argsZ compatiblerparserZ use_symlinksgroupoptionsrr%r r r main|sV                r__main__r'z Error: %sfile)rloggingr rrkr8r2 getLoggerrrYrrrrcrXrprintrjexitr r r r s(      ?D  *