Your IP : 18.226.166.207


Current Path : /lib/python2.7/site-packages/pkg_resources/_vendor/
Upload File :
Current File : //lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pyc

�
�fc@s@dZd,Zdjeee��ZddlZddlZejddkZ	e	r^eZ
nejjd�r�ddlZej
�ddZejd	�r�d
Zq�ejd�r�dZq�d
Zn	ejZddded�Zddded�Zddded�Zddded�Zddded�Zddded�Zdefd��YZd�Zd�Zd�Zd�Zed
kr!yddlZ eZ!Wq!e"k
ryddl#m$Z$eZ!Wqe"k
ryddl%Z&eZ!Wqe"k
reZ!qXqXq!Xne'dkr<dZ(dZ)d-Z*d$GHee(e)d%d&�Z+x&e*D]Z,d'e,e-e+e,�fGHq`Wd(GHee(e)�Z+x&e*D]Z,d'e,e-e+e,�fGHq�Wd)GHee(�Z+x&e*D]Z,d'e,e-e+e,�fGHq�Wd*GHee(d+e�Z+x)e*D]Z,d'e,e-e+e,�fGHqWndS(.syUtilities for determining application-specific dirs.

See <http://github.com/ActiveState/appdirs> for details and usage.
iiit.i����NitjavatWindowstwin32tMactdarwintlinux2cCs6tdkr�|dkr!|}n|r-dp0d}tjjt|��}|r|tk	rxtjj|||�}q�tjj||�}qn{tdkr�tjjd�}|rtjj||�}qn<tj	dtjjd��}|rtjj||�}n|r2|r2tjj||�}n|S(	sJReturn 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.
        "appauthor" (only used on Windows) is the name of the
            appauthor or distributing body for this application. Typically
            it is the owning company name. This falls back to appname. You may
            pass False to disable it.
        "version" is an optional version path element to append to the
            path. You might want to use this if you want multiple versions
            of your app to be able to run independently. If used, this
            would typically be "<major>.<minor>".
            Only applied when appname is present.
        "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:
        Mac OS X:               ~/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\<AppAuthor>\<AppName>
        Win XP (roaming):       C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>
        Win 7  (not roaming):   C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>
        Win 7  (roaming):       C:\Users\<username>\AppData\Roaming\<AppAuthor>\<AppName>

    For Unix, we follow the XDG spec and support $XDG_DATA_HOME.
    That means, by default "~/.local/share/<AppName>".
    Rt
CSIDL_APPDATAtCSIDL_LOCAL_APPDATARs~/Library/Application Support/t
XDG_DATA_HOMEs~/.local/shareN(
tsystemtNonetostpathtnormpatht_get_win_foldertFalsetjoint
expandusertgetenv(tappnamet	appauthortversiontroamingtconstR
((sA/usr/lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pyt
user_data_dir-s& 	cCs�tdkr�|d	kr!|}ntjjtd��}|r�|tk	rftjj|||�}q~tjj||�}q�ntdkr�tjjd�}|r�tjj||�}q�n�tj	dtj
jddg��}g|jtj
�D]$}tjj|jtj
��^q�}|rs|rEtjj||�}ng|D]}tj
j||g�^qL}n|r�tj
j|�}n
|d}|S|r�|r�tjj||�}n|S(
siReturn full path to the user-shared data dir for this application.

        "appname" is the name of application.
            If None, just the system directory is returned.
        "appauthor" (only used on Windows) is the name of the
            appauthor or distributing body for this application. Typically
            it is the owning company name. This falls back to appname. You may
            pass False to disable it.
        "version" is an optional version path element to append to the
            path. You might want to use this if you want multiple versions
            of your app to be able to run independently. If used, this
            would typically be "<major>.<minor>".
            Only applied when appname is present.
        "multipath" is an optional parameter only applicable to *nix
            which indicates that the entire list of data dirs should be
            returned. By default, the first item from XDG_DATA_DIRS is
            returned, or '/usr/local/share/<AppName>',
            if XDG_DATA_DIRS is not set

    Typical user data directories are:
        Mac OS X:   /Library/Application Support/<AppName>
        Unix:       /usr/local/share/<AppName> or /usr/share/<AppName>
        Win XP:     C:\Documents and Settings\All Users\Application Data\<AppAuthor>\<AppName>
        Vista:      (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.)
        Win 7:      C:\ProgramData\<AppAuthor>\<AppName>   # Hidden, but writeable on Win 7.

    For Unix, this is using the $XDG_DATA_DIRS[0] default.

    WARNING: Do not use this on Windows. See the Vista-Fail note above for why.
    RtCSIDL_COMMON_APPDATARs/Library/Application Supportt
XDG_DATA_DIRSs/usr/local/shares
/usr/shareiN(R
RRR
RRRRRRtpathseptsplittrstriptsep(RRRt	multipathR
txtpathlist((sA/usr/lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pyt
site_data_dirds4		=.
cCs�tdkr$t||d|�}n<tjdtjjd��}|r`tjj||�}n|r�|r�tjj||�}n|S(s�Return 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.
        "appauthor" (only used on Windows) is the name of the
            appauthor or distributing body for this application. Typically
            it is the owning company name. This falls back to appname. You may
            pass False to disable it.
        "version" is an optional version path element to append to the
            path. You might want to use this if you want multiple versions
            of your app to be able to run independently. If used, this
            would typically be "<major>.<minor>".
            Only applied when appname is present.
        "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:
        Mac OS X:               same as user_data_dir
        Unix:                   ~/.config/<AppName>     # or in $XDG_CONFIG_HOME, if defined
        Win *:                  same as user_data_dir

    For Unix, we follow the XDG spec and support $XDG_CONFIG_HOME.
    That means, by deafult "~/.config/<AppName>".
    RRtXDG_CONFIG_HOMEs	~/.config(RRN(R
RRRRR
RR(RRRRR
((sA/usr/lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pytuser_config_dir�scCstdkrBt||�}|r|rtjj||�}qn�tjdd�}g|jtj�D]$}tjj|j	tj
��^qg}|r�|r�tjj||�}ng|D]}tj
j||g�^q�}n|r�tjj|�}n
|d}|S(sReturn full path to the user-shared data dir for this application.

        "appname" is the name of application.
            If None, just the system directory is returned.
        "appauthor" (only used on Windows) is the name of the
            appauthor or distributing body for this application. Typically
            it is the owning company name. This falls back to appname. You may
            pass False to disable it.
        "version" is an optional version path element to append to the
            path. You might want to use this if you want multiple versions
            of your app to be able to run independently. If used, this
            would typically be "<major>.<minor>".
            Only applied when appname is present.
        "multipath" is an optional parameter only applicable to *nix
            which indicates that the entire list of config dirs should be
            returned. By default, the first item from XDG_CONFIG_DIRS is
            returned, or '/etc/xdg/<AppName>', if XDG_CONFIG_DIRS is not set

    Typical user data directories are:
        Mac OS X:   same as site_data_dir
        Unix:       /etc/xdg/<AppName> or $XDG_CONFIG_DIRS[i]/<AppName> for each value in
                    $XDG_CONFIG_DIRS
        Win *:      same as site_data_dir
        Vista:      (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.)

    For Unix, this is using the $XDG_CONFIG_DIRS[0] default, if multipath=False

    WARNING: Do not use this on Windows. See the Vista-Fail note above for why.
    RRtXDG_CONFIG_DIRSs/etc/xdgi(RR(R
R#RR
RRRRRRR(RRRR R
R!R"((sA/usr/lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pytsite_config_dir�s=.
cCsBtdkr�|dkr!|}ntjjtd��}|r|tk	rftjj|||�}ntjj||�}|r�tjj|d�}q�qn{tdkr�tjjd�}|rtjj||�}qn<tj	dtjjd��}|rtjj||�}n|r>|r>tjj||�}n|S(	sReturn full path to the user-specific cache dir for this application.

        "appname" is the name of application.
            If None, just the system directory is returned.
        "appauthor" (only used on Windows) is the name of the
            appauthor or distributing body for this application. Typically
            it is the owning company name. This falls back to appname. You may
            pass False to disable it.
        "version" is an optional version path element to append to the
            path. You might want to use this if you want multiple versions
            of your app to be able to run independently. If used, this
            would typically be "<major>.<minor>".
            Only applied when appname is present.
        "opinion" (boolean) can be False to disable the appending of
            "Cache" to the base app data dir for Windows. See
            discussion below.

    Typical user cache directories are:
        Mac OS X:   ~/Library/Caches/<AppName>
        Unix:       ~/.cache/<AppName> (XDG default)
        Win XP:     C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>\Cache
        Vista:      C:\Users\<username>\AppData\Local\<AppAuthor>\<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` above). 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.
    This can be disabled with the `opinion=False` option.
    RRtCacheRs~/Library/CachestXDG_CACHE_HOMEs~/.cacheN(
R
RRR
RRRRRR(RRRtopinionR
((sA/usr/lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pytuser_cache_dirs(!	cCs�tdkr0tjjtjjd�|�}n{tdkrut|||�}t}|r�tjj|d�}q�n6t|||�}t}|r�tjj|d�}n|r�|r�tjj||�}n|S(s�Return full path to the user-specific log dir for this application.

        "appname" is the name of application.
            If None, just the system directory is returned.
        "appauthor" (only used on Windows) is the name of the
            appauthor or distributing body for this application. Typically
            it is the owning company name. This falls back to appname. You may
            pass False to disable it.
        "version" is an optional version path element to append to the
            path. You might want to use this if you want multiple versions
            of your app to be able to run independently. If used, this
            would typically be "<major>.<minor>".
            Only applied when appname is present.
        "opinion" (boolean) can be False to disable the appending of
            "Logs" to the base app data dir for Windows, and "log" to the
            base cache dir for Unix. See discussion below.

    Typical user cache directories are:
        Mac OS X:   ~/Library/Logs/<AppName>
        Unix:       ~/.cache/<AppName>/log  # or under $XDG_CACHE_HOME if defined
        Win XP:     C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>\Logs
        Vista:      C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>\Logs

    On Windows the only suggestion in the MSDN docs is that local settings
    go in the `CSIDL_LOCAL_APPDATA` directory. (Note: I'm interested in
    examples of what some windows apps use for a logs dir.)

    OPINION: This function appends "Logs" to the `CSIDL_LOCAL_APPDATA`
    value for Windows and appends "log" to the user cache dir for Unix.
    This can be disabled with the `opinion=False` option.
    Rs~/Library/LogsRtLogstlog(R
RR
RRRRR+(RRRR*R
((sA/usr/lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pytuser_log_dir:s  	tAppDirscBs}eZdZddeed�Zed��Zed��Zed��Z	ed��Z
ed��Zed��ZRS(	s1Convenience wrapper for getting application dirs.cCs1||_||_||_||_||_dS(N(RRRRR (tselfRRRRR ((sA/usr/lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pyt__init__os
				cCs%t|j|jd|jd|j�S(NRR(RRRRR(R0((sA/usr/lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pyRwscCs%t|j|jd|jd|j�S(NRR (R#RRRR (R0((sA/usr/lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pyR#|scCs%t|j|jd|jd|j�S(NRR(R%RRRR(R0((sA/usr/lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pyR%�scCs%t|j|jd|jd|j�S(NRR (R'RRRR (R0((sA/usr/lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pyR'�scCst|j|jd|j�S(NR(R+RRR(R0((sA/usr/lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pyR+�scCst|j|jd|j�S(NR(R.RRR(R0((sA/usr/lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pyR.�sN(
t__name__t
__module__t__doc__RRR1tpropertyRR#R%R'R+R.(((sA/usr/lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pyR/ms	cCs\ddl}idd6dd6dd6|}|j|jd	�}|j||�\}}|S(
s�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.
    i����NtAppDataRsCommon AppDataRs
Local AppDataRs@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders(t_winregtOpenKeytHKEY_CURRENT_USERtQueryValueEx(t
csidl_nameR7tshell_folder_nametkeytdirttype((sA/usr/lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pyt_get_win_folder_from_registry�s	cCs�ddlm}m}|jdt||�dd�}yt|�}t}x*|D]"}t|�dkrSt}PqSqSW|r�yddl	}|j
|�}Wq�tk
r�q�XnWntk
r�nX|S(Ni����(tshellcontshellii�(
twin32com.shellRARBtSHGetFolderPathtgetattrtunicodeRtordtTruetwin32apitGetShortPathNametImportErrortUnicodeError(R;RARBR>t
has_high_chartcRI((sA/usr/lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pyt_get_win_folder_with_pywin32�s$!


cCs�ddl}idd6dd6dd6|}|jd�}|jjjd|dd	|�t}x*|D]"}t|�d
krft}PqfqfW|r�|jd�}|jj	j
|j|d�r�|}q�n|jS(Ni����iRi#RiRiii�(tctypestcreate_unicode_buffertwindlltshell32tSHGetFolderPathWRRRGRHtkernel32tGetShortPathNameWtvalue(R;RPtcsidl_consttbufRMRNtbuf2((sA/usr/lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pyt_get_win_folder_with_ctypes�s$
cCs=ddl}ddlm}ddlm}|jjd}|jd|�}|jj	}|j
dt|j
|�d|j
j|�|jj|j��jd�}t}x*|D]"}	t|	�dkr�t}Pq�q�W|r9|jd|�}|jj	}
tj|||�r9|jj|j��jd�}q9n|S(Ni����(tjna(RiRNsi�(tarraytcom.sunR\tcom.sun.jna.platformRtWinDeftMAX_PATHtzerostShell32tINSTANCERDRREtShlObjtSHGFP_TYPE_CURRENTtNativettoStringttostringRRRGRHtKernel32tkernalRJ(R;R]R\Rtbuf_sizeRYRBR>RMRNtkernel((sA/usr/lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pyt_get_win_folder_with_jna�s&+!
'(RRt__main__tMyAppt	MyCompanyRR#R%R'R+R.s%-- app dirs (with optional 'version')Rs1.0s%s: %ss)
-- app dirs (without optional 'version')s+
-- app dirs (without optional 'appauthor')s(
-- app dirs (with disabled 'appauthor')R(iii(RR#R%R'R+R.(.R4t__version_info__Rtmaptstrt__version__tsysRtversion_infotPY3RFtplatformt
startswithtjava_vertos_nameR
RRRR#R%R'RHR+R.tobjectR/R@ROR[RnRCtwin32comRRKRPRRtcom.sun.jnatcomR2RRtpropstdirstpropRE(((sA/usr/lib/python2.7/site-packages/pkg_resources/_vendor/appdirs.pyt<module>	s~					7B(393+				











?>