Skip to content

Created windows installer. Use batch file to run it #161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions windows/droneapiWinBuild.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
rem build the standalone Dronekit.exe for Windows.
rem This assumes Python is installed in C:\Python27
SETLOCAL enableextensions

rem get the version
for /f "tokens=*" %%a in (
'python returnVersion.py'
) do (
set VERSION=%%a
)


rem -----Build the Installer-----
"C:\Program Files (x86)\Inno Setup 5\ISCC.exe" /dMyAppVersion=%VERSION% -compile droneapi_installer.iss

pause
104 changes: 104 additions & 0 deletions windows/droneapi_installer.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "DroneKit"
; #define MyAppVersion "1"
#define MyAppPublisher "3D Robotics, Inc"
#define MyAppURL "https://github.com/diydrones/dronekit-python"
#define MyAppExeName ""

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{35EE5962-C212-4874-90EC-50863DD1537D}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
CreateAppDir=no
OutputBaseFilename=DroneKitsetup-{#MyAppVersion}
Compression=lzma
SolidCompression=yes
LicenseFile=..\LICENSE
DisableDirPage=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Files]
Source: "..\droneapi\*"; DestDir: "{code:GetMAVProxyPath}\droneapi"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "..\examples\*"; DestDir: "{code:GetMAVProxyPath}\examples"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

; Check if MAVProxy is installed (if so, get the install path)
[Code]
function IsMAVProxyInstalled: boolean;
begin
result := RegKeyExists(HKEY_LOCAL_MACHINE,
'Software\Microsoft\Windows\CurrentVersion\Uninstall\{D81B9EDA-1357-462E-96E4-B47372709F7C}_is1');
end;

function GetMAVProxyPath(Dummy: string): string;
var
sInstallPath: string;
MAVProxyPath: string;
begin
MAVProxyPath := 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{D81B9EDA-1357-462E-96E4-B47372709F7C}_is1'
sInstallPath := '';
RegQueryStringValue(HKLM, MAVProxyPath, 'InstallLocation', sInstallPath);
Result := sInstallPath;
end;

function InitializeSetup: boolean;
begin
result := IsMAVProxyInstalled;
if not result then
MsgBox('You need to install MAVProxy before you install DroneKit. Install MAVProxy and then run this installer again.', mbError, MB_OK);
end;

function MAVDir_CreatePage(PreviousPageId: Integer): Integer;
var
Page: TWizardPage;
Label1: TLabel;
MAVDir: TEdit;
begin
Page := CreateCustomPage(
PreviousPageId,
'Installation Directory',
''
);

Label1 := TLabel.Create(Page);
with Label1 do
begin
Parent := Page.Surface;
Caption := 'DroneKit will be installed in the MAVProxy directory:'
Left := ScaleX(16);
Top := ScaleY(0);
Width := ScaleX(300);
Height := ScaleY(17);
end;

MAVDir := TEdit.Create(Page);
with MAVDir do
begin
Parent := Page.Surface;
Left := ScaleX(16);
Top := ScaleY(24);
Width := ScaleX(300);
Height := ScaleY(25);
TabOrder := 0;
Text := GetMAVProxyPath('');
Enabled := False;
end

end;

procedure InitializeWizard();
begin
MAVDir_CreatePage(wpLicense);
end;
12 changes: 12 additions & 0 deletions windows/returnVersion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This script reads the setup.py and returns the current version number
# Used as part of building the WIndows setup file (DronekitWinBuild.bat)
# It assumes there is a line like this:
# version = "12344"

# glob supports Unix style pathname extensions
with open("../setup.py") as f:
searchlines = f.readlines()
for i, line in enumerate(searchlines):
if "version = " in line:
print line[11:len(line)-2]
break