Skip to content
Merged
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
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pioarduino-node-helpers",
"version": "12.1.1",
"version": "12.1.2",
"description": "Collection of Node.JS helpers for PlatformIO fork pioarduino",
"main": "dist/index.js",
"engines": {
Expand Down
21 changes: 20 additions & 1 deletion src/installer/get-python.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,18 @@ async function isUVAvailable() {
}
}

/**
* Get UV executable path after installation
* On Windows, UV is installed to %USERPROFILE%\.local\bin
* On Unix/Linux/macOS, UV is installed to ~/.local/bin
* @returns {string} Full path to UV executable
*/
function getUVExecutablePath() {
const homeDir = process.env.USERPROFILE || process.env.HOME;
const uvExe = proc.IS_WINDOWS ? 'uv.exe' : 'uv';
return path.join(homeDir, '.local', 'bin', uvExe);
}

/**
* Install UV package manager using official installation scripts
* Downloads and runs platform-specific installer from astral.sh
Expand Down Expand Up @@ -183,8 +195,15 @@ async function installPythonWithUV(destinationDir, pythonVersion = '3.13') {
log('info', `Creating Python ${pythonVersion} venv using UV`);

// Ensure UV is available, install if necessary
let uvCommand = 'uv';
if (!(await isUVAvailable())) {
await installUV();
// On Windows, UV might not be in PATH immediately after installation
// Use direct path to UV executable
if (proc.IS_WINDOWS) {
uvCommand = getUVExecutablePath();
log('info', `Using UV from: ${uvCommand}`);
}
}

// Clean up any existing installation to avoid conflicts
Expand All @@ -200,7 +219,7 @@ async function installPythonWithUV(destinationDir, pythonVersion = '3.13') {

// Use --python-preference managed to allow UV to download Python if not found on system
await execFile(
'uv',
uvCommand,
[
'venv',
absolutePath,
Expand Down