Append python Scripts directory to PATH env on windows

(cherry picked from commit fe54a2ec0fe983ccec3656b366272e7426855477)

Co-authored-by: Marek Roszko <mark.roszko@gmail.com>
This commit is contained in:
Mark Roszko 2025-06-06 03:13:18 +00:00
parent f48b1758e5
commit 10413f778c
2 changed files with 14 additions and 1 deletions

View File

@ -136,7 +136,7 @@ wxString PATHS::GetDefault3rdPartyPath()
tmp.AppendDir( wxT( "3rdparty" ) );
return tmp.GetPath();
return tmp.GetAbsolutePath();
}

View File

@ -249,6 +249,19 @@ bool SCRIPTING::scriptingSetup()
// Now initialize Python Home via capi
Py_SetPythonHome( pyHome.GetFullPath().c_str() );
}
// Allow executing the python pip installed scripts on windows easily
wxString envPath;
if( wxGetEnv( wxT( "PATH" ), &envPath ) )
{
wxFileName pythonThirdPartyBin( PATHS::GetDefault3rdPartyPath() );
pythonThirdPartyBin.AppendDir( wxString::Format( wxT( "Python%d%d" ), PY_MAJOR_VERSION, PY_MINOR_VERSION ) );
pythonThirdPartyBin.AppendDir( wxT( "Scripts" ) );
envPath = pythonThirdPartyBin.GetAbsolutePath() + ";" + envPath;
wxSetEnv( wxT( "PATH" ), envPath );
}
#else
// Intended for msys2 but we could probably use the msvc equivalent code too
// If our python.exe (in kicad/bin) exists, force our kicad python environment