-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mostly copied from #4784, thank you @YalinLi0312 --------- Co-authored-by: iscai-msft <[email protected]> Co-authored-by: tadelesh <[email protected]>
- Loading branch information
1 parent
cfb11a1
commit ae24780
Showing
20 changed files
with
564 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// This script wraps logic in @azure-tools/extension to resolve | ||
// the path to Python 3 so that a Python script file can be run | ||
// from an npm script in package.json. It uses the same Python 3 | ||
// path resolution algorithm as AutoRest so that the behavior | ||
// is fully consistent (and also supports AUTOREST_PYTHON_EXE). | ||
// | ||
// Invoke it like so: "tsx run-python3.ts script.py" | ||
|
||
import cp from "child_process"; | ||
import { patchPythonPath } from "./system-requirements.js"; | ||
|
||
export async function runPython3(...args: string[]) { | ||
const command = await patchPythonPath(["python", ...args], { | ||
version: ">=3.8", | ||
environmentVariable: "AUTOREST_PYTHON_EXE", | ||
}); | ||
cp.execSync(command.join(" "), { | ||
stdio: [0, 1, 2], | ||
}); | ||
} |
Oops, something went wrong.