Do a more sensible venv search on Windows, and don't update the

registry upon installation.
This commit is contained in:
Dave Page 2016-06-16 16:21:55 +01:00
parent fc295f94a3
commit 73988bcece
3 changed files with 31 additions and 29 deletions

View File

@ -242,6 +242,9 @@ GOTO:EOF
ECHO HELP_PATH = '../../../docs/en_US/html/' >> "%PGBUILDPATH%\web\config_distro.py"
ECHO MINIFY_HTML = False >> "%PGBUILDPATH%\web\config_distro.py"
ECHO Creating config_local.py
ECHO # Add any configuration changes to this file. > "%PGBUILDPATH%\web\config_local.py"
ECHO Building docs...
MKDIR "%PGBUILDPATH%\docs\en_US\html"
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%

View File

@ -52,19 +52,6 @@ Root: HKLM; Subkey: "Software\{#MyAppName}\{#MyAppVersion}"; ValueType: string;
Root: HKLM; Subkey: "Software\{#MyAppName}\{#MyAppVersion}"; ValueType: string; ValueName: "Version"; ValueData: "{#MyAppFullVersion}"
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
var
value : string;
begin
if CurStep = ssInstall then begin
value := ExpandConstant('{app}') + '\venv\Lib\site-packages' + ';' +
ExpandConstant('{app}') + '\venv\Lib' + ';' +
ExpandConstant('{app}') + '\venv\Lib\lib-tk' + ';' +
ExpandConstant('{app}') + '\venv\DLLs';
RegWriteStringValue(HKEY_CURRENT_USER,'Software\pgAdmin Development Team\pgAdmin 4', 'PythonPath', value);
end;
end;
// find current version before installation
function InitializeSetup: Boolean;
var

View File

@ -67,7 +67,7 @@ Server::Server(quint16 port)
// Append the path, if it's not already there
if (!python_path.contains(pymodules_path))
{
if (!python_path.isEmpty())
if (!python_path.isEmpty() && !python_path.endsWith(";"))
python_path.append(";");
python_path.append(pymodules_path);
@ -83,24 +83,33 @@ Server::Server(quint16 port)
QString app_dir = qApp->applicationDirPath();
// Build (and canonicalise) the virtual environment path
// C:\Program Files (x86)\pgAdmin 4\v1\venv\Lib\site-packages;C:\Program Files (x86)\pgAdmin 4a\v1\venv\Lib;C:\Program Files (x86)\pgAdmin 4\v1\venv\DLLs
QString path1 = (app_dir + "/../venv/Lib/site-packages");
QString path2 = (app_dir + "/../venv/Lib");
QString path3 = (app_dir + "/../venv/DLLs");
QFileInfo fi1(path1);
QFileInfo fi2(path2);
QFileInfo fi3(path3);
QString pymodules_path = fi1.canonicalFilePath() + ";" + \
fi2.canonicalFilePath() + ";" + \
fi3.canonicalFilePath();
QFileInfo path1(app_dir + "/../venv/Lib");
QFileInfo path2(app_dir + "/../venv/DLLs");
QFileInfo path3(app_dir + "/../venv/Lib/site-packages");
// Append the path, if it's not already there
if (!python_path.contains(pymodules_path))
// Append paths, if they're not already there
if (!python_path.contains(path1.canonicalFilePath()))
{
if (!python_path.isEmpty())
if (!python_path.isEmpty() && !python_path.endsWith(";"))
python_path.append(";");
python_path.append(pymodules_path);
python_path.append(path1.canonicalFilePath());
}
if (!python_path.contains(path2.canonicalFilePath()))
{
if (!python_path.isEmpty() && !python_path.endsWith(";"))
python_path.append(";");
python_path.append(path2.canonicalFilePath());
}
if (!python_path.contains(path3.canonicalFilePath()))
{
if (!python_path.isEmpty() && !python_path.endsWith(";"))
python_path.append(";");
python_path.append(path3.canonicalFilePath());
}
#endif
@ -122,8 +131,11 @@ Server::Server(quint16 port)
#endif
}
}
qDebug() << "Full Python path: " << python_path;
python_path = settings.value("PythonPath").toString();
qDebug() << "Python path: " << python_path;
qDebug() << "User Python path: " << python_path;
}
Server::~Server()