mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 12:14:32 +02:00
Merge branch 'bugfix/tools_installer_fixes' into 'master'
tools: fixes for idf_tools.py and Windows tools installer Closes IDFGH-1545 and IDFGH-1544 See merge request espressif/esp-idf!5595
This commit is contained in:
@@ -10,10 +10,13 @@ set IDF_PATH=%IDF_PATH:~0,-1%
|
|||||||
|
|
||||||
echo Installing ESP-IDF tools
|
echo Installing ESP-IDF tools
|
||||||
python.exe %IDF_PATH%\tools\idf_tools.py install
|
python.exe %IDF_PATH%\tools\idf_tools.py install
|
||||||
|
if %errorlevel% neq 0 goto :end
|
||||||
|
|
||||||
echo Setting up Python environment
|
echo Setting up Python environment
|
||||||
python.exe %IDF_PATH%\tools\idf_tools.py install-python-env
|
python.exe %IDF_PATH%\tools\idf_tools.py install-python-env
|
||||||
|
if %errorlevel% neq 0 goto :end
|
||||||
|
|
||||||
echo All done! You can now run:
|
echo All done! You can now run:
|
||||||
echo export.bat
|
echo export.bat
|
||||||
:: Clean up
|
|
||||||
|
:end
|
||||||
|
@@ -441,6 +441,9 @@ class IDFTool(object):
|
|||||||
def get_install_type(self):
|
def get_install_type(self):
|
||||||
return self._current_options.install
|
return self._current_options.install
|
||||||
|
|
||||||
|
def compatible_with_platform(self):
|
||||||
|
return any([v.compatible_with_platform() for v in self.versions.values()])
|
||||||
|
|
||||||
def get_recommended_version(self):
|
def get_recommended_version(self):
|
||||||
recommended_versions = [k for k, v in self.versions.items()
|
recommended_versions = [k for k, v in self.versions.items()
|
||||||
if v.status == IDFToolVersion.STATUS_RECOMMENDED
|
if v.status == IDFToolVersion.STATUS_RECOMMENDED
|
||||||
@@ -1030,6 +1033,9 @@ def action_install(args):
|
|||||||
fatal('unknown tool name: {}'.format(tool_name))
|
fatal('unknown tool name: {}'.format(tool_name))
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
tool_obj = tools_info[tool_name]
|
tool_obj = tools_info[tool_name]
|
||||||
|
if not tool_obj.compatible_with_platform():
|
||||||
|
fatal('tool {} does not have versions compatible with platform {}'.format(tool_name, CURRENT_PLATFORM))
|
||||||
|
raise SystemExit(1)
|
||||||
if tool_version is not None and tool_version not in tool_obj.versions:
|
if tool_version is not None and tool_version not in tool_obj.versions:
|
||||||
fatal('unknown version for tool {}: {}'.format(tool_name, tool_version))
|
fatal('unknown version for tool {}: {}'.format(tool_name, tool_version))
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
@@ -69,6 +69,15 @@
|
|||||||
"install": "always",
|
"install": "always",
|
||||||
"license": "GPL-2.0-or-later",
|
"license": "GPL-2.0-or-later",
|
||||||
"name": "esp32ulp-elf",
|
"name": "esp32ulp-elf",
|
||||||
|
"platform_overrides": [
|
||||||
|
{
|
||||||
|
"install": "on_request",
|
||||||
|
"platforms": [
|
||||||
|
"linux-armel",
|
||||||
|
"linux-i686"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"version_cmd": [
|
"version_cmd": [
|
||||||
"esp32ulp-elf-as",
|
"esp32ulp-elf-as",
|
||||||
"--version"
|
"--version"
|
||||||
@@ -182,6 +191,15 @@
|
|||||||
"install": "always",
|
"install": "always",
|
||||||
"license": "GPL-2.0-only",
|
"license": "GPL-2.0-only",
|
||||||
"name": "openocd-esp32",
|
"name": "openocd-esp32",
|
||||||
|
"platform_overrides": [
|
||||||
|
{
|
||||||
|
"install": "on_request",
|
||||||
|
"platforms": [
|
||||||
|
"linux-armel",
|
||||||
|
"linux-i686"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"version_cmd": [
|
"version_cmd": [
|
||||||
"openocd",
|
"openocd",
|
||||||
"--version"
|
"--version"
|
||||||
|
@@ -18,8 +18,8 @@ if "%~2"=="" (
|
|||||||
goto :end
|
goto :end
|
||||||
)
|
)
|
||||||
|
|
||||||
set IDF_PYTHON_DIR=%1
|
set "IDF_PYTHON_DIR=%1"
|
||||||
set IDF_GIT_DIR=%2
|
set "IDF_GIT_DIR=%2"
|
||||||
|
|
||||||
:: Strip quoutes
|
:: Strip quoutes
|
||||||
set "IDF_PYTHON_DIR=%IDF_PYTHON_DIR:"=%"
|
set "IDF_PYTHON_DIR=%IDF_PYTHON_DIR:"=%"
|
||||||
@@ -69,7 +69,7 @@ echo Adding ESP-IDF tools to PATH...
|
|||||||
:: It is possible to do this without a temporary file (running idf_tools.py from for /r command),
|
:: It is possible to do this without a temporary file (running idf_tools.py from for /r command),
|
||||||
:: but that way it is impossible to get the exit code of idf_tools.py.
|
:: but that way it is impossible to get the exit code of idf_tools.py.
|
||||||
set "IDF_TOOLS_EXPORTS_FILE=%TEMP%\idf_export_vars.tmp"
|
set "IDF_TOOLS_EXPORTS_FILE=%TEMP%\idf_export_vars.tmp"
|
||||||
python.exe %IDF_TOOLS_PY_PATH% --tools-json %IDF_TOOLS_JSON_PATH% export --format key-value >"%IDF_TOOLS_EXPORTS_FILE%"
|
python.exe "%IDF_TOOLS_PY_PATH%" --tools-json "%IDF_TOOLS_JSON_PATH%" export --format key-value >"%IDF_TOOLS_EXPORTS_FILE%"
|
||||||
if %errorlevel% neq 0 goto :end
|
if %errorlevel% neq 0 goto :end
|
||||||
|
|
||||||
for /f "usebackq tokens=1,2 eol=# delims==" %%a in ("%IDF_TOOLS_EXPORTS_FILE%") do (
|
for /f "usebackq tokens=1,2 eol=# delims==" %%a in ("%IDF_TOOLS_EXPORTS_FILE%") do (
|
||||||
|
@@ -102,6 +102,7 @@ var
|
|||||||
Page: TInputOptionWizardPage;
|
Page: TInputOptionWizardPage;
|
||||||
IDFPath: String;
|
IDFPath: String;
|
||||||
begin
|
begin
|
||||||
|
Result := False;
|
||||||
Page := TInputOptionWizardPage(Sender);
|
Page := TInputOptionWizardPage(Sender);
|
||||||
Log('OnIDFDownloadPageValidate index=' + IntToStr(Page.SelectedValueIndex));
|
Log('OnIDFDownloadPageValidate index=' + IntToStr(Page.SelectedValueIndex));
|
||||||
|
|
||||||
@@ -110,7 +111,13 @@ begin
|
|||||||
begin
|
begin
|
||||||
MsgBox('Directory already exists and is not empty:' + #13#10 +
|
MsgBox('Directory already exists and is not empty:' + #13#10 +
|
||||||
IDFPath + #13#10 + 'Please choose a different directory.', mbError, MB_OK);
|
IDFPath + #13#10 + 'Please choose a different directory.', mbError, MB_OK);
|
||||||
Result := False;
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if Pos(' ', IDFPath) <> 0 then
|
||||||
|
begin
|
||||||
|
MsgBox('ESP-IDF build system does not support spaces in paths.' + #13#10
|
||||||
|
'Please choose a different directory.', mbError, MB_OK);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -75,6 +75,13 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if Pos(' ', IDFPath) <> 0 then
|
||||||
|
begin
|
||||||
|
MsgBox('ESP-IDF build system does not support spaces in paths.' + #13#10
|
||||||
|
'Please choose a different directory.', mbError, MB_OK);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
IDFPyPath := IDFPath + '\tools\idf.py';
|
IDFPyPath := IDFPath + '\tools\idf.py';
|
||||||
if not FileExists(IDFPyPath) then
|
if not FileExists(IDFPyPath) then
|
||||||
begin
|
begin
|
||||||
|
@@ -142,7 +142,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
ExtractTemporaryFile('7za.exe')
|
ExtractTemporaryFile('7za.exe')
|
||||||
CmdLine := ExpandConstant('{tmp}\7za.exe x -o' + ExpandConstant('{tmp}') + ' -r -aoa ' + IDFZIPFileName);
|
CmdLine := ExpandConstant('{tmp}\7za.exe x -o' + ExpandConstant('{tmp}') + ' -r -aoa "' + IDFZIPFileName + '"');
|
||||||
IDFTempPath := ExpandConstant('{tmp}\esp-idf-') + IDFZIPFileVersion;
|
IDFTempPath := ExpandConstant('{tmp}\esp-idf-') + IDFZIPFileVersion;
|
||||||
Log('Extracting ESP-IDF reference repository: ' + CmdLine);
|
Log('Extracting ESP-IDF reference repository: ' + CmdLine);
|
||||||
Log('Reference repository path: ' + IDFTempPath);
|
Log('Reference repository path: ' + IDFTempPath);
|
||||||
@@ -212,9 +212,9 @@ begin
|
|||||||
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 := ExpandConstant(PythonExecutablePath
|
||||||
+ ' {app}\idf_tools_fallback.py'
|
+ ' "{app}\idf_tools_fallback.py"'
|
||||||
+ ' --idf-path ' + IDFPath
|
+ ' --idf-path ' + IDFPath
|
||||||
+ ' --tools {app}\tools_fallback.json');
|
+ ' --tools "{app}\tools_fallback.json"');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Log('idf_tools.py command: ' + IDFToolsPyCmd);
|
Log('idf_tools.py command: ' + IDFToolsPyCmd);
|
||||||
@@ -238,7 +238,9 @@ begin
|
|||||||
ForceDirectories(ExpandConstant('{group}'));
|
ForceDirectories(ExpandConstant('{group}'));
|
||||||
Destination := ExpandConstant('{group}\{#IDFCmdExeShortcutFile}');
|
Destination := ExpandConstant('{group}\{#IDFCmdExeShortcutFile}');
|
||||||
Description := '{#IDFCmdExeShortcutDescription}';
|
Description := '{#IDFCmdExeShortcutDescription}';
|
||||||
Command := ExpandConstant('/k {app}\idf_cmd_init.bat "') + PythonPath + '" "' + GitPath + '"';
|
{ If cmd.exe command argument starts with a quote, the first and last quote chars in the command
|
||||||
|
will be removed by cmd.exe; each argument needs to be surrounded by quotes as well. }
|
||||||
|
Command := ExpandConstant('/k ""{app}\idf_cmd_init.bat" "') + PythonPath + '" "' + GitPath + '""';
|
||||||
Log('CreateShellLink Destination=' + Destination + ' Description=' + Description + ' Command=' + Command)
|
Log('CreateShellLink Destination=' + Destination + ' Description=' + Description + ' Command=' + Command)
|
||||||
try
|
try
|
||||||
CreateShellLink(
|
CreateShellLink(
|
||||||
|
@@ -35,6 +35,7 @@ AppPublisherURL={#MyAppURL}
|
|||||||
AppSupportURL={#MyAppURL}
|
AppSupportURL={#MyAppURL}
|
||||||
AppUpdatesURL={#MyAppURL}
|
AppUpdatesURL={#MyAppURL}
|
||||||
DefaultDirName={%USERPROFILE}\.espressif
|
DefaultDirName={%USERPROFILE}\.espressif
|
||||||
|
UsePreviousAppDir=no
|
||||||
DirExistsWarning=no
|
DirExistsWarning=no
|
||||||
DefaultGroupName=ESP-IDF
|
DefaultGroupName=ESP-IDF
|
||||||
DisableProgramGroupPage=yes
|
DisableProgramGroupPage=yes
|
||||||
@@ -78,7 +79,7 @@ Filename: "{group}\{#IDFCmdExeShortcutFile}"; Flags: postinstall shellexec; Desc
|
|||||||
|
|
||||||
[Registry]
|
[Registry]
|
||||||
Root: HKCU; Subkey: "Environment"; ValueType: string; ValueName: "IDF_TOOLS_PATH"; \
|
Root: HKCU; Subkey: "Environment"; ValueType: string; ValueName: "IDF_TOOLS_PATH"; \
|
||||||
ValueData: "{app}"; Flags: preservestringtype createvalueifdoesntexist;
|
ValueData: "{app}"; Flags: preservestringtype createvalueifdoesntexist uninsdeletevalue deletevalue;
|
||||||
|
|
||||||
[Code]
|
[Code]
|
||||||
|
|
||||||
|
@@ -17,6 +17,23 @@ begin
|
|||||||
idpDownloadAfter(wpReady);
|
idpDownloadAfter(wpReady);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ If IDF_TOOLS_PATH is set in the environment,
|
||||||
|
set the default installation directory accordingly.
|
||||||
|
Note: here we read IDF_TOOLS_PATH using GetEnv rather than
|
||||||
|
by getting it from registry, in case the user has set
|
||||||
|
IDF_TOOLS_PATH as a system environment variable manually. }
|
||||||
|
<event('InitializeWizard')>
|
||||||
|
procedure UpdateInstallDir();
|
||||||
|
var
|
||||||
|
EnvToolsPath: String;
|
||||||
|
begin
|
||||||
|
EnvToolsPath := GetEnv('IDF_TOOLS_PATH');
|
||||||
|
if EnvToolsPath <> '' then
|
||||||
|
begin
|
||||||
|
WizardForm.DirEdit.Text := EnvToolsPath;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
<event('NextButtonClick')>
|
<event('NextButtonClick')>
|
||||||
function PreInstallSteps(CurPageID: Integer): Boolean;
|
function PreInstallSteps(CurPageID: Integer): Boolean;
|
||||||
var
|
var
|
||||||
@@ -75,6 +92,11 @@ begin
|
|||||||
Log('Setting PATH for this process: ' + EnvPath);
|
Log('Setting PATH for this process: ' + EnvPath);
|
||||||
SetEnvironmentVariable('PATH', EnvPath);
|
SetEnvironmentVariable('PATH', EnvPath);
|
||||||
|
|
||||||
|
{ Set IDF_TOOLS_PATH variable, in case it was set to a different value in the environment.
|
||||||
|
The installer will set the variable to the new value in the registry, but we also need the
|
||||||
|
new value to be visible to this process. }
|
||||||
|
SetEnvironmentVariable('IDF_TOOLS_PATH', ExpandConstant('{app}'))
|
||||||
|
|
||||||
{ Log and clear PYTHONPATH variable, as it might point to libraries of another Python version}
|
{ Log and clear PYTHONPATH variable, as it might point to libraries of another Python version}
|
||||||
PythonLibPath := GetEnv('PYTHONPATH')
|
PythonLibPath := GetEnv('PYTHONPATH')
|
||||||
Log('PYTHONPATH=' + PythonLibPath)
|
Log('PYTHONPATH=' + PythonLibPath)
|
||||||
|
Reference in New Issue
Block a user