From 96028181b3867a18dc4e704392e4a6615b484070 Mon Sep 17 00:00:00 2001 From: Jason Grout Date: Mon, 6 Jan 2020 06:27:41 +0100 Subject: [PATCH] Backport PR #7728: Fix handling of linked extensions --- jupyterlab/commands.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jupyterlab/commands.py b/jupyterlab/commands.py index 8bd606337fc4..06bd54a98b9f 100644 --- a/jupyterlab/commands.py +++ b/jupyterlab/commands.py @@ -1202,6 +1202,7 @@ def format_path(path): # Handle local extensions. for (key, source) in local.items(): jlab['linkedPackages'][key] = source + data['resolutions'][key] = source # Handle linked packages. for (key, item) in linked.items(): @@ -1209,6 +1210,7 @@ def format_path(path): path = pjoin(path, item['filename']) data['dependencies'][key] = format_path(path) jlab['linkedPackages'][key] = item['source'] + data['resolutions'][key] = format_path(path) # Handle extensions compat_errors = self._get_extension_compat() @@ -1264,6 +1266,9 @@ def _update_local(self, name, source, dname, data, dtype): """ # Extract the package in a temporary directory. existing = data['filename'] + if not osp.exists(pjoin(dname, existing)): + existing = '' + with TemporaryDirectory() as tempdir: info = self._extract_package(source, tempdir) @@ -1273,7 +1278,7 @@ def _update_local(self, name, source, dname, data, dtype): shutil.move(info['path'], pjoin(dname, info['filename'])) - # Remove the existing tarball and return the new file name. + # Remove the previous tarball and return the new file name. if existing: os.remove(pjoin(dname, existing))