Skip to content

Commit

Permalink
Backport PR jupyterlab#7728: Fix handling of linked extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongrout authored and meeseeksmachine committed Jan 16, 2020
1 parent 7b9efd9 commit 9602818
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion jupyterlab/commands.py
Expand Up @@ -1202,13 +1202,15 @@ 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():
path = pjoin(self.app_dir, 'staging', 'linked_packages')
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()
Expand Down Expand Up @@ -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)

Expand All @@ -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))

Expand Down

0 comments on commit 9602818

Please sign in to comment.