From d739669499bd04058f87f40e78405989b6a86dc1 Mon Sep 17 00:00:00 2001 From: Brian Harring Date: Fri, 4 Feb 2011 02:10:38 -0800 Subject: [PATCH] add compatibility for 5.05 of file --- pkgcore/util/file_type.py | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/pkgcore/util/file_type.py b/pkgcore/util/file_type.py index ee8ae7e..2557528 100644 --- a/pkgcore/util/file_type.py +++ b/pkgcore/util/file_type.py @@ -23,7 +23,12 @@ class file_identifier(object): import magic except ImportError: return self._fallback_file - obj = magic.open(magic.MAGIC_NONE) + if hasattr(magic, 'MAGIC_NONE'): + # <5.05 of file + magic_const = magic.MAGIC_NONE + else: + magic_const = magic.NONE + obj = magic.open(magic_const) ret = obj.load() if ret != 0: raise ValueError("non zero ret from loading magic: %s" % ret) -- 1.7.4