Skip to content

Commit 1477345

Browse files
committed
Check platform before installing python tools
1 parent 23a1a65 commit 1477345

3 files changed

Lines changed: 42 additions & 24 deletions

File tree

lib/init.js

Lines changed: 17 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/init.ts

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -185,21 +185,32 @@ export async function injectWindowsTracer(
185185
export async function installPythonDeps(codeql: CodeQL, logger: Logger) {
186186
logger.startGroup("Setup Python dependencies");
187187

188+
if (process.platform !== "linux") {
189+
logger.info(
190+
"Currently, auto-installing python dependancies is only supported on linux"
191+
);
192+
logger.endGroup();
193+
return;
194+
}
195+
188196
const scriptsFolder = path.resolve(__dirname, "../python-setup");
189197

190-
// Setup tools
191-
try {
192-
await new toolrunnner.ToolRunner(
193-
path.join(scriptsFolder, "install_tools.sh")
194-
).exec();
195-
} catch (e) {
196-
// This script tries to install some needed tools in the runner. It should not fail, but if it does
197-
// we just abort the process without failing the action
198-
logger.endGroup();
199-
throw new Error(
200-
"Unable to download and extract the scripts needed for installing the python dependecies"
201-
);
198+
// Setup tools on the Github hosted runners
199+
if (process.env["ImageOS"] !== undefined) {
200+
try {
201+
await new toolrunnner.ToolRunner(
202+
path.join(scriptsFolder, "install_tools.sh")
203+
).exec();
204+
} catch (e) {
205+
// This script tries to install some needed tools in the runner. It should not fail, but if it does
206+
// we just abort the process without failing the action
207+
logger.endGroup();
208+
logger.warning(
209+
"Unable to download and extract the tools needed for installing the python dependecies"
210+
);
211+
}
202212
}
213+
203214
// Install dependencies
204215
try {
205216
await new toolrunnner.ToolRunner(
@@ -208,7 +219,7 @@ export async function installPythonDeps(codeql: CodeQL, logger: Logger) {
208219
).exec();
209220
} catch (e) {
210221
logger.endGroup();
211-
throw new Error("We were unable to install your python dependencies.");
222+
logger.warning("We were unable to install your python dependencies.");
212223
}
213224
logger.endGroup();
214225
}

0 commit comments

Comments
 (0)