Windows installer!

This commit is contained in:
Paresh More
2016-06-08 12:29:21 +01:00
committed by Dave Page
parent d1a0a9bab2
commit 47dccec915
8 changed files with 774 additions and 0 deletions

46
pkg/win32/README.txt Normal file
View File

@@ -0,0 +1,46 @@
Building pgAdmin windows installer on windows
=================================
To generate a pgAdmin 4 installer for Windows bit, the following packages must be installed:
1. Python installation
- Python 2.6 or above from https://www.python.org/
2. QT installation
- Qt 4.6 through 5.5 from http://www.qt.io/
3. PostgreSQL installation
- PostgreSQL 9.1 or above from http://www.postgresql.org/
4. Inno Setup Installer
- 5.0 and above from http://www.jrsoftware.org/isdl.php
5. Microsoft visual studio (2008 and above)
Building: Depending upon the archicture of the OS(x86|amd64) set then environment variables.
1. Set the PYTHON environment variable to the Python root installation directory, e.g. for x86
SET "PYTHON_HOME=C:\Python27"
SET "PYTHON_DLL=C:\Windows\System32\python27.dll"
2. Set the QTDIR environment variable to the QT root installation directory, e.g. for x86
SET "QTDIR=C:\Qt\Qt5.5.1\5.5\msvc2013"
3. Set the PGDIR environment variable to the PostgreSQL installation directory, e.g. for x86
SET "PGDIR=C:\Program Files\PostgreSQL\9.5"
4. Set the Inno Setup Installer environment variable to the Inno root installation directory, e.g. for x86
SET "INNOTOOL=C:\Program Files\Inno Setup 5"
5. Set the Miscrosoft Visual studio environment variable to the Visual studio root installation directory, e.g. for x86
SET "VCDIR=C:\Program Files\Microsoft Visual Studio 12.0\VC"
6. To build, go to pgAdmin4 source root directory and execute "Make.bat x86|amd64". Based on x86|amd64, this will
create the python virtual environment and install all the required python modules mentioned in the
requirements file using pip, build the runtime code and finally create the windows installer x86|amd64 in ./dist directory

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

97
pkg/win32/installer.iss Normal file
View File

