From 389eaca8264c8d7afe3a78a05d966beb79a90967 Mon Sep 17 00:00:00 2001 From: ducdetronquito Date: Tue, 15 Oct 2024 13:20:04 +0200 Subject: [PATCH] fix(ci): Run pyright postinstall scripts manually Pyright postinstall scripts are as follow (stripped) ```json "scripts": { "postinstall": "node ./build/skipBootstrap.js || npm run install:others", "install:others": "cross-env SKIP_LERNA_BOOTSTRAP=yes lerna exec --no-bail npm install", } ``` When running `pybun install` on the pyright repository, bun execute the postinstall script and replace `npm run install:others` with `bun install:others`. But since we use pybun, we don't have a `bun` CLI available so the `bun install:others` command fail. To fix this, I rewrite the postinstall script to make it use `pybun` instead of `bun`. --- src/build_pyright.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/build_pyright.py b/src/build_pyright.py index f2149fb..debaaad 100644 --- a/src/build_pyright.py +++ b/src/build_pyright.py @@ -57,7 +57,28 @@ def install_pyright_dependencies(pyright_version: str): logger.info(f"Install pyright {pyright_version} dependencies") with chdir(f"./temp/pyright-{pyright_version}"): - return_code = subprocess.call([sys.executable, "-m", "pybun", "install"]) + return_code = subprocess.call( + [sys.executable, "-m", "pybun", "install", "--ignore-scripts"] + ) + if return_code != 0: + logger.error(f"Failed with code {return_code}") + return sys.exit(return_code) + + with chdir(f"./temp/pyright-{pyright_version}"): + return_code = subprocess.call( + [ + "pybun", + "run", + "cross-env", + "SKIP_LERNA_BOOTSTRAP=yes", + "lerna", + "exec", + "--no-bail", + "pybun", + "install", + ] + ) + if return_code != 0: logger.error(f"Failed with code {return_code}") return sys.exit(return_code)