MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / prep_package

Function prep_package

tools/embed_js.py:39–58  ·  view source on GitHub ↗
(web_backend_path, pkg)

Source from the content-addressed store, hash-verified

37
38
39def prep_package(web_backend_path, pkg):
40 source = web_backend_path / 'node_modules' / pkg.name / pkg.source
41 license = web_backend_path / 'node_modules' / pkg.name / pkg.license
42 if not source.exists():
43 # Exact version should already be saved in package.json, so we use
44 # --no-save here.
45 try:
46 subprocess.run(['npm', 'install', '--no-save', pkg.name],
47 cwd=web_backend_path)
48 except FileNotFoundError as err:
49 raise ValueError(
50 f'npm must be installed to fetch {pkg.name}') from err
51 if not source.exists():
52 raise ValueError(
53 f'{pkg.name} package is missing source in {pkg.source}')
54 elif not license.exists():
55 raise ValueError(
56 f'{pkg.name} package is missing license in {pkg.license}')
57
58 return source, license
59
60
61def gen_embedded_lines(pkg, source):

Callers 1

build_mpljsFunction · 0.85

Calls 1

runMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…