From 0415b214f7e6c423f7e1a1f651026ccc05533466 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Mon, 9 Feb 2015 11:58:29 +0100 Subject: [PATCH] toolchain: supports .zip root directory detection --- toolchain.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/toolchain.py b/toolchain.py index 7715828..4322e5c 100644 --- a/toolchain.py +++ b/toolchain.py @@ -319,8 +319,11 @@ class Recipe(object): archive = tarfile.open(filename) root = archive.next().path.split("/") return root[0] + elif filename.endswith(".zip"): + with zipfile.ZipFile(filename) as zf: + return dirname(zf.namelist()[0]) else: - print("Error: cannot detect root direction") + print("Error: cannot detect root directory") print("Unrecognized extension for {}".format(filename)) raise Exception()