mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 07:04:32 +02:00
tools: installer: use bundled idf_tools when installing IDF 3.3.1, 4.0
This is a workaround for the 'no-site-packages' bug in the version of
idf_tools.py shipped in v4.0 and v3.3.1 (see 7a18f02ac
).
When installing IDF v4.0 and v3.3.1, the installer will use the
bundled version of idf_tools.py instead of the version which comes
with IDF.
This commit is contained in:
@@ -190,27 +190,52 @@ end;
|
|||||||
|
|
||||||
{ ------------------------------ IDF Tools setup, Python environment setup ------------------------------ }
|
{ ------------------------------ IDF Tools setup, Python environment setup ------------------------------ }
|
||||||
|
|
||||||
|
function UseBundledIDFToolsPy(Version: String) : Boolean;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
{ Use bundled copy of idf_tools.py, as the copy shipped with these IDF versions can not work due to
|
||||||
|
the --no-site-packages bug.
|
||||||
|
}
|
||||||
|
if (Version = 'v4.0') or (Version = 'v3.3.1') then
|
||||||
|
begin
|
||||||
|
Log('UseBundledIDFToolsPy: version=' + Version + ', using bundled idf_tools.py');
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure IDFToolsSetup();
|
procedure IDFToolsSetup();
|
||||||
var
|
var
|
||||||
CmdLine: String;
|
CmdLine: String;
|
||||||
IDFPath: String;
|
IDFPath: String;
|
||||||
IDFToolsPyPath: String;
|
IDFToolsPyPath: String;
|
||||||
IDFToolsPyCmd: String;
|
IDFToolsPyCmd: String;
|
||||||
|
BundledIDFToolsPyPath: String;
|
||||||
|
JSONArg: String;
|
||||||
begin
|
begin
|
||||||
IDFPath := GetIDFPath('');
|
IDFPath := GetIDFPath('');
|
||||||
IDFToolsPyPath := IDFPath + '\tools\idf_tools.py';
|
IDFToolsPyPath := IDFPath + '\tools\idf_tools.py';
|
||||||
|
BundledIDFToolsPyPath := ExpandConstant('{app}\idf_tools_fallback.py');
|
||||||
|
JSONArg := '';
|
||||||
|
|
||||||
if FileExists(IDFToolsPyPath) then
|
if FileExists(IDFToolsPyPath) then
|
||||||
begin
|
begin
|
||||||
Log('idf_tools.py exists in IDF directory');
|
Log('idf_tools.py exists in IDF directory');
|
||||||
IDFToolsPyCmd := PythonExecutablePath + ' ' + IDFToolsPyPath;
|
if UseBundledIDFToolsPy(IDFDownloadVersion) then
|
||||||
|
begin
|
||||||
|
Log('Using the bundled idf_tools.py copy');
|
||||||
|
IDFToolsPyCmd := BundledIDFToolsPyPath;
|
||||||
|
end else begin
|
||||||
|
IDFToolsPyCmd := IDFToolsPyPath;
|
||||||
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
Log('idf_tools.py does not exist in IDF directory, using a fallback version');
|
Log('idf_tools.py does not exist in IDF directory, using a fallback version');
|
||||||
IDFToolsPyCmd := ExpandConstant(PythonExecutablePath
|
IDFToolsPyCmd := BundledIDFToolsPyPath;
|
||||||
+ ' "{app}\idf_tools_fallback.py"'
|
JSONArg := ExpandConstant('--tools "{app}\tools_fallback.json"');
|
||||||
+ ' --idf-path ' + IDFPath
|
|
||||||
+ ' --tools "{app}\tools_fallback.json"');
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ IDFPath not quoted, as it can not contain spaces }
|
||||||
|
IDFToolsPyCmd := PythonExecutablePath + ' "' + IDFToolsPyCmd + '" --idf-path ' + IDFPath + JSONArg;
|
||||||
|
|
||||||
Log('idf_tools.py command: ' + IDFToolsPyCmd);
|
Log('idf_tools.py command: ' + IDFToolsPyCmd);
|
||||||
CmdLine := IDFToolsPyCmd + ' install';
|
CmdLine := IDFToolsPyCmd + ' install';
|
||||||
Log('Installing tools:' + CmdLine);
|
Log('Installing tools:' + CmdLine);
|
||||||
|
Reference in New Issue
Block a user