Respect UV_NO_MODIFY_PATH (#603)
Some checks failed
CodeQL / Analyze (TypeScript) (push) Failing after 2s
Release Drafter / ✏️ Draft release (push) Has been cancelled

Fixes: #519
This commit is contained in:
Kevin Stillhammer
2025-10-02 17:54:15 +02:00
committed by GitHub
parent f9c6974d8b
commit f2859da213
7 changed files with 96 additions and 12 deletions

19
dist/save-cache/index.js generated vendored
View File

@@ -90019,6 +90019,7 @@ const cache = __importStar(__nccwpck_require__(5116));
const core = __importStar(__nccwpck_require__(7484));
const exec = __importStar(__nccwpck_require__(5236));
const restore_cache_1 = __nccwpck_require__(5391);
const constants_1 = __nccwpck_require__(6156);
const inputs_1 = __nccwpck_require__(9612);
async function run() {
try {
@@ -90086,11 +90087,27 @@ async function pruneCache() {
};
const execArgs = ["cache", "prune", "--ci"];
core.info("Pruning cache...");
await exec.exec("uv", execArgs, options);
const uvPath = core.getState(constants_1.STATE_UV_PATH);
await exec.exec(uvPath, execArgs, options);
}
run();
/***/ }),
/***/ 6156:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.STATE_UV_PATH = exports.TOOL_CACHE_NAME = exports.OWNER = exports.REPO = void 0;
exports.REPO = "uv";
exports.OWNER = "astral-sh";
exports.TOOL_CACHE_NAME = "uv";
exports.STATE_UV_PATH = "uv-path";
/***/ }),
/***/ 9612:

30
dist/setup/index.js generated vendored
View File

@@ -129387,6 +129387,7 @@ const core = __importStar(__nccwpck_require__(37484));
const exec = __importStar(__nccwpck_require__(95236));
const restore_cache_1 = __nccwpck_require__(95391);
const download_version_1 = __nccwpck_require__(28255);
const constants_1 = __nccwpck_require__(56156);
const inputs_1 = __nccwpck_require__(9612);
const platforms_1 = __nccwpck_require__(98361);
const resolve_1 = __nccwpck_require__(36772);
@@ -129473,18 +129474,33 @@ async function determineVersion(manifestFile) {
}
function addUvToPathAndOutput(cachedPath) {
core.setOutput("uv-path", `${cachedPath}${path.sep}uv`);
core.saveState(constants_1.STATE_UV_PATH, `${cachedPath}${path.sep}uv`);
core.setOutput("uvx-path", `${cachedPath}${path.sep}uvx`);
core.addPath(cachedPath);
core.info(`Added ${cachedPath} to the path`);
if (process.env.UV_NO_MODIFY_PATH !== undefined) {
core.info("UV_NO_MODIFY_PATH is set, not modifying PATH");
}
else {
core.addPath(cachedPath);
core.info(`Added ${cachedPath} to the path`);
}
}
function addToolBinToPath() {
if (inputs_1.toolBinDir !== undefined) {
core.exportVariable("UV_TOOL_BIN_DIR", inputs_1.toolBinDir);
core.info(`Set UV_TOOL_BIN_DIR to ${inputs_1.toolBinDir}`);
core.addPath(inputs_1.toolBinDir);
core.info(`Added ${inputs_1.toolBinDir} to the path`);
if (process.env.UV_NO_MODIFY_PATH !== undefined) {
core.info(`UV_NO_MODIFY_PATH is set, not adding ${inputs_1.toolBinDir} to path`);
}
else {
core.addPath(inputs_1.toolBinDir);
core.info(`Added ${inputs_1.toolBinDir} to the path`);
}
}
else {
if (process.env.UV_NO_MODIFY_PATH !== undefined) {
core.info("UV_NO_MODIFY_PATH is set, not adding user local bin to path");
return;
}
if (process.env.XDG_BIN_HOME !== undefined) {
core.addPath(process.env.XDG_BIN_HOME);
core.info(`Added ${process.env.XDG_BIN_HOME} to the path`);
@@ -129513,6 +129529,9 @@ function setupPython() {
}
async function activateEnvironment() {
if (inputs_1.activateEnvironment) {
if (process.env.UV_NO_MODIFY_PATH !== undefined) {
throw new Error("UV_NO_MODIFY_PATH and activate-environment cannot be used together.");
}
const execArgs = ["venv", ".venv", "--directory", inputs_1.workingDirectory];
core.info("Activating python venv...");
await exec.exec("uv", execArgs);
@@ -129545,10 +129564,11 @@ run();
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.TOOL_CACHE_NAME = exports.OWNER = exports.REPO = void 0;
exports.STATE_UV_PATH = exports.TOOL_CACHE_NAME = exports.OWNER = exports.REPO = void 0;
exports.REPO = "uv";
exports.OWNER = "astral-sh";
exports.TOOL_CACHE_NAME = "uv";
exports.STATE_UV_PATH = "uv-path";
/***/ }),

View File

@@ -65748,10 +65748,11 @@ run();
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.TOOL_CACHE_NAME = exports.OWNER = exports.REPO = void 0;
exports.STATE_UV_PATH = exports.TOOL_CACHE_NAME = exports.OWNER = exports.REPO = void 0;
exports.REPO = "uv";
exports.OWNER = "astral-sh";
exports.TOOL_CACHE_NAME = "uv";
exports.STATE_UV_PATH = "uv-path";
/***/ }),