ok
Direktori : /proc/self/root/usr/lib/python2.7/site-packages/clcommon/cpapi/ |
Current File : //proc/self/root/usr/lib/python2.7/site-packages/clcommon/cpapi/pluginlib.pyc |
� b=0Yc @ s d Z d d l Z d d l m Z d d l Z d d l Z d d l m Z m Z m Z d d l m Z d Z e � Z e j e � d Z d Z d Z e j d d d d � r� e j d d d d � Z n e j j e j j e � d � Z d � Z e d � Z d S( s Library to work with plug-ins i����N( t ConfigParser( t CACHE_CPNAMEt UNKNOWN_CP_NAMEt UNKNOWN_CP_IMPORT( t PluginImportErrors /etc/sysconfig/cloudlinuxt __cpname__t detectt sectiont cpapit optiont plugindirs apilink.pyc B s e j j e j j e � | � } g e j e j j | d � � D]( } e j j e j j | � � d ^ q@ } x� | D]� } | d k r� qu n d } d | | f } y | d UWn e d | f � � n Xe | e d � } | ru e | e d � } | r| � r| | f Squ qu Wd S( s� Scan directory for the presence of plugins. Plugin is considered a file with the extension "py", and with a non-empty variable "__cpname__" inside (the name of the control panel). Also in the file must be a function "detect" which returns True in the case of the presence of the 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) s *.pyi t __init__s from %s import %s as apiNs Can not import %s plugin( NN( t ost patht joint dirnamet __file__t globt splitextt basenamet NoneR t getattrt CONTROLPANELNAME_VARt DETECTFUNCNAME_VAR( t plugin_packt plugin_dirt py_full_patht modulest mod_namet apit import_stringt controlpanelnamet detect_func( ( s<