\bg)dZddlmZddlZddlZddlmZddlmZddl m Z m Z ddl m Z ejd krdd Zndd lmZGdde ZddZddZdgZdS)zUnix.) annotationsN) ConfigParser)Path)IteratorNoReturn)PlatformDirsABCwin32returnrc$d}t|)Nzshould only be used on Unix) RuntimeError)msgs u/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/setuptools/_vendor/platformdirs/unix.pygetuidrs+3)rc"eZdZdZed!dZed"dZed!dZed!dZed"d Z ed!d Z ed!d Z ed!d Z ed!d Z ed!dZed!dZed!dZed!dZed!dZed!dZed!dZed!dZed!dZed#dZed#dZed#dZd$dZd%dZd%dZd S)&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 strctjdd}|stjd}||S)z :return: data directory tied to the user, e.g. ``~/.local/share/$appname/$version`` or ``$XDG_DATA_HOME/$appname/$version`` XDG_DATA_HOMEz~/.local/shareosenvirongetstrippath expanduser_append_app_name_and_versionselfrs r user_data_dirzUnix.user_data_dir$sS z~~or22zz|| 87%%&677D00666r list[str]ctjdd}|sdtjd}fd|tjDS)N XDG_DATA_DIRSrz/usr/local/sharez /usr/sharec:g|]}|Sr.0pr!s r z(Unix._site_data_dirs..4'UUU11!44UUUr)rrrrpathsepsplitr s` r_site_data_dirszUnix._site_data_dirs/sbz~~or22zz|| =T>TUUUUrcl|j}|js|dStj|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)r0 multipathrr.joinr!dirss r site_data_dirzUnix.site_data_dir6s3#~ 7Nzt$$$rctjdd}|stjd}||S)z :return: config directory tied to the user, e.g. ``~/.config/$appname/$version`` or ``$XDG_CONFIG_HOME/$appname/$version`` XDG_CONFIG_HOMErz ~/.configrr s ruser_config_dirzUnix.user_config_dirCsS z~~/44zz|| 37%%k22D00666rctjdd}|sd}fd|tjDS)NXDG_CONFIG_DIRSrz/etc/xdgc:g|]}|Sr'r(r)s rr,z*Unix._site_config_dirs..Sr-r)rrrrr/r.r s` r_site_config_dirszUnix._site_config_dirsNsVz~~/44zz|| DUUUUdjj>T>TUUUUrcl|j}|js|dStj|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=r2rr.r3r4s rsite_config_dirzUnix.site_config_dirUs3%~ 7Nzt$$$rctjdd}|stjd}||S)z :return: cache directory tied to the user, e.g. ``~/.cache/$appname/$version`` or ``~/$XDG_CACHE_HOME/$appname/$version`` XDG_CACHE_HOMErz~/.cacherr s ruser_cache_dirzUnix.user_cache_dirbsS z~~.33zz|| 27%%j11D00666rc,|dS)zO:return: cache directory shared by users, e.g. ``/var/cache/$appname/$version``z /var/cacher(r!s rsite_cache_dirzUnix.site_cache_dirms00>>>rctjdd}|stjd}||S)z :return: state directory tied to the user, e.g. ``~/.local/state/$appname/$version`` or ``$XDG_STATE_HOME/$appname/$version`` XDG_STATE_HOMErz~/.local/staterr s ruser_state_dirzUnix.user_state_dirrsT z~~.33zz|| 87%%&677D00666rc|j}|jr5tj|d}|||S)zg:return: log directory tied to the user, same as `user_state_dir` if not opinionated else ``log`` in itlog)rHopinionrrr3_optionally_create_directoryr s r user_log_dirzUnix.user_log_dir}sD" < 47<<e,,D  - -d 3 3 3 rc"tddS)zC:return: documents directory tied to the user, e.g. ``~/Documents``XDG_DOCUMENTS_DIRz ~/Documents_get_user_media_dirrDs ruser_documents_dirzUnix.user_documents_dirs##6 FFFrc"tddS)zC:return: downloads directory tied to the user, e.g. ``~/Downloads``XDG_DOWNLOAD_DIRz ~/DownloadsrPrDs ruser_downloads_dirzUnix.user_downloads_dirs##5}EEErc"tddS)zA:return: pictures directory tied to the user, e.g. ``~/Pictures``XDG_PICTURES_DIRz ~/PicturesrPrDs ruser_pictures_dirzUnix.user_pictures_dirs##5|DDDrc"tddS)z=:return: videos directory tied to the user, e.g. ``~/Videos``XDG_VIDEOS_DIRz~/VideosrPrDs ruser_videos_dirzUnix.user_videos_dirs##3Z@@@rc"tddS)z;:return: music directory tied to the user, e.g. ``~/Music`` XDG_MUSIC_DIRz~/MusicrPrDs ruser_music_dirzUnix.user_music_dirs#?I>>>rc"tddS)z?:return: desktop directory tied to the user, e.g. ``~/Desktop``XDG_DESKTOP_DIRz ~/DesktoprPrDs ruser_desktop_dirzUnix.user_desktop_dirs##4kBBBrc|tjdd}|sttjdrDdt}t| sdt}ndt}| |S)az :return: runtime directory tied to the user, e.g. ``/run/user/$(id -u)/$appname/$version`` or ``$XDG_RUNTIME_DIR/$appname/$version``. For FreeBSD/OpenBSD/NetBSD, it would return ``/var/run/user/$(id -u)/$appname/$version`` if exists, otherwise ``/tmp/runtime-$(id -u)/$appname/$version``, if``$XDG_RUNTIME_DIR`` is not set. XDG_RUNTIME_DIRrfreebsdopenbsdnetbsdz/var/run/user/z /tmp/runtime-z /run/user/) rrrrsysplatform startswithrrexistsrr s ruser_runtime_dirzUnix.user_runtime_dirsz~~/44zz|| /|&&'GHH /222Dzz((**6568855D.FHH..00666rctjdd}|s$tjdrd}nd}||S)am :return: runtime directory shared by users, e.g. ``/run/$appname/$version`` or ``$XDG_RUNTIME_DIR/$appname/$version``. Note that this behaves almost exactly like `user_runtime_dir` if ``$XDG_RUNTIME_DIR`` is set, but will fall back to paths associated to the root user instead of a regular logged-in user if it's not set. If you wish to ensure that a logged-in root user path is returned e.g. ``/run/user/0``, use `user_runtime_dir` instead. For FreeBSD/OpenBSD/NetBSD, it would return ``/var/run/$appname/$version`` if ``$XDG_RUNTIME_DIR`` is not set. rcrrdz/var/runz/run)rrrrrhrirjrr s rsite_runtime_dirzUnix.site_runtime_dirscz~~/44zz|| |&&'GHH !00666rrc6||jS)zh:return: data path shared by users. Only return the first item, even if ``multipath`` is set to ``True``) _first_item_as_path_if_multipathr6rDs rsite_data_pathzUnix.site_data_paths44T5GHHHrc6||jS)zj:return: config path shared by the users, returns the first item, even if ``multipath`` is set to ``True``)rpr?rDs rsite_config_pathzUnix.site_config_paths44T5IJJJrc6||jS)zi:return: cache path shared by users. Only return the first item, even if ``multipath`` is set to ``True``)rprErDs rsite_cache_pathzUnix.site_cache_paths44T5HIIIr directorycx|jr%|tjd}t |S)Nr)r2r/rr.r)r!rvs rrpz%Unix._first_item_as_path_if_multipaths0 > 7! 33A6IIr Iterator[str]c#6K|jV|jEd{VdS)z4:yield: all user and site configuration directories.N)r9r=rDs riter_config_dirszUnix.iter_config_dirss6""""))))))))))rc#6K|jV|jEd{VdS)z+:yield: all user and site data directories.N)r"r0rDs riter_data_dirszUnix.iter_data_dirss6    ''''''''''rN)r r)r r#)r r)rvrr r)r rx)__name__ __module__ __qualname____doc__propertyr"r0r6r9r=r?rBrErHrMrRrUrXr[r^rarlrnrqrsrurprzr|r'rrrrs"  777X7VVVXV  % % %X %777X7VVVXV  % % %X %777X7???X?777X7XGGGXGFFFXFEEEXEAAAXA???X?CCCXC777X7&777X7*IIIXIKKKXKJJJXJ **** ((((((rrenv_varrfallback_tilde_pathct|}|Stj|d}|stj|}|S)Nr)_get_user_dirs_folderrrrrrr)rr media_dirs rrQrQs[%g..IJNN7B//5577  @**+>??I rkey str | Nonecttjdz }|rt }|5}|d|dddn #1swxYwY||dvrdS|d|d}| dtj dSdS)z{ Return directory from user-dirs.dirs config file. See https://freedesktop.org/wiki/Software/xdg-user-dirs/. zuser-dirs.dirsz[top] Ntop"z$HOME~) rrr9rkropen read_stringreadrreplacerrr)ruser_dirs_config_pathparserstreamrs rrrs !!788;KK##%% > " ' ' ) ) :V   888 9 9 9 : : : : : : : : : : : : : : : fUm # #4e}S!'',,||GRW%7%7%<%<=== 4s+BBB)r r)rrrrr r)rrr r)r __future__rrrh configparserrpathlibrtypingrrapir rirrrQr__all__r'rrrs! """""" %%%%%%%%%%%%%% <7     T(T(T(T(T(?T(T(T(n4  r