libdnf5.utils
- class libdnf5.utils.Locale(std_name)
Class for passing locale
- get_c_locale()
- get_cpp_locale()
- thisown
- libdnf5.utils.LockAccess_READ
- libdnf5.utils.LockAccess_WRITE
- libdnf5.utils.LockBlocking_BLOCKING
- libdnf5.utils.LockBlocking_NON_BLOCKING
- class libdnf5.utils.Locker(*args)
Object for implementing a simple file mutex mechanism or checking read/write access on a given path.
- get_path()
Get the path being locked
- lock(type, blocking)
Acquire a read or write lock on a given file path, either blocking or non-blocking. :rtype: boolean :return: True if lock acquisition was successful, otherwise false :raises: libdnf5::SystemError if an unexpected error occurs when checking the lock state, like insufficient privileges
- open_file(type)
Open the file but don’t acquire a lock yet. Useful for checking permissions. :raises: libdnf5::SystemError if an unexpected error occurs when opening the file
- read_content()
Read content from the lock file, requires the file to be open. :rtype: string :return: The content of the lock file :raises: libdnf5::RuntimeError if the file is not open :raises: libdnf5::SystemError if reading fails
- read_lock()
Try to acquire read lock on a given file path :rtype: boolean :return: True if lock acquisition was successful, otherwise false :raises: libdnf5::SystemError if an unexpected error occurs when checking the lock state, like insufficient privileges
- thisown
- unlock()
Unlock the existing lock and remove the underlying lock file :raises: libdnf5::SystemError if an unexpected error occurs when unlocking
- write_content(content)
Write content to the lock file :type content: string :param content: The content to write to the lock file :raises: libdnf5::SystemError if the lock file is not opened or writing fails
- write_lock()
Try to acquire write lock on a given file path :rtype: boolean :return: True if lock acquisition was successful, otherwise false :raises: libdnf5::SystemError if an unexpected error occurs when checking the lock state, like insufficient privileges
- libdnf5.utils.is_file_pattern(pattern)
Check if a given pattern is a file path.
- Parameters:
pattern (string) – Text pattern to be test
- Return type:
boolean
- Returns:
True if a given pattern is a file path
- libdnf5.utils.is_glob_pattern(pattern)
Check if a given pattern is a GLOB.
- Parameters:
pattern (string) – Text pattern to be test
- Return type:
boolean
- Returns:
True if a given pattern is a GLOB