mirror of
https://github.com/lutris/lutris
synced 2024-11-02 10:19:50 +00:00
Fix python-magic
- Fix message at startup when python-magic is not installed - Fix compatibility with official file python bindings
This commit is contained in:
parent
d477d610be
commit
b1a6129258
1 changed files with 9 additions and 7 deletions
|
@ -12,13 +12,15 @@ except ImportError:
|
|||
magic = None
|
||||
|
||||
|
||||
if not hasattr(magic, "from_file"):
|
||||
if hasattr(magic, "detect_from_filename"):
|
||||
magic.from_file = magic.detect_from_filename # pylint: disable=no-member
|
||||
MAGIC_AVAILABLE = True
|
||||
else:
|
||||
logger.error("Your version of python-magic is too old.")
|
||||
MAGIC_AVAILABLE = False
|
||||
if not MAGIC_AVAILABLE:
|
||||
logger.error("Magic not available. Unable to automatically find game executables. Please install python-magic")
|
||||
else:
|
||||
if not hasattr(magic, "from_file"):
|
||||
if hasattr(magic, "detect_from_filename"):
|
||||
magic.from_file = lambda f: magic.detect_from_filename(f).name # pylint: disable=no-member
|
||||
else:
|
||||
logger.error("Your version of python-magic is too old.")
|
||||
MAGIC_AVAILABLE = False
|
||||
|
||||
|
||||
def is_excluded_elf(filename):
|
||||
|
|
Loading…
Reference in a new issue