Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of linked extensions #7728

Merged
merged 1 commit into from Jan 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions jupyterlab/commands.py
Expand Up @@ -1186,7 +1186,7 @@ def _populate_staging(self, name=None, version=None, static_url=None,
json.dump(data, fid, indent=4)

# copy known-good yarn.lock if missing
lock_path = pjoin(staging, 'yarn.lock')
lock_path = pjoin(staging, 'yarn.lock')
lock_template = pjoin(HERE, 'staging', 'yarn.lock')
if self.registry != YARN_DEFAULT_REGISTRY: # Replace on the fly the yarn repository see #3658
with open(lock_template, encoding='utf-8') as f:
Expand Down Expand Up @@ -1219,13 +1219,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 @@ -1281,6 +1283,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 @@ -1290,7 +1295,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 Expand Up @@ -1774,7 +1779,7 @@ def _node_check(logger):

def _yarn_config(logger):
"""Get the yarn configuration.

Returns
-------
{"yarn config": dict, "npm config": dict} if unsuccessfull the subdictionary are empty
Expand Down