Skip to content

Commit 4c74450

Browse files
committed
Created windows installer. Use batch file to run it
1 parent 6fa185f commit 4c74450

File tree

3 files changed

+132
-0
lines changed

3 files changed

+132
-0
lines changed

windows/droneapiWinBuild.bat

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
rem build the standalone Dronekit.exe for Windows.
2+
rem This assumes Python is installed in C:\Python27
3+
SETLOCAL enableextensions
4+
5+
rem get the version
6+
for /f "tokens=*" %%a in (
7+
'python returnVersion.py'
8+
) do (
9+
set VERSION=%%a
10+
)
11+
12+
13+
rem -----Build the Installer-----
14+
"C:\Program Files (x86)\Inno Setup 5\ISCC.exe" /dMyAppVersion=%VERSION% -compile droneapi_installer.iss
15+
16+
pause

windows/droneapi_installer.iss

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
; Script generated by the Inno Setup Script Wizard.
2+
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
3+
4+
#define MyAppName "DroneAPI"
5+
; #define MyAppVersion "1"
6+
#define MyAppPublisher "3D Robotics, Inc"
7+
#define MyAppURL "https://github.com/diydrones/dronekit-python"
8+
#define MyAppExeName ""
9+
10+
[Setup]
11+
; NOTE: The value of AppId uniquely identifies this application.
12+
; Do not use the same AppId value in installers for other applications.
13+
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
14+
AppId={{35EE5962-C212-4874-90EC-50863DD1537D}
15+
AppName={#MyAppName}
16+
AppVersion={#MyAppVersion}
17+
;AppVerName={#MyAppName} {#MyAppVersion}
18+
AppPublisher={#MyAppPublisher}
19+
AppPublisherURL={#MyAppURL}
20+
AppSupportURL={#MyAppURL}
21+
AppUpdatesURL={#MyAppURL}
22+
CreateAppDir=no
23+
OutputBaseFilename=DroneAPIsetup-{#MyAppVersion}
24+
Compression=lzma
25+
SolidCompression=yes
26+
LicenseFile=..\LICENSE
27+
DisableDirPage=yes
28+
29+
[Languages]
30+
Name: "english"; MessagesFile: "compiler:Default.isl"
31+
32+
[Files]
33+
Source: "..\droneapi\*"; DestDir: "{code:GetMAVProxyPath}\droneapi"; Flags: ignoreversion recursesubdirs createallsubdirs
34+
Source: "..\examples\*"; DestDir: "{code:GetMAVProxyPath}\examples"; Flags: ignoreversion recursesubdirs createallsubdirs
35+
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
36+
37+
; Check if MAVProxy is installed (if so, get the install path)
38+
[Code]
39+
function IsMAVProxyInstalled: boolean;
40+
begin
41+
result := RegKeyExists(HKEY_LOCAL_MACHINE,
42+
'Software\Microsoft\Windows\CurrentVersion\Uninstall\{D81B9EDA-1357-462E-96E4-B47372709F7C}_is1');
43+
end;
44+
45+
function GetMAVProxyPath(Dummy: string): string;
46+
var
47+
sInstallPath: string;
48+
MAVProxyPath: string;
49+
begin
50+
MAVProxyPath := 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{D81B9EDA-1357-462E-96E4-B47372709F7C}_is1'
51+
sInstallPath := '';
52+
RegQueryStringValue(HKLM, MAVProxyPath, 'InstallLocation', sInstallPath);
53+
Result := sInstallPath;
54+
end;
55+
56+
function InitializeSetup: boolean;
57+
begin
58+
result := IsMAVProxyInstalled;
59+
if not result then
60+
MsgBox('You need to install MAVProxy before you install DroneAPI. Install MAVProxy and then run this installer again.', mbError, MB_OK);
61+
end;
62+
63+
function MAVDir_CreatePage(PreviousPageId: Integer): Integer;
64+
var
65+
Page: TWizardPage;
66+
Label1: TLabel;
67+
MAVDir: TEdit;
68+
begin
69+
Page := CreateCustomPage(
70+
PreviousPageId,
71+
'Installation Directory',
72+
''
73+
);
74+
75+
Label1 := TLabel.Create(Page);
76+
with Label1 do
77+
begin
78+
Parent := Page.Surface;
79+
Caption := 'DroneAPI will be installed in the MAVProxy directory:'
80+
Left := ScaleX(16);
81+
Top := ScaleY(0);
82+
Width := ScaleX(300);
83+
Height := ScaleY(17);
84+
end;
85+
86+
MAVDir := TEdit.Create(Page);
87+
with MAVDir do
88+
begin
89+
Parent := Page.Surface;
90+
Left := ScaleX(16);
91+
Top := ScaleY(24);
92+
Width := ScaleX(300);
93+
Height := ScaleY(25);
94+
TabOrder := 0;
95+
Text := GetMAVProxyPath('');
96+
Enabled := False;
97+
end
98+
99+
end;
100+
101+
procedure InitializeWizard();
102+
begin
103+
MAVDir_CreatePage(wpLicense);
104+
end;

windows/returnVersion.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This script reads the setup.py and returns the current version number
2+
# Used as part of building the WIndows setup file (DronekitWinBuild.bat)
3+
# It assumes there is a line like this:
4+
# version = "12344"
5+
6+
# glob supports Unix style pathname extensions
7+
with open("../setup.py") as f:
8+
searchlines = f.readlines()
9+
for i, line in enumerate(searchlines):
10+
if "version = " in line:
11+
print line[11:len(line)-2]
12+
break

0 commit comments

Comments
 (0)