From 4c74450ebd9f13d8133ea6223be7a26ececc9f9d Mon Sep 17 00:00:00 2001 From: Stephen Dade Date: Sat, 13 Jun 2015 17:27:04 +1000 Subject: [PATCH 1/2] Created windows installer. Use batch file to run it --- windows/droneapiWinBuild.bat | 16 +++++ windows/droneapi_installer.iss | 104 +++++++++++++++++++++++++++++++++ windows/returnVersion.py | 12 ++++ 3 files changed, 132 insertions(+) create mode 100644 windows/droneapiWinBuild.bat create mode 100644 windows/droneapi_installer.iss create mode 100644 windows/returnVersion.py diff --git a/windows/droneapiWinBuild.bat b/windows/droneapiWinBuild.bat new file mode 100644 index 000000000..dc680a230 --- /dev/null +++ b/windows/droneapiWinBuild.bat @@ -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 diff --git a/windows/droneapi_installer.iss b/windows/droneapi_installer.iss new file mode 100644 index 000000000..77a8aa254 --- /dev/null +++ b/windows/droneapi_installer.iss @@ -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 "DroneAPI" +; #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=DroneAPIsetup-{#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 DroneAPI. 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 := 'DroneAPI 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; \ No newline at end of file diff --git a/windows/returnVersion.py b/windows/returnVersion.py new file mode 100644 index 000000000..a15976f88 --- /dev/null +++ b/windows/returnVersion.py @@ -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 \ No newline at end of file From 243de9a08837539cc9f769d1bbe6b4c851d5d3bc Mon Sep 17 00:00:00 2001 From: Stephen Dade Date: Tue, 16 Jun 2015 10:47:43 +1000 Subject: [PATCH 2/2] Consistent naming scheme --- windows/droneapi_installer.iss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/windows/droneapi_installer.iss b/windows/droneapi_installer.iss index 77a8aa254..dc347aa17 100644 --- a/windows/droneapi_installer.iss +++ b/windows/droneapi_installer.iss @@ -1,7 +1,7 @@ ; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! -#define MyAppName "DroneAPI" +#define MyAppName "DroneKit" ; #define MyAppVersion "1" #define MyAppPublisher "3D Robotics, Inc" #define MyAppURL "https://github.com/diydrones/dronekit-python" @@ -20,7 +20,7 @@ AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} CreateAppDir=no -OutputBaseFilename=DroneAPIsetup-{#MyAppVersion} +OutputBaseFilename=DroneKitsetup-{#MyAppVersion} Compression=lzma SolidCompression=yes LicenseFile=..\LICENSE @@ -57,7 +57,7 @@ function InitializeSetup: boolean; begin result := IsMAVProxyInstalled; if not result then - MsgBox('You need to install MAVProxy before you install DroneAPI. Install MAVProxy and then run this installer again.', mbError, MB_OK); + 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; @@ -76,7 +76,7 @@ begin with Label1 do begin Parent := Page.Surface; - Caption := 'DroneAPI will be installed in the MAVProxy directory:' + Caption := 'DroneKit will be installed in the MAVProxy directory:' Left := ScaleX(16); Top := ScaleY(0); Width := ScaleX(300);