mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-10-19 00:56:43 +00:00
committed by
GitHub
parent
bd1f875aba
commit
d18bcc753a
40
dist/setup/index.js
generated
vendored
40
dist/setup/index.js
generated
vendored
@@ -125153,7 +125153,7 @@ async function restoreCache() {
|
||||
core.info(`Trying to restore uv cache from GitHub Actions cache with key: ${cacheKey}`);
|
||||
const cachePaths = [inputs_1.cacheLocalPath];
|
||||
if (inputs_1.cachePython) {
|
||||
cachePaths.push(await (0, inputs_1.getUvPythonDir)());
|
||||
cachePaths.push(inputs_1.pythonDir);
|
||||
}
|
||||
try {
|
||||
matchedKey = await cache.restoreCache(cachePaths, cacheKey);
|
||||
@@ -129538,6 +129538,7 @@ async function run() {
|
||||
addToolBinToPath();
|
||||
addUvToPathAndOutput(setupResult.uvDir);
|
||||
setToolDir();
|
||||
addPythonDirToPath();
|
||||
setupPython();
|
||||
await activateEnvironment();
|
||||
addMatchers();
|
||||
@@ -129647,6 +129648,17 @@ function setToolDir() {
|
||||
core.info(`Set UV_TOOL_DIR to ${inputs_1.toolDir}`);
|
||||
}
|
||||
}
|
||||
function addPythonDirToPath() {
|
||||
core.exportVariable("UV_PYTHON_INSTALL_DIR", inputs_1.pythonDir);
|
||||
core.info(`Set UV_PYTHON_INSTALL_DIR to ${inputs_1.pythonDir}`);
|
||||
if (process.env.UV_NO_MODIFY_PATH !== undefined) {
|
||||
core.info("UV_NO_MODIFY_PATH is set, not adding python dir to path");
|
||||
}
|
||||
else {
|
||||
core.addPath(inputs_1.pythonDir);
|
||||
core.info(`Added ${inputs_1.pythonDir} to the path`);
|
||||
}
|
||||
}
|
||||
function setupPython() {
|
||||
if (inputs_1.pythonVersion !== "") {
|
||||
core.exportVariable("UV_PYTHON", inputs_1.pythonVersion);
|
||||
@@ -129841,11 +129853,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.addProblemMatchers = exports.manifestFile = exports.githubToken = exports.toolDir = exports.toolBinDir = exports.ignoreEmptyWorkdir = exports.ignoreNothingToCache = exports.cachePython = exports.pruneCache = exports.cacheDependencyGlob = exports.cacheLocalPath = exports.cacheSuffix = exports.saveCache = exports.restoreCache = exports.enableCache = exports.checkSum = exports.activateEnvironment = exports.pythonVersion = exports.versionFile = exports.version = exports.workingDirectory = void 0;
|
||||
exports.addProblemMatchers = exports.manifestFile = exports.githubToken = exports.pythonDir = exports.toolDir = exports.toolBinDir = exports.ignoreEmptyWorkdir = exports.ignoreNothingToCache = exports.cachePython = exports.pruneCache = exports.cacheDependencyGlob = exports.cacheLocalPath = exports.cacheSuffix = exports.saveCache = exports.restoreCache = exports.enableCache = exports.checkSum = exports.activateEnvironment = exports.pythonVersion = exports.versionFile = exports.version = exports.workingDirectory = void 0;
|
||||
exports.getUvPythonDir = getUvPythonDir;
|
||||
const node_path_1 = __importDefault(__nccwpck_require__(76760));
|
||||
const core = __importStar(__nccwpck_require__(37484));
|
||||
const exec = __importStar(__nccwpck_require__(95236));
|
||||
const config_file_1 = __nccwpck_require__(27846);
|
||||
exports.workingDirectory = core.getInput("working-directory");
|
||||
exports.version = core.getInput("version");
|
||||
@@ -129865,6 +129876,7 @@ exports.ignoreNothingToCache = core.getInput("ignore-nothing-to-cache") === "tru
|
||||
exports.ignoreEmptyWorkdir = core.getInput("ignore-empty-workdir") === "true";
|
||||
exports.toolBinDir = getToolBinDir();
|
||||
exports.toolDir = getToolDir();
|
||||
exports.pythonDir = getUvPythonDir();
|
||||
exports.githubToken = core.getInput("github-token");
|
||||
exports.manifestFile = getManifestFile();
|
||||
exports.addProblemMatchers = core.getInput("add-problem-matchers") === "true";
|
||||
@@ -129954,19 +129966,23 @@ function getCacheDirFromConfig() {
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
async function getUvPythonDir() {
|
||||
function getUvPythonDir() {
|
||||
if (process.env.UV_PYTHON_INSTALL_DIR !== undefined) {
|
||||
core.info(`Using UV_PYTHON_INSTALL_DIR from environment: ${process.env.UV_PYTHON_INSTALL_DIR}`);
|
||||
core.info(`UV_PYTHON_INSTALL_DIR is already set to ${process.env.UV_PYTHON_INSTALL_DIR}`);
|
||||
return process.env.UV_PYTHON_INSTALL_DIR;
|
||||
}
|
||||
core.info("Determining uv python dir using `uv python dir`...");
|
||||
const result = await exec.getExecOutput("uv", ["python", "dir"]);
|
||||
if (result.exitCode !== 0) {
|
||||
throw new Error(`Failed to get uv python dir: ${result.stderr || result.stdout}`);
|
||||
if (process.env.RUNNER_ENVIRONMENT !== "github-hosted") {
|
||||
if (process.platform === "win32") {
|
||||
return `${process.env.APPDATA}${node_path_1.default.sep}uv${node_path_1.default.sep}python`;
|
||||
}
|
||||
else {
|
||||
return `${process.env.HOME}${node_path_1.default.sep}.local${node_path_1.default.sep}share${node_path_1.default.sep}uv${node_path_1.default.sep}python`;
|
||||
}
|
||||
}
|
||||
const dir = result.stdout.trim();
|
||||
core.info(`Determined uv python dir: ${dir}`);
|
||||
return dir;
|
||||
if (process.env.RUNNER_TEMP !== undefined) {
|
||||
return `${process.env.RUNNER_TEMP}${node_path_1.default.sep}uv-python-dir`;
|
||||
}
|
||||
throw Error("Could not determine UV_PYTHON_INSTALL_DIR. Please make sure RUNNER_TEMP is set or provide the UV_PYTHON_INSTALL_DIR environment variable");
|
||||
}
|
||||
function getCacheDependencyGlob() {
|
||||
const cacheDependencyGlobInput = core.getInput("cache-dependency-glob");
|
||||
|
Reference in New Issue
Block a user