Skip to content

Commit

Permalink
symlink graalpy binaries names
Browse files Browse the repository at this point in the history
  • Loading branch information
timfel committed Jul 1, 2023
1 parent 3e285fe commit 2c87a2d
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
14 changes: 14 additions & 0 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67369,6 +67369,7 @@ function installGraalPy(graalpyVersion, architecture, allowPreReleases, releases
installDir = yield tc.cacheDir(toolDir, 'GraalPy', resolvedGraalPyVersion, architecture);
}
const binaryPath = getGraalPyBinaryPath(installDir);
yield createGraalPySymlink(binaryPath, resolvedGraalPyVersion);
yield installPip(binaryPath);
return { installDir, resolvedGraalPyVersion };
}
Expand Down Expand Up @@ -67403,6 +67404,19 @@ function getAvailableGraalPyVersions() {
});
}
exports.getAvailableGraalPyVersions = getAvailableGraalPyVersions;
function createGraalPySymlink(graalpyBinaryPath, graalpyVersion) {
return __awaiter(this, void 0, void 0, function* () {
const version = semver.coerce(graalpyVersion);
const pythonBinaryPostfix = semver.major(version);
const pythonMinor = semver.minor(version);
const graalpyMajorMinorBinaryPostfix = `${pythonBinaryPostfix}.${pythonMinor}`;
const binaryExtension = utils_1.IS_WINDOWS ? '.exe' : '';
core.info('Creating symlinks...');
utils_1.createSymlinkInFolder(graalpyBinaryPath, `graalpy${binaryExtension}`, `python${pythonBinaryPostfix}${binaryExtension}`, true);
utils_1.createSymlinkInFolder(graalpyBinaryPath, `graalpy${binaryExtension}`, `python${binaryExtension}`, true);
utils_1.createSymlinkInFolder(graalpyBinaryPath, `graalpy${binaryExtension}`, `graalpy${graalpyMajorMinorBinaryPostfix}${binaryExtension}`, true);
});
}
function installPip(pythonLocation) {
return __awaiter(this, void 0, void 0, function* () {
core.info('Installing and updating pip');
Expand Down
35 changes: 35 additions & 0 deletions src/install-graalpy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
IS_WINDOWS,
IGraalPyManifestAsset,
IGraalPyManifestRelease,
createSymlinkInFolder,
isNightlyKeyword
} from './utils';

Expand Down Expand Up @@ -74,6 +75,7 @@ export async function installGraalPy(
}

const binaryPath = getGraalPyBinaryPath(installDir);
await createGraalPySymlink(binaryPath, resolvedGraalPyVersion);
await installPip(binaryPath);

return {installDir, resolvedGraalPyVersion};
Expand Down Expand Up @@ -112,6 +114,39 @@ export async function getAvailableGraalPyVersions() {
return response.result;
}

async function createGraalPySymlink(
graalpyBinaryPath: string,
graalpyVersion: string
) {
const version = semver.coerce(graalpyVersion)!;
const pythonBinaryPostfix = semver.major(version);
const pythonMinor = semver.minor(version);
const graalpyMajorMinorBinaryPostfix = `${pythonBinaryPostfix}.${pythonMinor}`;
const binaryExtension = IS_WINDOWS ? '.exe' : '';

core.info('Creating symlinks...');
createSymlinkInFolder(
graalpyBinaryPath,
`graalpy${binaryExtension}`,
`python${pythonBinaryPostfix}${binaryExtension}`,
true
);

createSymlinkInFolder(
graalpyBinaryPath,
`graalpy${binaryExtension}`,
`python${binaryExtension}`,
true
);

createSymlinkInFolder(
graalpyBinaryPath,
`graalpy${binaryExtension}`,
`graalpy${graalpyMajorMinorBinaryPostfix}${binaryExtension}`,
true
);
}

async function installPip(pythonLocation: string) {
core.info('Installing and updating pip');
const pythonBinary = path.join(pythonLocation, 'python');
Expand Down

0 comments on commit 2c87a2d

Please sign in to comment.