diff --git a/pyDeComp-0.1/DeComp/definitions.py b/pyDeComp-0.1/DeComp/definitions.py index 7f444cf..9c86cb6 100644 --- a/pyDeComp-0.1/DeComp/definitions.py +++ b/pyDeComp-0.1/DeComp/definitions.py @@ -15,6 +15,7 @@ Maintained in full by: """ +import os from collections import OrderedDict DEFINITION_FIELDS = OrderedDict([ @@ -62,6 +63,10 @@ values during run time: arm, armthumb, powerpc, sparc, ia64 """ +if os.uname()[0] == "Linux": + xattr_opt = "--xattrs" +else: + xattr_opt = "" COMPRESS_DEFINITIONS = { "Type": ["Compression", "Compression definitions loaded"], @@ -286,32 +291,32 @@ EXTENSION_SEPARATOR = '.' CONTENTS_DEFINITIONS = { "tar": [ "_common", "tar", - ["--xattrs", "-tvf", "%(source)s"], + [xattr_opt, "-tvf", "%(source)s"], "TAR", [".tar"], {"tar"}, ], "gzip": [ "_common", "tar", - ["--xattrs", "-tvzf", "%(source)s"], + [xattr_opt, "-tvzf", "%(source)s"], "GZIP", [".tgz", ".tar.gz", "gz"], {"tar"}, ], "lbzip2": [ "_common", "tar", - ["--xattrs", "-I", "lbzip2", "-tvf", "%(source)s"], + [xattr_opt, "-I", "lbzip2", "-tvf", "%(source)s"], "LBZIP2", [".tbz2", "bz2", ".tar.bz2"], {"tar", "lbzip2"}, ], "bzip2": [ "_common", "tar", - ["--xattrs", "-tvf", "%(source)s"], + [xattr_opt, "-tvf", "%(source)s"], "BZIP2", [".tbz2", "bz2", ".tar.bz2"], {"tar", "bzip2"}, ], "xz": [ "_common", "tar", - ["--xattrs", "-tvf", "%(source)s"], + [xattr_opt, "-tvf", "%(source)s"], "XZ", ["tar.xz", "xz"], {"tar"}, ], "pixz": [ "_common", "tar", - ["--xattrs", "-I", "pixz", "-tvf", "%(source)s"], + [xattr_opt, "-I", "pixz", "-tvf", "%(source)s"], "PIXZ", ["tar.xz", "xz"], {"tar", "pixz"}, ], "isoinfo_l": [ @@ -334,7 +339,13 @@ CONTENTS_DEFINITIONS = { } # isoinfo_f should be a last resort only -CONTENTS_SEARCH_ORDER = [ - "pixz", "lbzip2", "isoinfo_l", "squashfs", - "gzip", "xz", "bzip2", "tar", "isoinfo_f" -] +if os.uname()[0] == "Linux": + CONTENTS_SEARCH_ORDER = [ + "pixz", "lbzip2", "isoinfo_l", "squashfs", + "gzip", "xz", "bzip2", "tar", "isoinfo_f" + ] +else: + CONTENTS_SEARCH_ORDER = [ + "isoinfo_l", "squashfs", + "gzip", "xz", "bzip2", "tar", "isoinfo_f" + ]