toolchain: supports .zip root directory detection
This commit is contained in:
parent
3e2ff0f300
commit
0415b214f7
|
@ -319,8 +319,11 @@ class Recipe(object):
|
||||||
archive = tarfile.open(filename)
|
archive = tarfile.open(filename)
|
||||||
root = archive.next().path.split("/")
|
root = archive.next().path.split("/")
|
||||||
return root[0]
|
return root[0]
|
||||||
|
elif filename.endswith(".zip"):
|
||||||
|
with zipfile.ZipFile(filename) as zf:
|
||||||
|
return dirname(zf.namelist()[0])
|
||||||
else:
|
else:
|
||||||
print("Error: cannot detect root direction")
|
print("Error: cannot detect root directory")
|
||||||
print("Unrecognized extension for {}".format(filename))
|
print("Unrecognized extension for {}".format(filename))
|
||||||
raise Exception()
|
raise Exception()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue