Support packages that don't contain package directory

This commit is contained in:
alessandro.molina 2022-06-02 11:05:29 -04:00
parent 364952b154
commit da8cefb4fb
1 changed files with 2 additions and 1 deletions

View File

@ -78,8 +78,9 @@ def install_jspackage(package_name, version, modulesdir):
tmpdir = tempfile.mkdtemp()
try:
tb.extractall(tmpdir)
dirname = os.listdir(tmpdir)[0]
shutil.rmtree(os.path.abspath(dest), ignore_errors=True)
shutil.move(os.path.join(tmpdir, 'package'),
shutil.move(os.path.join(tmpdir, dirname),
os.path.abspath(dest))
finally:
shutil.rmtree(tmpdir)