Skip to content

Commit a8da2a6

Browse files
committed
Use /opt/hostedtoolcache as default value AGENT_TOOLSDIRECTORY
1 parent ffcd000 commit a8da2a6

File tree

2 files changed

+133
-9
lines changed

2 files changed

+133
-9
lines changed

dist/setup/index.js

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5225,10 +5225,137 @@ class ToolRunner extends events.EventEmitter {
52255225
return (this._endsWith(upperToolPath, '.CMD') ||
52265226
this._endsWith(upperToolPath, '.BAT'));
52275227
}
5228+
<<<<<<< HEAD
52285229
_windowsQuoteCmdArg(arg) {
52295230
// for .exe, apply the normal quoting rules that libuv applies
52305231
if (!this._isCmdFile()) {
52315232
return this._uvQuoteCmdArg(arg);
5233+
=======
5234+
5235+
const sameDirectionIncreasing =
5236+
(this.operator === '>=' || this.operator === '>') &&
5237+
(comp.operator === '>=' || comp.operator === '>')
5238+
const sameDirectionDecreasing =
5239+
(this.operator === '<=' || this.operator === '<') &&
5240+
(comp.operator === '<=' || comp.operator === '<')
5241+
const sameSemVer = this.semver.version === comp.semver.version
5242+
const differentDirectionsInclusive =
5243+
(this.operator === '>=' || this.operator === '<=') &&
5244+
(comp.operator === '>=' || comp.operator === '<=')
5245+
const oppositeDirectionsLessThan =
5246+
cmp(this.semver, '<', comp.semver, options) &&
5247+
(this.operator === '>=' || this.operator === '>') &&
5248+
(comp.operator === '<=' || comp.operator === '<')
5249+
const oppositeDirectionsGreaterThan =
5250+
cmp(this.semver, '>', comp.semver, options) &&
5251+
(this.operator === '<=' || this.operator === '<') &&
5252+
(comp.operator === '>=' || comp.operator === '>')
5253+
5254+
return (
5255+
sameDirectionIncreasing ||
5256+
sameDirectionDecreasing ||
5257+
(sameSemVer && differentDirectionsInclusive) ||
5258+
oppositeDirectionsLessThan ||
5259+
oppositeDirectionsGreaterThan
5260+
)
5261+
}
5262+
}
5263+
5264+
module.exports = Comparator
5265+
5266+
const {re, t} = __webpack_require__(328)
5267+
const cmp = __webpack_require__(752)
5268+
const debug = __webpack_require__(548)
5269+
const SemVer = __webpack_require__(206)
5270+
const Range = __webpack_require__(124)
5271+
5272+
5273+
/***/ }),
5274+
/* 175 */
5275+
/***/ (function(__unusedmodule, exports, __webpack_require__) {
5276+
5277+
"use strict";
5278+
5279+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5280+
if (k2 === undefined) k2 = k;
5281+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5282+
}) : (function(o, m, k, k2) {
5283+
if (k2 === undefined) k2 = k;
5284+
o[k2] = m[k];
5285+
}));
5286+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
5287+
Object.defineProperty(o, "default", { enumerable: true, value: v });
5288+
}) : function(o, v) {
5289+
o["default"] = v;
5290+
});
5291+
var __importStar = (this && this.__importStar) || function (mod) {
5292+
if (mod && mod.__esModule) return mod;
5293+
var result = {};
5294+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
5295+
__setModuleDefault(result, mod);
5296+
return result;
5297+
};
5298+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5299+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5300+
return new (P || (P = Promise))(function (resolve, reject) {
5301+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5302+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5303+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
5304+
step((generator = generator.apply(thisArg, _arguments || [])).next());
5305+
});
5306+
};
5307+
Object.defineProperty(exports, "__esModule", { value: true });
5308+
const core = __importStar(__webpack_require__(470));
5309+
const finder = __importStar(__webpack_require__(927));
5310+
const finderPyPy = __importStar(__webpack_require__(847));
5311+
const path = __importStar(__webpack_require__(622));
5312+
const os = __importStar(__webpack_require__(87));
5313+
const cache_factory_1 = __webpack_require__(633);
5314+
const utils_1 = __webpack_require__(163);
5315+
function isPyPyVersion(versionSpec) {
5316+
return versionSpec.startsWith('pypy-');
5317+
}
5318+
function cacheDependencies(cache, pythonVersion) {
5319+
return __awaiter(this, void 0, void 0, function* () {
5320+
const cacheDependencyPath = core.getInput('cache-dependency-path') || undefined;
5321+
const cacheDistributor = cache_factory_1.getCacheDistributor(cache, pythonVersion, cacheDependencyPath);
5322+
yield cacheDistributor.restoreCache();
5323+
});
5324+
}
5325+
function run() {
5326+
var _a;
5327+
return __awaiter(this, void 0, void 0, function* () {
5328+
if (!((_a = process.env.AGENT_TOOLSDIRECTORY) === null || _a === void 0 ? void 0 : _a.trim())) {
5329+
process.env['AGENT_TOOLSDIRECTORY'] = '/opt/hostedtoolcache';
5330+
}
5331+
core.debug(`Python is expected to be installed into AGENT_TOOLSDIRECTORY=${process.env['AGENT_TOOLSDIRECTORY']}`);
5332+
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
5333+
try {
5334+
const version = core.getInput('python-version');
5335+
if (version) {
5336+
let pythonVersion;
5337+
const arch = core.getInput('architecture') || os.arch();
5338+
if (isPyPyVersion(version)) {
5339+
const installed = yield finderPyPy.findPyPyVersion(version, arch);
5340+
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`;
5341+
core.info(`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`);
5342+
}
5343+
else {
5344+
const installed = yield finder.useCpythonVersion(version, arch);
5345+
pythonVersion = installed.version;
5346+
core.info(`Successfully setup ${installed.impl} (${pythonVersion})`);
5347+
}
5348+
const cache = core.getInput('cache');
5349+
if (cache && utils_1.isCacheFeatureAvailable()) {
5350+
yield cacheDependencies(cache, pythonVersion);
5351+
}
5352+
}
5353+
else {
5354+
throw new Error("there's empty python-version input");
5355+
}
5356+
const matchersPath = path.join(__dirname, '../..', '.github');
5357+
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
5358+
>>>>>>> 99015f8 (Use /opt/hostedtoolcache as default value AGENT_TOOLSDIRECTORY)
52325359
}
52335360
// otherwise apply quoting rules specific to the cmd.exe command line parser.
52345361
// the libuv rules are generic and are not designed specifically for cmd.exe

src/setup-python.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,13 @@ function resolveVersionInput(): string {
4949
}
5050

5151
async function run() {
52-
if (process.env.AGENT_TOOLSDIRECTORY?.trim()) {
53-
core.debug(
54-
`Python is expected to be installed into AGENT_TOOLSDIRECTORY=${process.env['AGENT_TOOLSDIRECTORY']}`
55-
);
56-
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
57-
} else {
58-
core.debug(
59-
`Python is expected to be installed into RUNNER_TOOL_CACHE==${process.env['RUNNER_TOOL_CACHE']}`
60-
);
52+
if (!process.env.AGENT_TOOLSDIRECTORY?.trim()) {
53+
process.env['AGENT_TOOLSDIRECTORY'] = '/opt/hostedtoolcache';
6154
}
55+
core.debug(
56+
`Python is expected to be installed into AGENT_TOOLSDIRECTORY=${process.env['AGENT_TOOLSDIRECTORY']}`
57+
);
58+
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
6259
try {
6360
const version = resolveVersionInput();
6461
if (version) {

0 commit comments

Comments
 (0)