Your IP : 13.58.191.60


Current Path : /usr/lib/python3.6/site-packages/pip/utils/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/pip/utils/__pycache__/appdirs.cpython-36.opt-1.pyc

3

�Pfk"�@s�dZddlmZddlZddlZddlmZmZddlm	Z	m
Z
dd�Zdd	d
�Zddd
�Z
dd�Zdd�Zdd�Zer�yddlZeZWnek
r�eZYnXdd�ZdS)zd
This code was taken from https://github.com/ActiveState/appdirs and modified
to suit our purposes.
�)�absolute_importN)�WINDOWS�
expanduser)�PY2�	text_typecCs�tr<tjjtd��}tr*t|t�r*t|�}tjj	||d�}n@t
jdkr^td�}tjj	||�}ntj
dtd��}tjj	||�}|S)a5
    Return full path to the user-specific cache dir for this application.

        "appname" is the name of application.

    Typical user cache directories are:
        macOS:      ~/Library/Caches/<AppName>
        Unix:       ~/.cache/<AppName> (XDG default)
        Windows:    C:\Users\<username>\AppData\Local\<AppName>\Cache

    On Windows the only suggestion in the MSDN docs is that local settings go
    in the `CSIDL_LOCAL_APPDATA` directory. This is identical to the
    non-roaming app data dir (the default returned by `user_data_dir`). Apps
    typically put cache data somewhere *under* the given dir here. Some
    examples:
        ...\Mozilla\Firefox\Profiles\<ProfileName>\Cache
        ...\Acme\SuperApp\Cache\1.0

    OPINION: This function appends "Cache" to the `CSIDL_LOCAL_APPDATA` value.
    �CSIDL_LOCAL_APPDATAZCache�darwinz~/Library/CachesZXDG_CACHE_HOMEz~/.cache)r�os�path�normpath�_get_win_folderr�
isinstancer�_win_path_to_bytes�join�sys�platformr�getenv)�appnamer
�r�/usr/lib/python3.6/appdirs.py�user_cache_dirs
rFcCshtr,|rdpd}tjjtjjt|��|�}n8tjdkrJtjjtd�|�}ntjjtj	dtd��|�}|S)aS
    Return full path to the user-specific data dir for this application.

        "appname" is the name of application.
            If None, just the system directory is returned.
        "roaming" (boolean, default False) can be set True to use the Windows
            roaming appdata directory. That means that for users on a Windows
            network setup for roaming profiles, this user data will be
            sync'd on login. See
            <http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx>
            for a discussion of issues.

    Typical user data directories are:
        macOS:                  ~/Library/Application Support/<AppName>
        Unix:                   ~/.local/share/<AppName>    # or in
                                $XDG_DATA_HOME, if defined
        Win XP (not roaming):   C:\Documents and Settings\<username>\ ...
                                ...Application Data\<AppName>
        Win XP (roaming):       C:\Documents and Settings\<username>\Local ...
                                ...Settings\Application Data\<AppName>
        Win 7  (not roaming):   C:\Users\<username>\AppData\Local\<AppName>
        Win 7  (roaming):       C:\Users\<username>\AppData\Roaming\<AppName>

    For Unix, we follow the XDG spec and support $XDG_DATA_HOME.
    That means, by default "~/.local/share/<AppName>".
    �
CSIDL_APPDATArrz~/Library/Application Support/Z
XDG_DATA_HOMEz~/.local/share)
rr	r
rrrrrrr)r�roaming�constr
rrr�
user_data_dir>s
rTcCsHtrt||d�}n2tjdkr&t|�}ntjdtd��}tjj||�}|S)arReturn full path to the user-specific config dir for this application.

        "appname" is the name of application.
            If None, just the system directory is returned.
        "roaming" (boolean, default True) can be set False to not use the
            Windows roaming appdata directory. That means that for users on a
            Windows network setup for roaming profiles, this user data will be
            sync'd on login. See
            <http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx>
            for a discussion of issues.

    Typical user data directories are:
        macOS:                  same as user_data_dir
        Unix:                   ~/.config/<AppName>
        Win *:                  same as user_data_dir

    For Unix, we follow the XDG spec and support $XDG_CONFIG_HOME.
    That means, by default "~/.config/<AppName>".
    )rrZXDG_CONFIG_HOMEz	~/.config)	rrrrr	rrr
r)rrr
rrr�user_config_dirjs

rcs�tr&tjjtd��}tjj|��g}nVtjdkrBtjjd��g}n:tjdd�}|rn�fdd�|j	tj
�D�}ng}|jd�|S)	a�Return a list of potential user-shared config dirs for this application.

        "appname" is the name of application.

    Typical user config directories are:
        macOS:      /Library/Application Support/<AppName>/
        Unix:       /etc or $XDG_CONFIG_DIRS[i]/<AppName>/ for each value in
                    $XDG_CONFIG_DIRS
        Win XP:     C:\Documents and Settings\All Users\Application ...
                    ...Data\<AppName>        Vista:      (Fail! "C:\ProgramData" is a hidden *system* directory
                    on Vista.)
        Win 7:      Hidden, but writeable on Win 7:
                    C:\ProgramData\<AppName>    �CSIDL_COMMON_APPDATArz/Library/Application SupportZXDG_CONFIG_DIRSz/etc/xdgcsg|]}tjjt|����qSr)r	r
rr)�.0�x)rrr�
<listcomp>�sz$site_config_dirs.<locals>.<listcomp>z/etc)rr	r
rrrrrr�split�pathsep�append)rr
ZpathlistZxdg_config_dirsr)rr�site_config_dirs�s


r#cCs:ddl}dddd�|}|j|jd�}|j||�\}}|S)z�
    This is a fallback technique at best. I'm not sure if using the
    registry for this guarantees us the correct answer for all CSIDL_*
    names.
    rNZAppDatazCommon AppDataz
Local AppData)rrrz@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)�_winreg�OpenKey�HKEY_CURRENT_USERZQueryValueEx)�
csidl_namer$Zshell_folder_name�keyZ	directoryZ_typerrr�_get_win_folder_from_registry�sr)cCs�dddd�|}tjd�}tjjjd|dd|�d}x|D]}t|�dkr:d	}Pq:W|rztjd�}tjjj|j|d�rz|}|jS)
N��#�)rrrirF�T)	�ctypesZcreate_unicode_bufferZwindllZshell32ZSHGetFolderPathW�ordZkernel32ZGetShortPathNameW�value)r'Zcsidl_constZbufZ
has_high_char�cZbuf2rrr�_get_win_folder_with_ctypes�s 


r2c
Cs6x0dD](}y
|j|�Sttfk
r,YqXqW|S)a�Encode Windows paths to bytes. Only used on Python 2.

    Motivation is to be consistent with other operating systems where paths
    are also returned as bytes. This avoids problems mixing bytes and Unicode
    elsewhere in the codebase. For more details and discussion see
    <https://github.com/pypa/pip/issues/3463>.

    If encoding using ASCII and MBCS fails, return the original Unicode path.
    �ASCII�MBCS)r3r4)�encode�UnicodeEncodeError�LookupError)r
�encodingrrrr�s



r)F)T)�__doc__Z
__future__rr	rZ
pip.compatrrZpip._vendor.sixrrrrrr#r)r2r.r�ImportErrorrrrrr�<module>s$0
,
!(


?>