Skip to content

Commit

Permalink
Windows Installer: Drop the SCOPY_PYTHONPATH environment variable.
Browse files Browse the repository at this point in the history
We no longer set the env var. Version v1.1.2 will be the last one that
knows how to remove the SCOPY_PYTHONPATH env var from the system at
uninstall. If not uninstalled, then the env var will remain and we need
to provide backwards compatibility. That is why we append it to the end
of the path.

If Scopy was installed using the official installer, it will always use
the hardcoded paths in applicationDirPath(), where the python3.X folder is.
If Scopy is built locally on Windows, the user will set the SCOPY_PYTHONPATH
env var manually and, since that one is appended at the end, the program will
still function properly.

Signed-off-by: Alexandra Trifan <[email protected]>
  • Loading branch information
AlexandraTrifan committed Oct 14, 2020
1 parent c02d325 commit d2af6c4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
1 change: 1 addition & 0 deletions config.h.cmakein
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
#define PROJECT_VERSION "@PROJECT_VERSION@"
#define SCOPY_VERSION_GIT "@SCOPY_VERSION_GIT@"
#define BREAKPAD_HANDLER @BREAKPAD_HANDLER_BOOL@
#define PYTHON_VERSION "@PYTHON_VERSION@"

#endif // CONFIG_H_CMAKEIN
3 changes: 0 additions & 3 deletions scopy-32.iss.cmakein
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ Name: "{group}\{#AppName}"; Filename: "{app}\{#AppExeName}"
Name: "{group}\{cm:UninstallProgram,{#AppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#AppName}"; Filename: "{app}\{#AppExeName}"; Tasks: desktopicon

[Registry]
Root: HKLM; Subkey: "System\CurrentControlSet\Control\Session Manager\Environment"; ValueType:string; ValueName: "SCOPY_PYTHONPATH"; ValueData: "{app}\{#Python};{app}\{#Python}\plat-win;{app}\{#Python}\lib-dynload;{app}\{#Python}\site-packages"; Flags: uninsdeletevalue

[Code]
var
DeleteIniCheckBox: TNewCheckBox;
Expand Down
3 changes: 0 additions & 3 deletions scopy-64.iss.cmakein
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ Name: "{group}\{#AppName}"; Filename: "{app}\{#AppExeName}"
Name: "{group}\{cm:UninstallProgram,{#AppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#AppName}"; Filename: "{app}\{#AppExeName}"; Tasks: desktopicon

[Registry]
Root: HKLM; Subkey: "System\CurrentControlSet\Control\Session Manager\Environment"; ValueType:string; ValueName: "SCOPY_PYTHONPATH"; ValueData: "{app}\{#Python};{app}\{#Python}\plat-win;{app}\{#Python}\lib-dynload;{app}\{#Python}\site-packages"; Flags: uninsdeletevalue

[Code]
var
DeleteIniCheckBox: TNewCheckBox;
Expand Down
4 changes: 0 additions & 4 deletions scopy.iss.cmakein
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ Name: "{group}\{#AppName}"; Filename: "{app}\{#AppExeName}"
Name: "{group}\{cm:UninstallProgram,{#AppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#AppName}"; Filename: "{app}\{#AppExeName}"; Tasks: desktopicon

[Registry]
Root: HKLM; Subkey: "System\CurrentControlSet\Control\Session Manager\Environment"; ValueType:string; ValueName: "SCOPY_PYTHONPATH"; ValueData: "{app}\{#Python};{app}\{#Python}\plat-win;{app}\{#Python}\lib-dynload;{app}\{#Python}\site-packages"; Flags: uninsdeletevalue


[Code]
var
DeleteIniCheckBox: TNewCheckBox;
Expand Down
10 changes: 8 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,15 @@ int main(int argc, char **argv)
app.setStyleSheet(stylesheet);
}

#ifdef WIN32
auto pythonpath = qgetenv("SCOPY_PYTHONPATH");
if (!pythonpath.isNull())
qputenv("PYTHONPATH", pythonpath);
auto path_str = QCoreApplication::applicationDirPath() + "\\" + PYTHON_VERSION + ";";
path_str += QCoreApplication::applicationDirPath() + "\\" + PYTHON_VERSION + "\\plat-win;";
path_str += QCoreApplication::applicationDirPath() + "\\" + PYTHON_VERSION + "\\lib-dynload;";
path_str += QCoreApplication::applicationDirPath() + "\\" + PYTHON_VERSION + "\\site-packages;";
path_str += QString::fromLocal8Bit(pythonpath);
qputenv("PYTHONPATH", path_str.toLocal8Bit());
#endif

QCoreApplication::setOrganizationName("ADI");
QCoreApplication::setOrganizationDomain("analog.com");
Expand Down

0 comments on commit d2af6c4

Please sign in to comment.