diff --git a/lib/init.js b/lib/init.js index bb0e00503..d4b13fe31 100644 --- a/lib/init.js +++ b/lib/init.js @@ -123,16 +123,22 @@ async function injectWindowsTracer(processName, processLevel, config, codeql, tr exports.injectWindowsTracer = injectWindowsTracer; async function installPythonDeps(codeql, logger) { logger.startGroup("Setup Python dependencies"); - if (process.platform !== "linux") { - logger.info("Currently, auto-installing python dependancies is only supported on linux"); + if (process.platform === "darwin") { + logger.info("Currently, auto-installing python dependancies is not supported on MacOS"); logger.endGroup(); return; } + let install_tools_script = "install_tools.sh"; + let auto_install_packages_script = "auto_install_packages.py"; + if (process.platform === "win32") { + install_tools_script = "install_tools.ps1"; + auto_install_packages_script = "auto_install_packages_windows.py"; + } const scriptsFolder = path.resolve(__dirname, "../python-setup"); // Setup tools on the Github hosted runners if (process.env["ImageOS"] !== undefined) { try { - await new toolrunnner.ToolRunner(path.join(scriptsFolder, "install_tools.sh")).exec(); + await new toolrunnner.ToolRunner(path.join(scriptsFolder, install_tools_script)).exec(); } catch (e) { // This script tries to install some needed tools in the runner. It should not fail, but if it does @@ -143,7 +149,7 @@ async function installPythonDeps(codeql, logger) { } // Install dependencies try { - await new toolrunnner.ToolRunner(path.join(scriptsFolder, "auto_install_packages.py"), [path.dirname(codeql.getPath())]).exec(); + await new toolrunnner.ToolRunner(path.join(scriptsFolder, auto_install_packages_script), [path.dirname(codeql.getPath())]).exec(); } catch (e) { logger.endGroup(); diff --git a/lib/init.js.map b/lib/init.js.map index dd4458cb4..68aaa5736 100644 --- a/lib/init.js.map +++ b/lib/init.js.map @@ -1 +1 @@ -{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,0EAA4D;AAE5D,gEAAkD;AAClD,qCAA+C;AAC/C,4DAA8C;AAG9C,mDAAwE;AACxE,6CAA+B;AAExB,KAAK,UAAU,UAAU,CAC9B,SAA6B,EAC7B,UAAkB,EAClB,SAAiB,E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IAAI,WAAW,CAAC,UAAU,CAC9B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,4BAA4B,CAAC,EACtD,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CACjC,CAAC,IAAI,EAAE,CAAC;KACV;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,CAAC,QAAQ,EAAE,CAAC;QAClB,MAAM,CAAC,OAAO,CACZ,+IAA+I,CAChJ,CAAC;KACH;IACD,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AAlDD,8CAkDC"} \ No newline at end of file diff --git a/src/init.ts b/src/init.ts index 6a738a090..e39c7dcd7 100644 --- a/src/init.ts +++ b/src/init.ts @@ -186,21 +186,29 @@ export async function injectWindowsTracer( export async function installPythonDeps(codeql: CodeQL, logger: Logger) { logger.startGroup("Setup Python dependencies"); - if (process.platform !== "linux") { + if (process.platform === "darwin") { logger.info( - "Currently, auto-installing python dependancies is only supported on linux" + "Currently, auto-installing python dependancies is not supported on MacOS" ); logger.endGroup(); return; } + let install_tools_script = "install_tools.sh"; + let auto_install_packages_script = "auto_install_packages.py"; + + if (process.platform === "win32") { + install_tools_script = "install_tools.ps1"; + auto_install_packages_script = "auto_install_packages_windows.py"; + } + const scriptsFolder = path.resolve(__dirname, "../python-setup"); // Setup tools on the Github hosted runners if (process.env["ImageOS"] !== undefined) { try { await new toolrunnner.ToolRunner( - path.join(scriptsFolder, "install_tools.sh") + path.join(scriptsFolder, install_tools_script) ).exec(); } catch (e) { // This script tries to install some needed tools in the runner. It should not fail, but if it does @@ -215,7 +223,7 @@ export async function installPythonDeps(codeql: CodeQL, logger: Logger) { // Install dependencies try { await new toolrunnner.ToolRunner( - path.join(scriptsFolder, "auto_install_packages.py"), + path.join(scriptsFolder, auto_install_packages_script), [path.dirname(codeql.getPath())] ).exec(); } catch (e) {