Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/install-python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as core from '@actions/core';
import * as tc from '@actions/tool-cache';
import * as exec from '@actions/exec';
import {ExecOptions} from '@actions/exec/lib/interfaces';
import {IS_WINDOWS, IS_LINUX} from './utils';
import {IS_WINDOWS, IS_LINUX, IS_MAC, getMacOSBrewPath} from './utils';

const TOKEN = core.getInput('token');
const AUTH = !TOKEN ? undefined : `token ${TOKEN}`;
Expand Down Expand Up @@ -44,11 +44,13 @@ export function getManifest(): Promise<tc.IToolRelease[]> {
}

async function installPython(workingDirectory: string) {
const brewPath = await getMacOSBrewPath();
const options: ExecOptions = {
cwd: workingDirectory,
env: {
...process.env,
...(IS_LINUX && {LD_LIBRARY_PATH: path.join(workingDirectory, 'lib')})
...(IS_MAC && {LD_LIBRARY_PATH: path.join(brewPath, 'lib')})
},
silent: true,
listeners: {
Expand Down
10 changes: 10 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,16 @@ async function getMacOSInfo() {
return {osName: 'macOS', osVersion: macOSVersion};
}

export async function getMacOSBrewPath() {
const {stdout} = await exec.getExecOutput('brew', ['--prefix'], {
silent: true
});

const brewPath = stdout.trim();

return {brewPath: brewPath};
}

export async function getLinuxInfo() {
const {stdout} = await exec.getExecOutput('lsb_release', ['-i', '-r', '-s'], {
silent: true
Expand Down