@@ -0,0 +1,97 @@
#define MyAppName "pgAdmin 4"
#define MyAppVersion "v1"
#define MyAppPublisher "The pgAdmin Development Team"
#define MyAppURL "www.pgadmin.org"
#define MyAppExeName "pgAdmin4.exe"
#define MyAppID "C14F64E7-DCB9-4DE1-8560-16F08FCFF64E"
#define MyAppFullVersion "1.0"
#define MyAppArchitecturesMode ""
#define MyAppVCDist "vcredist_x86.exe"
[Setup]
AppId={#MyAppName}{#MyAppVersion}
AppName={#MyAppName}
AppVersion={#MyAppFullVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}\{#MyAppVersion}
DefaultGroupName={#MyAppName}
DisableWelcomePage=no
DisableProgramGroupPage=yes
LicenseFile=Resources\license.rtf
OutputBaseFilename=setup
SetupIconFile=Resources\pgAdmin4.ico
Compression=lzma
SolidCompression=yes
PrivilegesRequired=admin
ChangesEnvironment=yes
;UninstallFilesDir={app}\{#MyAppVersion}
ArchitecturesInstallIn64BitMode={#MyAppArchitecturesMode}
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Icons]
Name: {group}\{#MyAppName} {#MyAppVersion}; Filename: {app}\runtime\{#MyAppExeName}; IconFilename: {app}\pgAdmin4.ico; WorkingDir: {app}\runtime;
[Files]
Source: "..\..\win-build\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
[Run]
Filename: "{app}\installer\{#MyAppVCDist}"; StatusMsg: "VC runtime redistributable package"; Parameters: "/passive /verysilent /norestart"; Check: InstallVC;
Filename: "{app}\runtime\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: runascurrentuser nowait postinstall skipifsilent
[CustomMessages]
english.NewerVersionExists=A newer version of {#MyAppName}
[Registry]
Root: HKLM; Subkey: "Software\{#MyAppName}\{#MyAppVersion}"; Flags: uninsdeletekeyifempty
Root: HKLM; Subkey: "Software\{#MyAppName}\{#MyAppVersion}"; Flags: uninsdeletekey
Root: HKLM; Subkey: "Software\{#MyAppName}\{#MyAppVersion}"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"
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
Version: String;
begin
if RegValueExists(HKEY_LOCAL_MACHINE,'Software\{#MyAppName}\{#MyAppVersion}', 'Version') then
begin
RegQueryStringValue(HKEY_LOCAL_MACHINE,'Software\{#MyAppName}\{#MyAppVersion}', 'Version', Version);
if Version > '{#MyAppFullVersion}' then
begin
MsgBox(ExpandConstant('{cm:NewerVersionExists}' + '(v' + Version + ') is already installed' ), mbInformation, MB_OK);
Result := False;
end
else
begin
Result := True;
end
end
else
begin
Result := True;
end
end;
function InstallVC: Boolean;
begin
Result := True;
end;
// End of program

View File

@@ -0,0 +1,97 @@
#define MyAppName MYAPP_NAME
#define MyAppVersion MYAPP_VERSION
#define MyAppPublisher "The pgAdmin Development Team"
#define MyAppURL "www.pgadmin.org"
#define MyAppExeName "pgAdmin4.exe"
#define MyAppID "C14F64E7-DCB9-4DE1-8560-16F08FCFF64E"
#define MyAppFullVersion MYAPP_FULLVERSION
#define MyAppArchitecturesMode MYAPP_ARCHITECTURESMODE
#define MyAppVCDist MYAPP_VCDIST
[Setup]
AppId={#MyAppName}{#MyAppVersion}
AppName={#MyAppName}
AppVersion={#MyAppFullVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}\{#MyAppVersion}
DefaultGroupName={#MyAppName}
DisableWelcomePage=no
DisableProgramGroupPage=yes
LicenseFile=Resources\license.rtf
OutputBaseFilename=setup
SetupIconFile=Resources\pgAdmin4.ico
Compression=lzma
SolidCompression=yes
PrivilegesRequired=admin
ChangesEnvironment=yes
;UninstallFilesDir={app}\{#MyAppVersion}
ArchitecturesInstallIn64BitMode={#MyAppArchitecturesMode}
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Icons]
Name: {group}\{#MyAppName} {#MyAppVersion}; Filename: {app}\runtime\{#MyAppExeName}; IconFilename: {app}\pgAdmin4.ico; WorkingDir: {app}\runtime;
[Files]
Source: "..\..\win-build\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
[Run]
Filename: "{app}\installer\{#MyAppVCDist}"; StatusMsg: "VC runtime redistributable package"; Parameters: "/passive /verysilent /norestart"; Check: InstallVC;
Filename: "{app}\runtime\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: runascurrentuser nowait postinstall skipifsilent
[CustomMessages]
english.NewerVersionExists=A newer version of {#MyAppName}
[Registry]
Root: HKLM; Subkey: "Software\{#MyAppName}\{#MyAppVersion}"; Flags: uninsdeletekeyifempty
Root: HKLM; Subkey: "Software\{#MyAppName}\{#MyAppVersion}"; Flags: uninsdeletekey
Root: HKLM; Subkey: "Software\{#MyAppName}\{#MyAppVersion}"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"
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
Version: String;
begin
if RegValueExists(HKEY_LOCAL_MACHINE,'Software\{#MyAppName}\{#MyAppVersion}', 'Version') then
begin
RegQueryStringValue(HKEY_LOCAL_MACHINE,'Software\{#MyAppName}\{#MyAppVersion}', 'Version', Version);
if Version > '{#MyAppFullVersion}' then
begin
MsgBox(ExpandConstant('{cm:NewerVersionExists}' + '(v' + Version + ') is already installed' ), mbInformation, MB_OK);
Result := False;
end
else
begin
Result := True;
end
end
else
begin
Result := True;
end
end;
function InstallVC: Boolean;
begin
Result := True;
end;
// End of program

36
pkg/win32/replace.py Normal file
View File

@@ -0,0 +1,36 @@
import fileinput
import sys, getopt
# Store input and output file names
infile=''
outfile=''
searchExp=''
replaceExp=''
# Read command line args
myopts, args = getopt.getopt(sys.argv[1:],"i:o:s:r:")
###############################
# o == option
# a == argument passed to the o
###############################
for o, a in myopts:
if o == '-i':
infile=a
elif o == '-o':
outfile=a
elif o == '-s':
searchExp=a
elif o == '-r':
replaceExp=a
else:
print("Usage: %s -i input -o output" % sys.argv[0])
# Display input and output file name passed as the args
f1 = open(infile, 'r')
f2 = open(outfile, 'w')
for line in f1:
f2.write(line.replace(searchExp,replaceExp))
f1.close()
f2.close()