(web_backend_path, license_path)
| 68 | |
| 69 | |
| 70 | def build_mpljs(web_backend_path, license_path): |
| 71 | mpljs_path = web_backend_path / "js/mpl.js" |
| 72 | mpljs_orig = mpljs_path.read_text().splitlines(keepends=True) |
| 73 | try: |
| 74 | mpljs_orig = mpljs_orig[:mpljs_orig.index(MPLJS_MAGIC_HEADER) + 1] |
| 75 | except IndexError as err: |
| 76 | raise ValueError( |
| 77 | f'The mpl.js file *must* have the exact line: {MPLJS_MAGIC_HEADER}' |
| 78 | ) from err |
| 79 | |
| 80 | with mpljs_path.open('w') as mpljs: |
| 81 | mpljs.writelines(mpljs_orig) |
| 82 | |
| 83 | for pkg in JAVASCRIPT_PACKAGES: |
| 84 | source, license = prep_package(web_backend_path, pkg) |
| 85 | mpljs.writelines(gen_embedded_lines(pkg, source)) |
| 86 | |
| 87 | shutil.copy(license, |
| 88 | license_path / f'LICENSE{safe_name(pkg.name)}') |
| 89 | |
| 90 | |
| 91 | if __name__ == '__main__': |
no test coverage detected
searching dependent graphs…