File: //lib/python2.7/site-packages/leapp/utils/__pycache__/libraryfinder.cpython-36.pyc
3
�S4b} � @ s d dl Z G dd� de�ZdS )� Nc @ s4 e Zd ZdZdd� Zdd� Zddd�Zdd d
�ZdS )
�LeappLibrariesFinderzL
Implements functionality to dynamically load libraries for actors.
c C s || _ || _dS )a\
:param module_prefix: Prefix string such as 'leapp.libraries.common' or 'leapp.libraries.actor' which is used
to filter the modules to handle with this finder.
:type module_prefix: str
:param paths: List of paths to search for the matching libraries
:type paths: List or Tuple
N)�_paths�_prefix)�self�
module_prefix�paths� r �0/root/tmp_leapp_py3/leapp/utils/libraryfinder.py�__init__ s zLeappLibrariesFinder.__init__c C sX |j | jd �sd S |jd�d }x0tj| j�D ] \}}}||kr0t||�|�S q0W d S )N�.� ���)�
startswithr �split�pkgutil�iter_modulesr �getattr)r �method�fullname�path�module�loader�name�ispkgr r r �_implementation s z$LeappLibrariesFinder._implementationNc C s | j d||d�S )z! Implementation for python >=3.4 � find_spec)r r r )r )r r r �targetr r r r s zLeappLibrariesFinder.find_specc C s | j d||d�S )z Implementation for python <3.4 �find_module)r r r )r )r r r r r r r s z LeappLibrariesFinder.find_module)N)N)�__name__�
__module__�__qualname__�__doc__r
r r r r r r r r s
r )r �objectr r r r r �<module> s