Your IP : 3.22.68.228


Current Path : /opt/alt/python33/lib64/python3.3/venv/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/venv/__pycache__/__init__.cpython-33.pyc

�
��fsAc@s
dZddlZddlZddlZddlZddlZddlZeje�Z	Gdd�d�Z
eeedd�Ze
dd�Zed	krd
Zye�dZWn<ek
r�Zzededej�WYddZ[XnXeje�ndS(
u5
Virtual environment (venv) package for Python. Based on PEP 405.

Copyright (C) 2011-2012 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 environment directory if it already exists.
                        If not specified and the directory exists, an error is
                        raised.
  --upgrade             Upgrade the environment directory to use this version
                        of Python, assuming Python has been upgraded in-place.
iNcBs�|EeZdZdZdddddd�Zdd�Zdd�Zdd	�Ze	j
d
krpdd�Znd
d�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS(u
EnvBuilderu
    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 and the target directory exists, it is deleted.
                  Otherwise, if the target directory exists, an error is
                  raised.
    :param symlinks: If True, attempt to symlink rather than copy files into
                     virtual environment.
    :param upgrade: If True, upgrade an existing virtual environment.
    cCs(||_||_||_||_dS(N(usystem_site_packagesuclearusymlinksuupgrade(uselfusystem_site_packagesuclearusymlinksuupgrade((u2/opt/alt/python33/lib64/python3.3/venv/__init__.pyu__init__=s			uEnvBuilder.__init__cCsetjj|�}|j|�}|j|�|j|�|jsa|j|�|j|�ndS(u�
        Create a virtual environment in a directory.

        :param env_dir: The target directory to create an environment in.

        N(	uosupathuabspathuensure_directoriesucreate_configurationusetup_pythonuupgradeu
setup_scriptsu
post_setup(uselfuenv_dirucontext((u2/opt/alt/python33/lib64/python3.3/venv/__init__.pyucreateDs

	
uEnvBuilder.createc
Csdd�}tjj|�rD|jp-|jrDtd|��ntjj|�ro|jrotj|�ntj	�}||_
tjj|�d|_d|j|_
||�tj}tjdkr�d|kr�tjd}n	tj}tjjtjj|��\}}||_||_||_tjdkrid	}d
}	tjj|dd�}
n8d
}d}	tjj|ddtjdd�d�}
tjj||	�|_}||�||
�tjj||�|_}||_tjj||�|_||�|S(u�
        Create the directories for the environment.

        Returns a context object which holds paths in the environment,
        for use by subsequent logic.
        cSs&tjj|�s"tj|�ndS(N(uosupathuexistsumakedirs(ud((u2/opt/alt/python33/lib64/python3.3/venv/__init__.pyucreate_if_needed[su7EnvBuilder.ensure_directories.<locals>.create_if_neededuDirectory exists: %siu(%s) udarwinu__PYVENV_LAUNCHER__uwin32uScriptsuIncludeuLibu
site-packagesubinuincludeulibupython%d.%dNi(uosupathuexistsuclearuupgradeu
ValueErrorushutilurmtreeutypesuSimpleNamespaceuenv_dirusplituenv_nameupromptuenvironusysuplatformu
executableuabspathu
python_diru
python_exeujoinuversion_infouinc_pathubin_pathubin_nameuenv_exe(
uselfuenv_dirucreate_if_neededucontextuenvu
executableudirnameuexenameubinnameuincpathulibpathupathubinpath((u2/opt/alt/python33/lib64/python3.3/venv/__init__.pyuensure_directoriesSsB%	
		$			,

	
uEnvBuilder.ensure_directoriescCs�tjj|jd�|_}t|ddd��b}|jd|j�|jr]d}nd}|jd|�|jd	t	j
d
d��Wd
QXd
S(uA
        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.
        u
pyvenv.cfguwuencodinguutf-8u
home = %s
utrueufalseu"include-system-site-packages = %s
uversion = %d.%d.%d
Ni(uosupathujoinuenv_dirucfg_pathuopenuwriteu
python_dirusystem_site_packagesusysuversion_info(uselfucontextupathufuincl((u2/opt/alt/python33/lib64/python3.3/venv/__init__.pyucreate_configuration�s			uEnvBuilder.create_configurationuntcCs:|jd�rd}n|jd�o3|jd�}|S(Nu.pydu.dllupythonu.exe(u.pydu.dllT(uendswithuTrueu
startswith(uselfufuresult((u2/opt/alt/python33/lib64/python3.3/venv/__init__.pyuinclude_binary�s	uEnvBuilder.include_binarycCs�|j}|sjy)tjj|�s8tj||�nWqjtk
rftjd||�d}YqjXn|r�t	j
||�ndS(uQ
        Try symlinking a file, and if that fails, fall back to copying.
        uUnable to symlink %r to %rNT(usymlinksuosupathuislinkusymlinku	ExceptionuloggeruwarninguTrueushutilucopyfile(uselfusrcudstu
force_copy((u2/opt/alt/python33/lib64/python3.3/venv/__init__.pyusymlink_or_copy�s

uEnvBuilder.symlink_or_copycs�|j}|j}|j}|j}||j|�|j}tjdkr�tjj	|�sqtj
|d�nxdD]@}tjj||�}tjj|�sxtj
||�qxqxWn�d}|j��fdd�tj|�D�}	xW|	D]O}
tjj||
�}tjj||
�}||jkr�|||�q�q�Wtjj||�}tjj|�r��fdd�tj|�D�}	xH|	D]=}
tjj||
�}tjj||
�}|||�q�Wnx�tj|j�D]�\}
}}	d	|	kr�tjj|
�}tjj|jd
|�}tj|�tjj|
d	�}tjj|d	�}tj||�Pq�q�WdS(
u�
        Set up a Python executable in the environment.

        :param context: The information for the environment creation request
                        being processed.
        unti�upythonupython3uDLLscs"g|]}�|�r|�qS(((u.0uf(uinclude(u2/opt/alt/python33/lib64/python3.3/venv/__init__.pyu
<listcomp>�s	u+EnvBuilder.setup_python.<locals>.<listcomp>cs"g|]}�|�r|�qS(((u.0uf(uinclude(u2/opt/alt/python33/lib64/python3.3/venv/__init__.pyu
<listcomp>�s	uinit.tcluLibN(upythonupython3(ubin_pathu
python_exeuenv_exeusymlink_or_copyu
executableu
python_diruosunameupathuislinkuchmodujoinuexistsusymlinkuinclude_binaryulistdiruisdiruwalkubasenameuenv_dirumakedirsushutilucopyfile(uselfucontextubinpathuexenameupathucopierudirnameusuffixusubdirufilesufusrcudsturootudirsutcldir((uincludeu2/opt/alt/python33/lib64/python3.3/venv/__init__.pyusetup_python�sJ					
	"
"
"
uEnvBuilder.setup_pythoncCsGtjjtjjt��}tjj|d�}|j||�dS(u�
        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.
        uscriptsN(uosupathuabspathudirnameu__file__ujoinuinstall_scripts(uselfucontextupath((u2/opt/alt/python33/lib64/python3.3/venv/__init__.pyu
setup_scripts�suEnvBuilder.setup_scriptscCsdS(u
        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.
        N((uselfucontext((u2/opt/alt/python33/lib64/python3.3/venv/__init__.pyu
post_setup�suEnvBuilder.post_setupcCsX|jd|j�}|jd|j�}|jd|j�}|jd|j�}|S(ui
        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.
        u__VENV_DIR__u
__VENV_NAME__u__VENV_BIN_NAME__u__VENV_PYTHON__(ureplaceuenv_dirupromptubin_nameuenv_exe(uselfutextucontext((u2/opt/alt/python33/lib64/python3.3/venv/__init__.pyureplace_variables�s
uEnvBuilder.replace_variablescCs!|j}t|�}xtj|�D]�\}}}||kr�x=|dd�D]+}|dtjfkrQ|j|�qQqQWq%nx�|D]�}	tjj||	�}
||d�jtj	�dd�}|s�|}ntjj||�}tjj
|�stj|�ntjj||	�}
t|
d��}	|	j
�}WdQX|
jd�red}nld}y%|jd�}|j||�}Wn>tk
r�}zd}tjd	|
|�WYdd}~XnX|dk	r�t|
|��}	|	j|�WdQXtj|
|
�q�q�Wq%WdS(
us
        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.
        Nucommoniurbu.exeuwbuwuutf-8u+unable to copy script %r, may be binary: %s(ubin_pathulenuosuwalkunameuremoveupathujoinusplitusepuexistsumakedirsuopenureaduendswithudecodeureplace_variablesuUnicodeDecodeErroruNoneuloggeruwarninguwriteushutilucopymode(uselfucontextupathubinpathuplenurootudirsufilesudufusrcfileusuffixudstdirudstfileudataumodeue((u2/opt/alt/python33/lib64/python3.3/venv/__init__.pyuinstall_scriptssB
	
&			uEnvBuilder.install_scriptsNF(u__name__u
__module__u__qualname__u__doc__uFalseu__init__ucreateuensure_directoriesucreate_configurationuosunameuinclude_binaryusymlink_or_copyusetup_pythonu
setup_scriptsu
post_setupureplace_variablesuinstall_scripts(u
__locals__((u2/opt/alt/python33/lib64/python3.3/venv/__init__.pyu
EnvBuilder&s//
u
EnvBuildercCs,td|d|d|�}|j|�dS(u
    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 and the target directory exists, it is deleted.
                  Otherwise, if the target directory exists, an error is
                  raised.
    :param symlinks: If True, attempt to symlink rather than copy files into
                     virtual environment.
    usystem_site_packagesuclearusymlinksN(u
EnvBuilderucreate(uenv_dirusystem_site_packagesuclearusymlinksubuilder((u2/opt/alt/python33/lib64/python3.3/venv/__init__.pyucreate7sucreatec
Cs�d$}tjd%krd&}nttd�s6d&}n|sKtd��nyddl}|jdtdddd	�}|j	d
ddd
ddd�|j	ddd&dddddd�t
jdkr�d&}nd$}|j	dd|dddddd�|j	ddd&dddddd�|j	ddd&dddd dd!�|j|�}|j
rv|jrvtd"��ntd#|jd|jd|jd |j
�}x|jD]}|j|�q�WdS('Niubase_prefixu.This script is only for use with Python >= 3.3iuprogudescriptionuFCreates virtual Python environments in one or more target directories.uepilogu|Once an environment has been created, you may wish to activate it, e.g. by sourcing an activate script in its bin directory.udirsumetavaruENV_DIRunargsu+uhelpu)A directory to create the environment in.u--system-site-packagesudefaultuactionu
store_trueudestusystem_siteuDGive the virtual environment access to the system site-packages dir.untu
--symlinksusymlinksu[Try to use symlinks rather than copies, when symlinks are not the default for the platform.u--clearuclearuuDelete the environment directory if it already exists. If not specified and the directory exists, an error is raised.u	--upgradeuupgradeulUpgrade the environment directory to use this version of Python, assuming Python has been upgraded in-place.u1you cannot supply --upgrade and --clear together.usystem_site_packagesT(iiF(uTrueusysuversion_infouFalseuhasattru
ValueErroruargparseuArgumentParseru__name__uadd_argumentuosunameu
parse_argsuupgradeuclearu
EnvBuilderusystem_siteusymlinksudirsucreate(uargsu
compatibleuargparseuparseruuse_symlinksuoptionsubuilderud((u2/opt/alt/python33/lib64/python3.3/venv/__init__.pyumainLsD				

umainu__main__iu	Error: %sufile(u__doc__ulogginguosushutilusysu	sysconfigutypesu	getLoggeru__name__uloggeru
EnvBuilderuFalseucreateuNoneumainurcu	Exceptionueuprintustderruexit(((u2/opt/alt/python33/lib64/python3.3/venv/__init__.pyu<module>s&�8
*

?>