2012-10-12 16:37:12 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
#coding:utf8
|
2012-12-30 13:07:07 +00:00
|
|
|
from distutils.core import setup
|
|
|
|
from py2exe.build_exe import py2exe
|
2013-01-15 18:27:21 +00:00
|
|
|
from string import Template
|
2012-10-12 16:37:12 +00:00
|
|
|
|
|
|
|
import syncplay
|
2012-12-24 18:15:32 +00:00
|
|
|
import sys
|
2013-01-15 18:27:21 +00:00
|
|
|
import os
|
|
|
|
import subprocess
|
2012-10-12 16:37:12 +00:00
|
|
|
|
2013-01-26 22:42:13 +00:00
|
|
|
p = "C:\\Program Files (x86)\\NSIS\\makensis.exe" #TODO: how to move that into proper place, huh
|
2013-01-16 14:00:57 +00:00
|
|
|
NSIS_COMPILE = p if os.path.isfile(p) else "makensis.exe"
|
|
|
|
OUT_DIR = "syncplay v{}".format(syncplay.version)
|
2013-01-15 18:27:21 +00:00
|
|
|
SETUP_SCRIPT_PATH = "syncplay_setup.nsi"
|
|
|
|
NSIS_SCRIPT_TEMPLATE = r"""
|
|
|
|
!include LogicLib.nsh
|
|
|
|
!include nsDialogs.nsh
|
2013-01-26 21:10:28 +00:00
|
|
|
!include FileFunc.nsh
|
2013-01-16 14:00:57 +00:00
|
|
|
|
2013-01-15 18:27:21 +00:00
|
|
|
LoadLanguageFile "$${NSISDIR}\Contrib\Language files\English.nlf"
|
|
|
|
LoadLanguageFile "$${NSISDIR}\Contrib\Language files\Polish.nlf"
|
|
|
|
|
2013-01-26 20:37:51 +00:00
|
|
|
Name "Syncplay $version"
|
|
|
|
OutFile "Syncplay $version Setup.exe"
|
2013-01-15 18:27:21 +00:00
|
|
|
InstallDir $$PROGRAMFILES\Syncplay
|
|
|
|
RequestExecutionLevel admin
|
|
|
|
XPStyle on
|
|
|
|
Icon resources\icon.ico ;Change DIR
|
|
|
|
SetCompressor /SOLID lzma
|
|
|
|
|
2013-01-16 14:00:57 +00:00
|
|
|
VIProductVersion "$version.0"
|
2013-01-15 18:27:21 +00:00
|
|
|
VIAddVersionKey /LANG=$${LANG_ENGLISH} "ProductName" "Syncplay"
|
2013-01-16 14:00:57 +00:00
|
|
|
VIAddVersionKey /LANG=$${LANG_ENGLISH} "FileVersion" "$version.0"
|
2013-01-15 18:27:21 +00:00
|
|
|
VIAddVersionKey /LANG=$${LANG_ENGLISH} "LegalCopyright" "Syncplay"
|
|
|
|
VIAddVersionKey /LANG=$${LANG_ENGLISH} "FileDescription" "Syncplay"
|
|
|
|
|
|
|
|
VIAddVersionKey /LANG=$${LANG_POLISH} "ProductName" "Syncplay"
|
2013-01-16 14:00:57 +00:00
|
|
|
VIAddVersionKey /LANG=$${LANG_POLISH} "FileVersion" "$version.0"
|
2013-01-15 18:27:21 +00:00
|
|
|
VIAddVersionKey /LANG=$${LANG_POLISH} "LegalCopyright" "Syncplay"
|
2013-01-29 12:30:40 +00:00
|
|
|
VIAddVersionKey /LANG=$${LANG_POLISH} "FileDescription" "Syncplay"
|
|
|
|
|
|
|
|
LangString ^Associate $${LANG_ENGLISH} "Associate Syncplay with multimedia files."
|
|
|
|
LangString ^VLC $${LANG_ENGLISH} "Install Syncplay interface for VLC (requires VLC 2.0.X)"
|
|
|
|
LangString ^Shortcut $${LANG_ENGLISH} "Create Shortcuts in following locations:"
|
|
|
|
LangString ^StartMenu $${LANG_ENGLISH} "Start Menu"
|
|
|
|
LangString ^Desktop $${LANG_ENGLISH} "Desktop"
|
|
|
|
LangString ^QuickLaunchBar $${LANG_ENGLISH} "Quick Launch Bar"
|
2013-01-29 14:15:40 +00:00
|
|
|
LangString ^UninstConfig $${LANG_ENGLISH} "Delete configuration file."
|
2013-01-29 12:30:40 +00:00
|
|
|
|
|
|
|
LangString ^Associate $${LANG_POLISH} "Skojarz Syncplaya z multimediami"
|
|
|
|
LangString ^VLC $${LANG_POLISH} "Zainstaluj interface Syncplaya dla VLC(wymaga VLC 2.0.X)"
|
|
|
|
LangString ^Shortcut $${LANG_POLISH} "Utworz skroty w nastepujacych miejscach:"
|
|
|
|
LangString ^StartMenu $${LANG_POLISH} "Menu Start"
|
|
|
|
LangString ^Desktop $${LANG_POLISH} "Pulpit"
|
|
|
|
LangString ^QuickLaunchBar $${LANG_POLISH} "Pasek szybkiego uruchamiania"
|
2013-01-29 14:15:40 +00:00
|
|
|
LangString ^UninstConfig $${LANG_POLISH} "Usun plik konfiguracyjny."
|
2013-01-15 18:27:21 +00:00
|
|
|
|
|
|
|
PageEx license
|
|
|
|
LicenseData resources\license.txt
|
|
|
|
PageExEnd
|
2013-01-29 12:30:40 +00:00
|
|
|
Page custom DirectoryCustom DirectoryCustomLeave
|
2013-01-15 18:27:21 +00:00
|
|
|
Page instFiles
|
2013-01-29 14:15:40 +00:00
|
|
|
|
|
|
|
UninstPage custom un.installConfirm un.installConfirmLeave
|
2013-01-15 18:27:21 +00:00
|
|
|
UninstPage instFiles
|
2013-01-29 12:30:40 +00:00
|
|
|
|
|
|
|
Var Dialog
|
2013-01-29 14:15:40 +00:00
|
|
|
Var Icon_Syncplay
|
|
|
|
Var Icon_Syncplay_Handle
|
2013-01-29 12:30:40 +00:00
|
|
|
Var CheckBox_Associate
|
|
|
|
Var CheckBox_VLC
|
|
|
|
Var CheckBox_StartMenuShortcut
|
|
|
|
Var CheckBox_DesktopShortcut
|
|
|
|
Var CheckBox_QuickLaunchShortcut
|
|
|
|
Var CheckBox_Associate_State
|
|
|
|
Var CheckBox_VLC_State
|
|
|
|
Var CheckBox_StartMenuShortcut_State
|
|
|
|
Var CheckBox_DesktopShortcut_State
|
|
|
|
Var CheckBox_QuickLaunchShortcut_State
|
|
|
|
Var Button_Browse
|
|
|
|
Var Directory
|
|
|
|
Var GroupBox_DirSub
|
|
|
|
Var Label_Text
|
|
|
|
Var Label_Shortcut
|
|
|
|
Var Label_Size
|
|
|
|
Var Label_Space
|
|
|
|
Var Text_Directory
|
|
|
|
|
2013-01-29 14:15:40 +00:00
|
|
|
Var Uninst_Dialog
|
|
|
|
Var Uninst_Icon
|
|
|
|
Var Uninst_Icon_Handle
|
|
|
|
Var Uninst_Label_Directory
|
|
|
|
Var Uninst_Label_Text
|
|
|
|
Var Uninst_Text_Directory
|
|
|
|
Var Uninst_CheckBox_Config
|
|
|
|
Var Uninst_CheckBox_Config_State
|
|
|
|
|
2013-01-29 12:30:40 +00:00
|
|
|
Var Size
|
|
|
|
Var SizeHex
|
|
|
|
Var AvailibleSpace
|
|
|
|
Var AvailibleSpaceGiB
|
|
|
|
Var Drive
|
|
|
|
Var VLC_Directory
|
|
|
|
Var VLC_Version
|
2013-01-15 18:27:21 +00:00
|
|
|
|
|
|
|
!macro APP_ASSOCIATE EXT FileCLASS DESCRIPTION COMMANDTEXT COMMAND
|
|
|
|
WriteRegStr HKCR ".$${EXT}" "" "$${FileCLASS}"
|
|
|
|
WriteRegStr HKCR "$${FileCLASS}" "" `$${DESCRIPTION}`
|
|
|
|
WriteRegStr HKCR "$${FileCLASS}\shell" "" "open"
|
|
|
|
WriteRegStr HKCR "$${FileCLASS}\shell\open" "" `$${COMMANDTEXT}`
|
|
|
|
WriteRegStr HKCR "$${FileCLASS}\shell\open\command" "" `$${COMMAND}`
|
|
|
|
!macroend
|
|
|
|
|
|
|
|
!macro APP_UNASSOCIATE EXT FileCLASS
|
|
|
|
; Backup the previously associated File class
|
|
|
|
ReadRegStr $$R0 HKCR ".$${EXT}" `$${FileCLASS}_backup`
|
|
|
|
WriteRegStr HKCR ".$${EXT}" "" "$$R0"
|
|
|
|
DeleteRegKey HKCR `$${FileCLASS}`
|
|
|
|
!macroend
|
|
|
|
|
2013-01-29 19:08:43 +00:00
|
|
|
!macro ASSOCIATE EXT
|
|
|
|
!insertmacro APP_ASSOCIATE "$${EXT}" "Syncplay.$${EXT}" "$$INSTDIR\Syncplay.exe,%1%" \
|
|
|
|
"Open with Syncplay" "$$INSTDIR\Syncplay.exe $$\"%1$$\""
|
|
|
|
!macroend
|
|
|
|
|
|
|
|
!macro UNASSOCIATE EXT
|
|
|
|
!insertmacro APP_UNASSOCIATE "$${EXT}" "Syncplay.$${EXT}"
|
|
|
|
!macroend
|
|
|
|
|
2013-01-29 12:30:40 +00:00
|
|
|
;Prevents from running more than one instance of installer and sets default state of checkboxes
|
|
|
|
Function .onInit
|
|
|
|
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "myMutex") i .r1 ?e'
|
|
|
|
Pop $$R0
|
|
|
|
StrCmp $$R0 0 +3
|
|
|
|
MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running."
|
|
|
|
Abort
|
|
|
|
|
|
|
|
StrCpy $$CheckBox_Associate_State $${BST_CHECKED}
|
|
|
|
StrCpy $$CheckBox_StartMenuShortcut_State $${BST_CHECKED}
|
2013-01-29 18:19:32 +00:00
|
|
|
|
|
|
|
Call GetSize
|
2013-01-29 12:30:40 +00:00
|
|
|
Call DriveSpace
|
|
|
|
Call Language
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
;Language selection dialog
|
|
|
|
Function Language
|
|
|
|
Push ""
|
|
|
|
Push $${LANG_ENGLISH}
|
|
|
|
Push English
|
|
|
|
Push $${LANG_POLISH}
|
|
|
|
Push Polski
|
|
|
|
Push A ; A means auto count languages
|
|
|
|
LangDLL::LangDialog "Installer Language" "Please select the language of the installer"
|
|
|
|
Pop $$LANGUAGE
|
|
|
|
StrCmp $$LANGUAGE "cancel" 0 +2
|
|
|
|
Abort
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function DirectoryCustom
|
|
|
|
|
|
|
|
nsDialogs::Create 1018
|
|
|
|
Pop $$Dialog
|
|
|
|
|
|
|
|
GetFunctionAddress $$R8 DirectoryCustomLeave
|
|
|
|
nsDialogs::OnBack $$R8
|
|
|
|
|
|
|
|
$${NSD_CreateIcon} 0u 0u 22u 20u ""
|
2013-01-29 14:15:40 +00:00
|
|
|
Pop $$Icon_Syncplay
|
|
|
|
$${NSD_SetIconFromInstaller} $$Icon_Syncplay $$Icon_Syncplay_Handle
|
2013-01-29 12:30:40 +00:00
|
|
|
|
|
|
|
$${NSD_CreateLabel} 25u 0u 241u 34u "$$(^DirText)"
|
|
|
|
Pop $$Label_Text
|
|
|
|
|
|
|
|
$${NSD_CreateText} 8u 38u 187u 12u "$$INSTDIR"
|
|
|
|
Pop $$Text_Directory
|
|
|
|
$${NSD_SetFocus} $$Text_Directory
|
|
|
|
|
|
|
|
$${NSD_CreateBrowseButton} 202u 37u 55u 14u "$$(^BrowseBtn)"
|
|
|
|
Pop $$Button_Browse
|
|
|
|
$${NSD_OnClick} $$Button_Browse DirectoryBrowseDialog
|
|
|
|
|
|
|
|
$${NSD_CreateGroupBox} 1u 27u 264u 30u "$$(^DirSubText)"
|
|
|
|
Pop $$GroupBox_DirSub
|
|
|
|
|
|
|
|
$${NSD_CreateLabel} 0u 111u 265u 8u "$$(^SpaceRequired)$$SizeMB"
|
|
|
|
Pop $$Label_Size
|
|
|
|
|
|
|
|
$${NSD_CreateLabel} 0u 122u 265u 8u "$$(^SpaceAvailable)$$AvailibleSpaceGiB.$$AvailibleSpaceGB"
|
|
|
|
Pop $$Label_Space
|
|
|
|
|
|
|
|
$${NSD_CreateCheckBox} 8u 59u 187u 10u "$$(^Associate)"
|
|
|
|
Pop $$CheckBox_Associate
|
|
|
|
|
|
|
|
$${NSD_CreateCheckBox} 8u 72u 250u 10u "$$(^VLC)"
|
|
|
|
Pop $$CheckBox_VLC
|
|
|
|
|
|
|
|
$${NSD_CreateLabel} 8u 85u 187u 10u "$$(^Shortcut)"
|
|
|
|
Pop $$Label_Shortcut
|
|
|
|
|
|
|
|
$${NSD_CreateCheckbox} 8u 98u 50u 10u "$$(^StartMenu)"
|
|
|
|
Pop $$CheckBox_StartMenuShortcut
|
|
|
|
|
|
|
|
$${NSD_CreateCheckbox} 68u 98u 50u 10u "$$(^Desktop)"
|
|
|
|
Pop $$CheckBox_DesktopShortcut
|
|
|
|
|
|
|
|
$${NSD_CreateCheckbox} 128u 98u 150u 10u "$$(^QuickLaunchBar)"
|
|
|
|
Pop $$CheckBox_QuickLaunchShortcut
|
|
|
|
|
|
|
|
$${If} $$CheckBox_Associate_State == $${BST_CHECKED}
|
2013-05-28 20:50:42 +00:00
|
|
|
$${NSD_Check} $$CheckBox_Associate
|
2013-01-29 12:30:40 +00:00
|
|
|
$${EndIf}
|
|
|
|
|
|
|
|
$${If} $$CheckBox_VLC_State == $${BST_CHECKED}
|
|
|
|
$${NSD_Check} $$CheckBox_VLC
|
|
|
|
$${EndIf}
|
|
|
|
|
|
|
|
$${If} $$CheckBox_StartMenuShortcut_State == $${BST_CHECKED}
|
|
|
|
$${NSD_Check} $$CheckBox_StartMenuShortcut
|
|
|
|
$${EndIf}
|
|
|
|
|
|
|
|
$${If} $$CheckBox_DesktopShortcut_State == $${BST_CHECKED}
|
|
|
|
$${NSD_Check} $$CheckBox_DesktopShortcut
|
|
|
|
$${EndIf}
|
|
|
|
|
|
|
|
$${If} $$CheckBox_QuickLaunchShortcut_State == $${BST_CHECKED}
|
|
|
|
$${NSD_Check} $$CheckBox_QuickLaunchShortcut
|
|
|
|
$${EndIf}
|
|
|
|
|
|
|
|
ReadRegStr $$VLC_Version HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VLC media player" "VersionMajor"
|
|
|
|
$${If} $$VLC_Version != "2"
|
|
|
|
EnableWindow $$CheckBox_VLC 0
|
|
|
|
$${EndIf}
|
|
|
|
nsDialogs::Show
|
|
|
|
|
2013-01-29 14:15:40 +00:00
|
|
|
$${NSD_FreeIcon} $$Icon_Syncplay_Handle
|
2013-01-29 12:30:40 +00:00
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function DirectoryCustomLeave
|
2013-01-29 17:49:41 +00:00
|
|
|
$${NSD_GetText} $$Text_Directory $$INSTDIR
|
2013-01-29 12:30:40 +00:00
|
|
|
$${NSD_GetState} $$CheckBox_Associate $$CheckBox_Associate_State
|
|
|
|
$${NSD_GetState} $$CheckBox_VLC $$CheckBox_VLC_State
|
|
|
|
$${NSD_GetState} $$CheckBox_StartMenuShortcut $$CheckBox_StartMenuShortcut_State
|
|
|
|
$${NSD_GetState} $$CheckBox_DesktopShortcut $$CheckBox_DesktopShortcut_State
|
|
|
|
$${NSD_GetState} $$CheckBox_QuickLaunchShortcut $$CheckBox_QuickLaunchShortcut_State
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function DirectoryBrowseDialog
|
|
|
|
nsDialogs::SelectFolderDialog $$(^DirBrowseText)
|
|
|
|
Pop $$Directory
|
|
|
|
$${If} $$Directory != error
|
|
|
|
StrCpy $$INSTDIR $$Directory
|
|
|
|
$${NSD_SetText} $$Text_Directory $$INSTDIR
|
|
|
|
Call DriveSpace
|
|
|
|
$${NSD_SetText} $$Label_Space "$$(^SpaceAvailable)$$AvailibleSpaceGiB.$$AvailibleSpaceGB"
|
|
|
|
$${EndIf}
|
|
|
|
Abort
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function GetSize
|
2013-01-29 18:19:32 +00:00
|
|
|
StrCpy $$Size "$totalSize"
|
|
|
|
IntOp $$Size $$Size / 1024
|
2013-01-29 12:30:40 +00:00
|
|
|
IntFmt $$SizeHex "0x%08X" $$Size
|
|
|
|
IntOp $$Size $$Size / 1024
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
;Calculates Free Space on HDD
|
|
|
|
Function DriveSpace
|
|
|
|
StrCpy $$Drive $$INSTDIR 1
|
|
|
|
$${DriveSpace} "$$Drive:\" "/D=F /S=M" $$AvailibleSpace
|
|
|
|
IntOp $$AvailibleSpaceGiB $$AvailibleSpace / 1024
|
|
|
|
IntOp $$AvailibleSpace $$AvailibleSpace % 1024
|
|
|
|
IntOp $$AvailibleSpace $$AvailibleSpace / 102
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function InstallOptions
|
|
|
|
$${If} $$CheckBox_Associate_State == $${BST_CHECKED}
|
|
|
|
Call Associate
|
|
|
|
DetailPrint "Associated Syncplay with multimedia files"
|
|
|
|
$${EndIf}
|
|
|
|
|
|
|
|
$${If} $$CheckBox_StartMenuShortcut_State == $${BST_CHECKED}
|
|
|
|
CreateDirectory $$SMPROGRAMS\Syncplay
|
|
|
|
CreateShortCut "$$SMPROGRAMS\Syncplay\Syncplay.lnk" "$$INSTDIR\Syncplay.exe" ""
|
|
|
|
CreateShortCut "$$SMPROGRAMS\Syncplay\Uninstall.lnk" "$$INSTDIR\Uninstall.exe" ""
|
|
|
|
WriteINIStr "$$SMPROGRAMS\Syncplay\SyncplayWebsite.url" "InternetShortcut" "URL" "http://syncplay.pl"
|
|
|
|
$${EndIf}
|
|
|
|
|
|
|
|
$${If} $$CheckBox_DesktopShortcut_State == $${BST_CHECKED}
|
|
|
|
CreateShortCut "$$DESKTOP\Syncplay.lnk" "$$INSTDIR\Syncplay.exe" ""
|
|
|
|
$${EndIf}
|
|
|
|
|
|
|
|
$${If} $$CheckBox_QuickLaunchShortcut_State == $${BST_CHECKED}
|
|
|
|
CreateShortCut "$$QUICKLAUNCH\Syncplay.lnk" "$$INSTDIR\Syncplay.exe" ""
|
|
|
|
$${EndIf}
|
|
|
|
|
|
|
|
$${If} $$CheckBox_VLC_State == $${BST_CHECKED}
|
2013-01-29 18:35:11 +00:00
|
|
|
ReadRegStr $$VLC_Directory HKLM "Software\VideoLAN\VLC" "InstallDir"
|
2013-01-29 12:30:40 +00:00
|
|
|
SetOutPath $$VLC_Directory\lua\intf
|
|
|
|
File resources\syncplay.lua
|
|
|
|
$${EndIf}
|
|
|
|
FunctionEnd
|
|
|
|
|
2013-01-15 18:27:21 +00:00
|
|
|
;Associates extensions with Syncplay
|
|
|
|
Function Associate
|
2013-01-29 19:08:43 +00:00
|
|
|
!insertmacro ASSOCIATE avi
|
|
|
|
!insertmacro ASSOCIATE mpg
|
|
|
|
!insertmacro ASSOCIATE mpeg
|
|
|
|
!insertmacro ASSOCIATE mpe
|
|
|
|
!insertmacro ASSOCIATE m1v
|
|
|
|
!insertmacro ASSOCIATE m2v
|
|
|
|
!insertmacro ASSOCIATE mpv2
|
|
|
|
!insertmacro ASSOCIATE mp2v
|
|
|
|
!insertmacro ASSOCIATE mkv
|
|
|
|
!insertmacro ASSOCIATE mp4
|
|
|
|
!insertmacro ASSOCIATE m4v
|
|
|
|
!insertmacro ASSOCIATE mp4v
|
|
|
|
!insertmacro ASSOCIATE 3gp
|
|
|
|
!insertmacro ASSOCIATE 3gpp
|
|
|
|
!insertmacro ASSOCIATE 3g2
|
|
|
|
!insertmacro ASSOCIATE 3pg2
|
|
|
|
!insertmacro ASSOCIATE flv
|
|
|
|
!insertmacro ASSOCIATE f4v
|
|
|
|
!insertmacro ASSOCIATE rm
|
|
|
|
!insertmacro ASSOCIATE wmv
|
|
|
|
!insertmacro ASSOCIATE swf
|
|
|
|
!insertmacro ASSOCIATE rmvb
|
|
|
|
!insertmacro ASSOCIATE divx
|
|
|
|
!insertmacro ASSOCIATE amv
|
2013-01-15 18:27:21 +00:00
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function WriteRegistry
|
2013-01-29 12:30:40 +00:00
|
|
|
Call GetSize
|
2013-01-15 18:27:21 +00:00
|
|
|
WriteRegStr HKLM SOFTWARE\Syncplay "Install_Dir" "$$INSTDIR"
|
|
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syncplay" "DisplayName" "Syncplay"
|
2013-01-29 12:30:40 +00:00
|
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syncplay" "InstallLocation" "$$INSTDIR"
|
2013-01-15 18:27:21 +00:00
|
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syncplay" "UninstallString" '"$$INSTDIR\uninstall.exe"'
|
2013-01-26 21:10:28 +00:00
|
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syncplay" "DisplayIcon" "$$INSTDIR\resources\icon.ico"
|
2013-01-15 18:27:21 +00:00
|
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syncplay" "Publisher" "Syncplay"
|
2013-01-26 21:10:28 +00:00
|
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syncplay" "DisplayVersion" "$version"
|
2013-01-15 18:27:21 +00:00
|
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syncplay" "URLInfoAbout" "http://syncplay.pl/"
|
|
|
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syncplay" "NoModify" 1
|
|
|
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syncplay" "NoRepair" 1
|
2013-01-29 12:30:40 +00:00
|
|
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syncplay" "EstimatedSize" "$$SizeHex"
|
2013-01-15 18:27:21 +00:00
|
|
|
FunctionEnd
|
|
|
|
|
2013-01-29 14:15:40 +00:00
|
|
|
Function un.installConfirm
|
|
|
|
nsDialogs::Create 1018
|
|
|
|
Pop $$Uninst_Dialog
|
|
|
|
|
|
|
|
$${NSD_CreateIcon} 0u 1u 22u 20u ""
|
|
|
|
Pop $$Uninst_Icon
|
|
|
|
$${NSD_SetIconFromInstaller} $$Uninst_Icon $$Uninst_Icon_Handle
|
|
|
|
|
|
|
|
$${NSD_CreateLabel} 0u 45u 55u 8u "$$(^UninstallingSubText)"
|
|
|
|
Pop $$Uninst_Label_Directory
|
|
|
|
|
|
|
|
$${NSD_CreateLabel} 25u 0u 241u 34u "$$(^UninstallingText)"
|
|
|
|
Pop $$Uninst_Label_Text
|
|
|
|
|
|
|
|
ReadRegStr $$INSTDIR HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syncplay" "InstallLocation"
|
|
|
|
$${NSD_CreateText} 56u 43u 209u 12u "$$INSTDIR"
|
|
|
|
Pop $$Uninst_Text_Directory
|
|
|
|
EnableWindow $$Uninst_Text_Directory 0
|
|
|
|
|
|
|
|
$${NSD_CreateCheckBox} 0u 60u 250u 10u "$$(^UninstConfig)"
|
|
|
|
Pop $$Uninst_CheckBox_Config
|
|
|
|
|
|
|
|
|
|
|
|
nsDialogs::Show
|
|
|
|
$${NSD_FreeIcon} $$Uninst_Icon_Handle
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function un.installConfirmLeave
|
|
|
|
$${NSD_GetState} $$Uninst_CheckBox_Config $$Uninst_CheckBox_Config_State
|
|
|
|
FunctionEnd
|
|
|
|
|
2013-01-15 18:27:21 +00:00
|
|
|
Function un.AssociateDel
|
2013-01-29 19:08:43 +00:00
|
|
|
!insertmacro UNASSOCIATE avi
|
|
|
|
!insertmacro UNASSOCIATE mpg
|
|
|
|
!insertmacro UNASSOCIATE mpeg
|
|
|
|
!insertmacro UNASSOCIATE mpe
|
|
|
|
!insertmacro UNASSOCIATE m1v
|
|
|
|
!insertmacro UNASSOCIATE m2v
|
|
|
|
!insertmacro UNASSOCIATE mpv2
|
|
|
|
!insertmacro UNASSOCIATE mp2v
|
|
|
|
!insertmacro UNASSOCIATE mkv
|
|
|
|
!insertmacro UNASSOCIATE mp4
|
|
|
|
!insertmacro UNASSOCIATE m4v
|
|
|
|
!insertmacro UNASSOCIATE mp4v
|
|
|
|
!insertmacro UNASSOCIATE 3gp
|
|
|
|
!insertmacro UNASSOCIATE 3gpp
|
|
|
|
!insertmacro UNASSOCIATE 3g2
|
|
|
|
!insertmacro UNASSOCIATE 3pg2
|
|
|
|
!insertmacro UNASSOCIATE flv
|
|
|
|
!insertmacro UNASSOCIATE f4v
|
|
|
|
!insertmacro UNASSOCIATE rm
|
|
|
|
!insertmacro UNASSOCIATE wmv
|
|
|
|
!insertmacro UNASSOCIATE swf
|
|
|
|
!insertmacro UNASSOCIATE rmvb
|
|
|
|
!insertmacro UNASSOCIATE divx
|
|
|
|
!insertmacro UNASSOCIATE amv
|
2013-01-15 18:27:21 +00:00
|
|
|
FunctionEnd
|
|
|
|
|
2013-01-29 12:30:40 +00:00
|
|
|
Function un.InstallOptions
|
|
|
|
Delete $$SMPROGRAMS\Syncplay\Syncplay.lnk
|
|
|
|
Delete $$SMPROGRAMS\Syncplay\Uninstall.lnk
|
|
|
|
Delete $$SMPROGRAMS\Syncplay\SyncplayWebsite.url
|
|
|
|
RMDir $$SMPROGRAMS\Syncplay
|
|
|
|
Delete $$DESKTOP\Syncplay.lnk
|
|
|
|
Delete $$QUICKLAUNCH\Syncplay.lnk
|
2013-01-29 18:35:11 +00:00
|
|
|
ReadRegStr $$VLC_Directory HKLM "Software\VideoLAN\VLC" "InstallDir"
|
2013-01-29 12:30:40 +00:00
|
|
|
Delete $$VLC_Directory\lua\intf\syncplay.lua
|
2013-01-15 18:27:21 +00:00
|
|
|
FunctionEnd
|
2013-01-29 12:30:40 +00:00
|
|
|
|
2013-01-29 18:19:32 +00:00
|
|
|
Section "Install"
|
2013-01-15 18:27:21 +00:00
|
|
|
SetOverwrite on
|
|
|
|
SetOutPath $$INSTDIR
|
|
|
|
WriteUninstaller uninstall.exe
|
|
|
|
|
2013-01-16 14:00:57 +00:00
|
|
|
$installFiles
|
2013-01-26 21:10:28 +00:00
|
|
|
|
2013-01-29 12:30:40 +00:00
|
|
|
Call InstallOptions
|
2013-01-26 21:10:28 +00:00
|
|
|
Call WriteRegistry
|
2013-01-15 18:27:21 +00:00
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
Section "Uninstall"
|
|
|
|
Call un.AssociateDel
|
2013-01-29 12:30:40 +00:00
|
|
|
Call un.InstallOptions
|
2013-01-26 19:30:43 +00:00
|
|
|
$uninstallFiles
|
2013-01-15 18:27:21 +00:00
|
|
|
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syncplay"
|
|
|
|
DeleteRegKey HKLM SOFTWARE\Syncplay
|
|
|
|
Delete $$INSTDIR\uninstall.exe
|
2013-01-26 21:17:40 +00:00
|
|
|
RMDir $$INSTDIR\resources
|
|
|
|
RMDir $$INSTDIR\lib
|
2013-01-29 14:15:40 +00:00
|
|
|
RMDir $$INSTDIR
|
|
|
|
|
|
|
|
$${If} $$Uninst_CheckBox_Config_State == $${BST_CHECKED}
|
|
|
|
Delete $$APPDATA\.syncplay
|
|
|
|
$${EndIf}
|
2013-01-15 18:27:21 +00:00
|
|
|
SectionEnd
|
|
|
|
"""
|
|
|
|
|
|
|
|
class NSISScript(object):
|
|
|
|
def create(self):
|
2013-01-29 18:19:32 +00:00
|
|
|
fileList, totalSize = self.getBuildDirContents(OUT_DIR)
|
|
|
|
print "Total size eq: {}".format(totalSize)
|
2013-01-16 14:00:57 +00:00
|
|
|
installFiles = self.prepareInstallListTemplate(fileList)
|
|
|
|
uninstallFiles = self.prepareDeleteListTemplate(fileList)
|
|
|
|
|
2013-01-15 18:27:21 +00:00
|
|
|
if(os.path.isfile(SETUP_SCRIPT_PATH)):
|
|
|
|
raise RuntimeError("Cannot create setup script, file exists at {}".format(SETUP_SCRIPT_PATH))
|
2013-01-16 14:00:57 +00:00
|
|
|
contents = Template(NSIS_SCRIPT_TEMPLATE).substitute(
|
|
|
|
version = syncplay.version,
|
|
|
|
uninstallFiles = uninstallFiles,
|
|
|
|
installFiles = installFiles,
|
2013-01-29 18:19:32 +00:00
|
|
|
totalSize = totalSize,
|
2013-01-16 14:00:57 +00:00
|
|
|
)
|
2013-01-15 18:27:21 +00:00
|
|
|
with open(SETUP_SCRIPT_PATH, "w") as outfile:
|
|
|
|
outfile.write(contents)
|
|
|
|
|
|
|
|
def compile(self):
|
2013-01-29 18:19:32 +00:00
|
|
|
if(not os.path.isfile(NSIS_COMPILE)):
|
|
|
|
return "makensis.exe not found, won't create the installer"
|
2013-01-15 18:27:21 +00:00
|
|
|
subproc = subprocess.Popen([NSIS_COMPILE, SETUP_SCRIPT_PATH], env=os.environ)
|
|
|
|
subproc.communicate()
|
|
|
|
retcode = subproc.returncode
|
|
|
|
os.remove(SETUP_SCRIPT_PATH)
|
|
|
|
if retcode:
|
|
|
|
raise RuntimeError("NSIS compilation return code: %d" % retcode)
|
2013-01-16 14:00:57 +00:00
|
|
|
|
|
|
|
def getBuildDirContents(self, path):
|
|
|
|
fileList = {}
|
2013-01-29 18:19:32 +00:00
|
|
|
totalSize = 0
|
2013-01-16 14:00:57 +00:00
|
|
|
for root, _, files in os.walk(path):
|
2013-01-29 18:19:32 +00:00
|
|
|
totalSize += sum(os.path.getsize(os.path.join(root, file_)) for file_ in files)
|
2013-01-16 14:00:57 +00:00
|
|
|
for file_ in files:
|
|
|
|
new_root = root.replace(OUT_DIR, "").strip("\\")
|
|
|
|
if(not fileList.has_key(new_root)):
|
|
|
|
fileList[new_root] = []
|
|
|
|
fileList[new_root].append(file_)
|
2013-01-29 18:19:32 +00:00
|
|
|
return fileList, totalSize
|
2013-01-16 14:00:57 +00:00
|
|
|
|
|
|
|
def prepareInstallListTemplate(self, fileList):
|
|
|
|
create = []
|
|
|
|
for dir_ in fileList.iterkeys():
|
|
|
|
create.append('SetOutPath "$INSTDIR\\{}"'.format(dir_))
|
|
|
|
for file_ in fileList[dir_]:
|
|
|
|
create.append('FILE "{}\\{}\\{}"'.format(OUT_DIR, dir_, file_))
|
|
|
|
return "\n".join(create)
|
|
|
|
|
|
|
|
def prepareDeleteListTemplate(self, fileList):
|
|
|
|
delete = []
|
|
|
|
for dir_ in fileList.iterkeys():
|
|
|
|
for file_ in fileList[dir_]:
|
|
|
|
delete.append('DELETE "$INSTDIR\\{}\\{}"'.format(dir_, file_))
|
|
|
|
delete.append('RMdir "$INSTDIR\\{}"'.format(file_))
|
|
|
|
return "\n".join(delete)
|
|
|
|
|
2013-01-15 18:27:21 +00:00
|
|
|
class build_installer(py2exe):
|
|
|
|
def run(self):
|
|
|
|
py2exe.run(self)
|
|
|
|
script = NSISScript()
|
|
|
|
script.create()
|
|
|
|
print "*** compiling the NSIS setup script***"
|
|
|
|
script.compile()
|
|
|
|
print "*** DONE ***"
|
|
|
|
|
|
|
|
|
2012-10-12 16:37:12 +00:00
|
|
|
common_info = dict(
|
2012-10-15 18:33:24 +00:00
|
|
|
name='Syncplay',
|
|
|
|
version=syncplay.version,
|
2012-12-26 16:03:57 +00:00
|
|
|
author='Uriziel',
|
|
|
|
author_email='urizieli@gmail.com',
|
2012-10-15 18:33:24 +00:00
|
|
|
description='Syncplay',
|
2012-10-12 16:37:12 +00:00
|
|
|
)
|
2013-01-15 18:27:21 +00:00
|
|
|
|
2012-10-12 16:37:12 +00:00
|
|
|
info = dict(
|
|
|
|
common_info,
|
2012-12-30 13:07:07 +00:00
|
|
|
console=[{"script":"syncplayClient.py", "icon_resources":[(1, "resources\\icon.ico")], 'dest_base': "Syncplay"}, 'syncplayServer.py'],
|
2012-10-15 18:33:24 +00:00
|
|
|
options={'py2exe': {
|
2013-01-16 14:00:57 +00:00
|
|
|
'dist_dir': OUT_DIR,
|
2013-05-28 20:50:42 +00:00
|
|
|
'packages': 'PySide.QtUiTools',
|
2013-06-01 18:00:47 +00:00
|
|
|
'includes': 'twisted, sys, encodings, datetime, os, time, math, PySide',
|
2013-03-10 15:16:43 +00:00
|
|
|
'excludes': 'venv, _ssl, doctest, pdb, unittest, win32clipboard, win32event, win32file, win32pdh, win32security, win32trace, win32ui, winxpgui, win32pipe, win32process',
|
2013-05-28 20:50:42 +00:00
|
|
|
'dll_excludes': 'msvcr71.dll, MSVCP90.dll',
|
2012-10-12 16:37:12 +00:00
|
|
|
'optimize': 2,
|
|
|
|
'compressed': 1
|
|
|
|
}
|
2012-12-30 13:07:07 +00:00
|
|
|
},
|
2013-06-01 18:00:47 +00:00
|
|
|
data_files = [("resources", ["resources/icon.ico","resources/syncplay.png","resources/accept.png","resources/folder_explore.png","resources/help.png"])],
|
2012-12-30 13:07:07 +00:00
|
|
|
zipfile = "lib/libsync",
|
2013-01-15 18:27:21 +00:00
|
|
|
cmdclass = {"py2exe": build_installer},
|
2012-10-12 16:37:12 +00:00
|
|
|
)
|
|
|
|
|
2013-01-15 18:27:21 +00:00
|
|
|
sys.argv.extend(['py2exe', '-p win32com ', '-i twisted.web.resource'])
|
2012-10-12 16:37:12 +00:00
|
|
|
setup(**info)
|
2013-06-01 18:00:47 +00:00
|
|
|
|