Edit File: pluginlib.cpython-311.opt-1.pyc
� �����e������������������������v����d�Z�ddlmZ�ddlmZ�ddlmZ�ddlZddlZddlZddlZddl Z ddl Z ddlZddlm Z �ddlmZ�ddlmZmZ�d d lmZmZmZ�d dlmZ��edd� ������������Ze���������������������e�������������dZdZdZdZe���������������������dd�������������r<e� ��������������������dd�������������Zej!���������"��������������������e������������s�e#d�������������ej!���������$��������������������ej!���������%��������������������e&������������d������������Z'dZ(dZ)dZ*dZ+dZ,dZ-dZ.e(de)de*de+d e,d!e-d"e.d#iZ/d$��Z0d*d%�Z1d+d&�Z2d'��Z3d(��Z4efd)�Z5dS�),z Library to work with plug-ins �����)�print_function)�absolute_import)�divisionN)� import_module)�ConfigParser)�lvectl_custompanel_script�CLSYSCONFIG����)�CACHE_CPNAME�UNKNOWN_CP_NAME�UNKNOWN_CP_IMPORT)�PluginImportErrorF)� interpolation�strict� __cpname__�detectzclcommon.cpapi�cpapi� plugindir)�section�optionz5WARNING: plugindir is configured, but doesn't exists!z apilink.py�cPanel�DirectAdmin�Plesk� ISPManager� InterWorx�Unknown� Integrated�cpanel�directadmin�plesk� ispmanager� interworx�backward_plugin�vendorsc�����������������������d\��}�}t�����������j�����������������������������d������������rt����������t����������t�������������������}}��n�t�����������j�����������������������������d������������rt ����������t����������t �������������������}}��nIt�����������j�����������������������������d������������st�����������j�����������������������������d������������rt����������t����������t�������������������}}�n�t�����������j�����������������������������d������������rt����������t����������t�������������������}}�n�t�����������j�����������������������������d������������st�����������j�����������������������������d������������rt����������t����������t�������������������}}�n`t�����������j�����������������������������d ������������rt����������t����������t�������������������}}�n't�������������������������t����������t����������t�������������������}}�|�|fS�) z� This function will try to detect our officially supported control panels :return: tuple of CP name and CP plugin name to import �NNz!/opt/cpvendor/etc/integration.iniz/usr/local/cpanel/cpanelz"/usr/local/directadmin/directadminz(/usr/local/directadmin/custombuild/buildz/usr/local/psa/versionz/usr/local/ispmgr/bin/ispmgrz/usr/local/mgr5z/usr/local/interworx) �os�path�isfile�INTEGRATED_NAME�OFFICIAL_PLUGINS�CPANEL_NAME�DIRECTADMIN_NAME� PLESK_NAME�isdir�ISPMANAGER_NAME�INTERWORX_NAMEr����UNKNOWN_NAME)� panel_name�official_plugin_names��� ��/builddir/build/BUILDROOT/alt-python27-cllib-3.3.5-1.el8.cloudlinux.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/clcommon/cpapi/pluginlib.py�detect_panel_fastr6���@���se����� �(2�$�J�$� �w�~�~�9�:�:��X�+:�<L�_�<]�(� � � ����2� 3� 3��X�+6�8H��8U�(� � � ����<� =� =�� X��G�N�N�E�F�F� X�+;�=M�N^�=_�(� � � ����0� 1� 1�� X�+5�7G� �7S�(� � �� ����6� 7� 7��X�2�7�=�=�IZ�;[�;[��X�+:�<L�_�<]�(� � � ����-� .� .��X�+9�;K�N�;[�(� � � "� $� $� 0�+7�9I�,�9W�(� ��+�+�+�����c������������������f�����|�r(t����������d���������������������t����������|�������������������������S�ddlm}�|S�)Nz {}.plugins.{}r ���)�api)r����format�PLUGINS_PKG_PREFIX�apilinkr9���)�plugin_name� _apiplugins��� r5����get_cp_plugin_moduler?���[���sD��������V��_�3�3�4F��T�T�U�U�U��+�*�*�*�*�*��r7���c����������������������t�����������j�����������������������������t�����������j�����������������������������t����������������������|�������������}t�����������j�����������������������������|d������������}d��t����������j��������|������������D���������������}|D�]�}|dk����r� d���������������������t����������|�|������������}d|��d|�d�} �t����������|������������}n%#�t����������$�r�|rY��Mt����������d|�d ��������������w�xY�w �|�����������������������������������} | �����������������������������������} || d ���������fc�S�#�t����������t����������t����������f$�rJ}t!����������j��������t ����������j��������d���������������������|t%����������|�������������������������������������Y�d}~��d}~ww�xY�wd S�)a��� Scan directory for presence of plugins. Plugin is a file that has the extension ".py" and a non-empty variable "__cpname__" (the name of the control panel). The file must contain a function "detect" which returns True in case of presence of the corresponding control panel. >>> detectplugin('plugins') ('from .plugins import cpanel as api', 'cPanel') :param plugin_pack: package name or the name of the plug-ins directory ('cache' - cache plugins users; 'plugins' - officially supported plug-ins) :rtype: tuple :return: a pair of values: (line to import the package, the name of the control panel) z*.pyc�����������������������g�|�]D}t�����������j�����������������������������t�����������j�����������������������������|������������������������d������������ES�)r���)r'���r(����splitext�basename)�.0�py_full_paths��� r5���� <listcomp>z detectplugin.<locals>.<listcomp>w���sM�������������� ������)�)�,�7�7�8�8��;�����r7����__init__z{}.{}.{}zfrom .z import z as apizCan not import z plugin�namez8cpapi: Plugin {} does not satisfy cpapi requirements: {}Nr&���)r'���r(����join�dirname�__file__�globr:���r;���r����ImportErrorr����PanelPlugin�get_cp_description�AttributeError� TypeError�KeyError�syslog�LOG_WARNING�str)�plugin_pack� ignore_errors� plugin_dir�plugin_path_pattern�modules�mod_name�absolute_module_name� import_stringr9����panel_class� panel_data�excs��� r5����detectpluginra���e���s������ �����b�g�o�o�h�7�7��E�E�J��'�,�,�z�6�:�:����� �I�&9�:�:������G� ��������z�!�!��)�0�0�1C�[�RZ�[�[���7B�{�{�H�H�H�M� � ^�� 4�5�5�C�C���� ^�� ^�� ^��� ^���'�'�FZ�FZ�FZ�(\�]�]�]� ^���� ��/�/�+�+�K�$�7�7�9�9�J� �*�V�"4�4�4�4�4��� �8�4�� �� �� ��M��"�K�R�R��c�#�h�h�(��(� �� �� �� �� �� �� �� ����� ������:s+����2C�C$�C$�(1D�E=�3A�E8�8E=c�������������������l�����t����������j����������������������}�|�dk����rdS�t����������j��������|�������������d���������S�)zJ Get current user's username based on os.getuid() :rtype: str r����root)r'����getuid�pwd�getpwuid)�uids��� r5����getuserrh�������s2������ � �)�+�+�C� �a�x�x��v��<����Q��r7���c������������������������t����������|�d������������������������������������������������ddl}|���������������������|��������������t ����������j��������d���������������������t����������j��������|�������������dd��������������dS�)zAcreate (or rewrite) an empty __init__.py and it's .pyc/.pyo parts�wr���Nz{} -O -m py_compile "{}"Tz /bin/bash)�shell� executable) �open�close� py_compile�compile� subprocess�runr:����sysrl���)� init_pathro���s��� r5����_reinit_moduleru�������sp��������C����� � � ��������y�!�!�!��N�-�4�4�S�^�Y�O�O�W[�hs�t�t�t�t�t�tr7���c������������������`����d}d}t�����������j�����������������������������t�����������j�����������������������������t����������������������|������������}t����������j��������|�������������|�r5t�����������j�����������������������������|�������������rt����������j��������|�|�������������nt����������j ��������|�������������t����������j ��������|d�������������t�����������j�����������������������������|d������������}t����������|������������� �t����������|������������\��}}n>#�t����������$�r1}d\��}}t����������d���������������������|�������������������������Y�d�}~nd�}~ww�xY�w|�Kt����������j��������|�������������t����������j ��������|�������������t����������|�������������t����������|d�������������\��}}|� t ����������t"����������}}t����������d |z���������������|r�t%����������t&����������d ������������}|���������������������|�������������|������������������������������������t%����������t,����������d ������������} | ���������������������|dz����������������| ������������������������������������d�S�d�S�)N�cache�pluginsi���z__init__.pyr&���zWARNING: {}T)rW���zHWARNING: can not detect control panel; the control panel is set to "%s" rj���� )r'���r(���rI���rJ���rK����shutil�rmtreer/����copytree�mkdir�chmodru���ra���r����printr:���r ���r���rm���r����writern���� API_LINK_PATH) �plugins_dir� CACHE_DIR�PLUGINS_PATH� cache_dirrt���r]����cpnamer`����cpname_cache�api_link_streams ��� r5���� rebuild_cacher��������s������I��L�����R�W�_�_�X�6�6� �B�B�I� �M�)�������r�w�}�}�[�1�1������Y�/�/�/�/� �������H�Y���������Y� �6�6�I��9����)� ,�Y� 7� 7�� �v�v����)��)��)� *�� �v� �m�"�"�3�'�'�(�(�(�(�(�(�(�(�����)������~�� �i� � � � �������y�!�!�!� ,�\�� N� N� N�� �v� �~�!2�O�v� � �X�[a�a�b�b�b� �� ��L�#�.�.�����6�"�"�"������� ��}�c�2�2�����m�d�2�3�3�3��������� �� s����+C>��> D9�'D4�4D9)N)F)6�__doc__� __future__r���r���r���r'���rq���rs���re���rL���rz���rS���� importlibr����configparserr����clcommon.clcustomscriptr���r ����constr���r���r ����cpapiexceptionsr����clsysconfig�read�CONTROLPANELNAME_VAR�DETECTFUNCNAME_VARr;����PLUGINS_DIR� has_option�getr(����existsr���rI���rJ���rK���r����r,���r-���r.���r0���r1���r2���r*���r+���r6���r?���ra���rh���ru���r������r7���r5����<module>r�������s~��������&��%��%��%��%��%��&��&��&��&��&��&�������������� � � � ���������� � � � �� � � � ������� � � � �� � � � ��#��#��#��#��#��#��%��%��%��%��%��%��J��J��J��J��J��J��J��J��C��C��C��C��C��C��C��C��C��C��.��.��.��.��.��.��l��e�<�<�<���������������#������%��������'�+��>�>��G��/�/�'�+�/�F�F�K� �7�>�>�+�&�&��G� ��E�F�F�F�����R�W�_�_�X�6�6��E�E� ��� ��� � �������������m����\��K��#��Y����,��,��,�6�������.��.��.��.�b �� �� �u��u��u��*��+ ��+ ��+ ��+ ��+ ��+ r7���