+J,dZddlmZddlZddlZddlmZddlmZddl m Z ej dkrdd Z ndd lm Z Gd de Z ddZddZdgZdS)zUnix.) annotationsN) ConfigParser)Path)PlatformDirsABCwin32returnintc$d}t|)Nzshould only be used on Unix) RuntimeError)msgs /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/platformdirs/unix.pygetuidr s+3)rceZdZdZeddZeddZddZeddZedd Z edd Z edd Z edd Z edd Z eddZeddZeddZeddZeddZeddZeddZeddZeddZeddZeddZd dZdS)!Unixa On Unix/Linux, we follow the `XDG Basedir Spec `_. The spec allows overriding directories with environment variables. The examples show 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%%&677D00666rctjdd}|sdtjd}||S)aY :return: data directories shared by users (if `multipath ` is enabled and ``XDG_DATA_DIR`` 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`` XDG_DATA_DIRSrz/usr/local/sharez /usr/share)rrrrpathsep_with_multi_pathrs r site_data_dirzUnix.site_data_dir-sOz~~or22zz|| =z)Unix._with_multi_path..>s8aaaRST66rw7I7I!7L7LMMaaar)splitrr$ multipathjoin)r r path_lists` rr%zUnix._with_multi_path:s[JJrz** ~ '!!A#IaaaaW`aaa zy)))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 ~/.configrrs ruser_config_dirzUnix.user_config_dirAsS z~~/44zz|| 37%%k22D00666rctjdd}|sd}||S)a/ :return: config directories shared by users (if `multipath ` is enabled and ``XDG_DATA_DIR`` 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`` XDG_CONFIG_DIRSrz/etc/xdg)rrrrr%rs rsite_config_dirzUnix.site_config_dirLsCz~~/44zz|| D$$T***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~/.cacherrs ruser_cache_dirzUnix.user_cache_dirYsS z~~.33zz|| 27%%j11D00666rc,|dS)zM:return: cache directory shared by users, e.g. ``/var/tmp/$appname/$version``z/var/tmp)rr s rsite_cache_dirzUnix.site_cache_dirds00<<>>rc"tddS)z?:return: desktop directory tied to the user, e.g. ``~/Desktop``XDG_DESKTOP_DIRz ~/DesktoprGr;s 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 startswithrrexistsrrs 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. rZrr[z/var/runz/run)rrrrr_r`rarrs rsite_runtime_dirzUnix.site_runtime_dirscz~~/44zz|| |&&'GHH !00666rrc6||jS)zd:return: data path shared by users. Only return first item, even if ``multipath`` is set to ``True``) _first_item_as_path_if_multipathr&r;s rsite_data_pathzUnix.site_data_paths44T5GHHHrc6||jS)zj:return: config path shared by the users. Only return first item, even if ``multipath`` is set to ``True``)rgr6r;s rsite_config_pathzUnix.site_config_paths44T5IJJJrc6||jS)ze:return: cache path shared by users. Only return first item, even if ``multipath`` is set to ``True``)rgr<r;s rsite_cache_pathzUnix.site_cache_paths44T5HIIIr directorycx|jr%|tjd}t |S)Nr)r.r-rr$r)r rms rrgz%Unix._first_item_as_path_if_multipaths0 > 7! 33A6IIrN)r r)rrr r)r r)rmrr r)__name__ __module__ __qualname____doc__propertyr!r&r%r3r6r9r<r?rDrIrLrOrRrUrXrcrerhrjrlrgr)rrrrs  777X7 + + +X +****777X7 + + +X +777X7===X=777X7XGGGXGFFFXFEEEXEAAAXA???X?CCCXC777X7&777X7*IIIXIKKKXKJJJXJrrenv_varrfallback_tilde_pathct|}|Stj|d}|stj|}|S)Nr)_get_user_dirs_folderrrrrrr)rtru media_dirs rrHrHs[%g..IJNN7B//5577  @**+>??I rkey str | Nonecttjdz }|rt }|5}|d|dddn #1swxYwY||dvrdS|d|d}| dtj dSdS)zkReturn directory from user-dirs.dirs config file. See https://freedesktop.org/wiki/Software/xdg-user-dirs/.zuser-dirs.dirsz[top] Ntop"z$HOME~) rrr3rbropen read_stringreadrreplacerrr)ryuser_dirs_config_pathparserstreamrs rrwrws !788;KK##%% > " ' ' ) ) :V   888 9 9 9 : : : : : : : : : : : : : : : fUm # #4e}S!'',,||GRW%7%7%<%<=== 4s+BBB)r r )rtrrurr r)ryrr rz)rr __future__rrr_ configparserrpathlibrapirr`rrrHrw__all__r)rrrs  """""" %%%%%% <7     CCCCC?CCCL*  r