uf d Z ddlmZ ddlZddlZddlmZ ddlmZ ddl m
Z
mZ ddlm
Z
e
rdd lmZ ej d
k rdd
ZnddlmZ G d de
ZddZddZdgZdS )zUnix. )annotationsN)ConfigParser)Path)
TYPE_CHECKINGNoReturn )PlatformDirsABC)Iteratorwin32returnr c $ d} t | )Nzshould only be used on Unix)RuntimeError)msgs o/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pip/_vendor/platformdirs/unix.pygetuidr s +3 )r c e Zd ZdZedd Zed d Zedd Zedd Zed d Z edd
Z
edd Zedd Zedd
Z
edd Zedd Zedd Zedd Zedd Zedd Zedd Zedd Zedd Zed!d Zed!d Zed!d Zd"dZd"dZdS )#Unixa
On Unix/Linux, we follow the `XDG Basedir Spec `_.
The spec allows overriding directories with environment variables. The examples shown are the default values,
alongside the name of the environment variable that overrides them. Makes use of the `appname
`, `version `, `multipath
`, `opinion `, `ensure_exists
`.
r strc t j dd }| st j d }| | S )z
:return: data directory tied to the user, e.g. ``~/.local/share/$appname/$version`` or
``$XDG_DATA_HOME/$appname/$version``
XDG_DATA_HOME z~/.local/shareosenvirongetstrippath
expanduser_append_app_name_and_versionselfr s r
user_data_dirzUnix.user_data_dir' sS z~~or22zz|| 87%%&677D00666r list[str]c t j dd }| sdt j d} fd| t j D S )N
XDG_DATA_DIRSr z/usr/local/sharez
/usr/sharec : g | ]} | S r .0pr" s r
z(Unix._site_data_dirs..7 ' UUU11!44UUUr )r r r r pathsepsplitr! s ` r _site_data_dirszUnix._site_data_dirs2 sb z~~or22zz|| =T>TUUUUr c l | j }| j s|d S t j | S )aZ
:return: data directories shared by users (if `multipath ` is
enabled and ``XDG_DATA_DIRS`` is set and a multi path the response is also a multi path separated by the
OS path separator), e.g. ``/usr/local/share/$appname/$version`` or ``/usr/share/$appname/$version``
r )r1 multipathr r/ joinr" dirss r
site_data_dirzUnix.site_data_dir9 s3 #~ 7Nzt$$$r c t j dd }| st j d }| | S )z
:return: config directory tied to the user, e.g. ``~/.config/$appname/$version`` or
``$XDG_CONFIG_HOME/$appname/$version``
XDG_CONFIG_HOMEr z ~/.configr r! s r user_config_dirzUnix.user_config_dirF sS z~~/44zz|| 37%%k22D00666r c t j dd }| sd} fd| t j D S )NXDG_CONFIG_DIRSr z/etc/xdgc : g | ]} | S r( r) r* s r r- z*Unix._site_config_dirs..V r. r )r r r r r0 r/ r! s ` r _site_config_dirszUnix._site_config_dirsQ sV z~~/44zz|| DUUUUdjj>T>TUUUUr c l | j }| j s|d S t j | S )a2
:return: config directories shared by users (if `multipath `
is enabled and ``XDG_CONFIG_DIRS`` is set and a multi path the response is also a multi path separated by
the OS path separator), e.g. ``/etc/xdg/$appname/$version``
r )r> r3 r r/ r4 r5 s r site_config_dirzUnix.site_config_dirX s3 %~ 7Nzt$$$r c t j dd }| st j d }| | S )z
:return: cache directory tied to the user, e.g. ``~/.cache/$appname/$version`` or
``~/$XDG_CACHE_HOME/$appname/$version``
XDG_CACHE_HOMEr z~/.cacher r! s r user_cache_dirzUnix.user_cache_dire sS z~~.33zz|| 27%%j11D00666r c , | d S )zO:return: cache directory shared by users, e.g. ``/var/cache/$appname/$version``z
/var/cacher) r" s r site_cache_dirzUnix.site_cache_dirp s 00>>>r c t j dd }| st j d }| | S )z
:return: state directory tied to the user, e.g. ``~/.local/state/$appname/$version`` or
``$XDG_STATE_HOME/$appname/$version``
XDG_STATE_HOMEr z~/.local/stater r! s r user_state_dirzUnix.user_state_diru sT z~~.33zz|| 87%%&677D00666r c | j }| j r5t j |d }| | |S )zg:return: log directory tied to the user, same as `user_state_dir` if not opinionated else ``log`` in itlog)rI opinionr r r4 _optionally_create_directoryr! s r user_log_dirzUnix.user_log_dir sD "<