Skip to content

Commit

Permalink
Check platform before installing python tools
Browse files Browse the repository at this point in the history
  • Loading branch information
David Verdeguer committed Sep 23, 2020
1 parent 23a1a65 commit 1477345
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 24 deletions.
27 changes: 17 additions & 10 deletions lib/init.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/init.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 24 additions & 13 deletions src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,21 +185,32 @@ export async function injectWindowsTracer(
export async function installPythonDeps(codeql: CodeQL, logger: Logger) {
logger.startGroup("Setup Python dependencies");

if (process.platform !== "linux") {
logger.info(
"Currently, auto-installing python dependancies is only supported on linux"
);
logger.endGroup();
return;
}

const scriptsFolder = path.resolve(__dirname, "../python-setup");

// Setup tools
try {
await new toolrunnner.ToolRunner(
path.join(scriptsFolder, "install_tools.sh")
).exec();
} catch (e) {
// This script tries to install some needed tools in the runner. It should not fail, but if it does
// we just abort the process without failing the action
logger.endGroup();
throw new Error(
"Unable to download and extract the scripts needed for installing the python dependecies"
);
// Setup tools on the Github hosted runners
if (process.env["ImageOS"] !== undefined) {
try {
await new toolrunnner.ToolRunner(
path.join(scriptsFolder, "install_tools.sh")
).exec();
} catch (e) {
// This script tries to install some needed tools in the runner. It should not fail, but if it does
// we just abort the process without failing the action
logger.endGroup();
logger.warning(
"Unable to download and extract the tools needed for installing the python dependecies"
);
}
}

// Install dependencies
try {
await new toolrunnner.ToolRunner(
Expand All @@ -208,7 +219,7 @@ export async function installPythonDeps(codeql: CodeQL, logger: Logger) {
).exec();
} catch (e) {
logger.endGroup();
throw new Error("We were unable to install your python dependencies.");
logger.warning("We were unable to install your python dependencies.");
}
logger.endGroup();
}

0 comments on commit 1477345

Please sign in to comment.