2018-07-20 17:21:52 +00:00
#!/usr/bin/env python3
2012-10-12 16:37:12 +00:00
#coding:utf8
2015-01-26 00:47:11 +00:00
2018-07-23 21:08:44 +00:00
# *** TROUBLESHOOTING ***
# 1) If you get the error "ImportError: No module named zope.interface" then add an empty __init__.py file to the PYTHONDIR/Lib/site-packages/zope directory
# 2) It is expected that you will have NSIS 3 NSIS from http://nsis.sourceforge.net installed.
2015-01-26 00:47:11 +00:00
2018-07-23 21:08:44 +00:00
import codecs
import sys
2018-04-24 14:12:59 +00:00
# try:
# if (sys.version_info.major != 2) or (sys.version_info.minor < 7):
# raise Exception("You must build Syncplay with Python 2.7!")
# except AttributeError:
# import warnings
# warnings.warn("You must build Syncplay with Python 2.7!")
2014-08-03 20:06:40 +00:00
2019-05-06 21:08:35 +00:00
from glob import glob
2018-07-23 21:08:44 +00:00
import os
import subprocess
from string import Template
2012-12-30 13:07:07 +00:00
from distutils . core import setup
2018-04-24 14:30:03 +00:00
try :
from py2exe . build_exe import py2exe
except ImportError :
2018-06-18 15:02:03 +00:00
from py2exe . distutils_buildexe import py2exe
2012-10-12 16:37:12 +00:00
import syncplay
2018-07-23 20:32:47 +00:00
from syncplay . messages import getMissingStrings
2018-07-23 21:08:44 +00:00
2014-11-30 17:58:03 +00:00
missingStrings = getMissingStrings ( )
2019-12-30 12:56:27 +00:00
if missingStrings is not None and missingStrings != " " :
2014-11-30 17:58:03 +00:00
import warnings
warnings . warn ( " MISSING/UNUSED STRINGS DETECTED: \n {} " . format ( missingStrings ) )
2017-07-02 13:02:32 +00:00
def get_nsis_path ( ) :
bin_name = " makensis.exe "
2018-04-23 22:44:19 +00:00
from winreg import HKEY_LOCAL_MACHINE as HKLM
from winreg import KEY_READ , KEY_WOW64_32KEY , OpenKey , QueryValueEx
2017-07-02 13:02:32 +00:00
try :
nsisreg = OpenKey ( HKLM , " Software \\ NSIS " , 0 , KEY_READ | KEY_WOW64_32KEY )
if QueryValueEx ( nsisreg , " VersionMajor " ) [ 0 ] > = 3 :
return " {} \\ {} " . format ( QueryValueEx ( nsisreg , " " ) [ 0 ] , bin_name )
else :
raise Exception ( " You must install NSIS 3 or later. " )
except WindowsError :
return bin_name
2018-07-23 21:08:44 +00:00
2017-07-02 13:02:32 +00:00
NSIS_COMPILE = get_nsis_path ( )
2017-10-07 20:02:59 +00:00
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 "
2022-07-31 15:35:33 +00:00
LoadLanguageFile " $$ {NSISDIR} \ Contrib \ Language files \ Esperanto.nlf "
2013-01-15 18:27:21 +00:00
LoadLanguageFile " $$ {NSISDIR} \ Contrib \ Language files \ Polish.nlf "
2014-10-14 11:56:08 +00:00
LoadLanguageFile " $$ {NSISDIR} \ Contrib \ Language files \ Russian.nlf "
2014-11-29 15:01:45 +00:00
LoadLanguageFile " $$ {NSISDIR} \ Contrib \ Language files \ German.nlf "
2018-02-09 19:14:37 +00:00
LoadLanguageFile " $$ {NSISDIR} \ Contrib \ Language files \ Italian.nlf "
2019-02-27 10:04:28 +00:00
LoadLanguageFile " $$ {NSISDIR} \ Contrib \ Language files \ Spanish.nlf "
2020-04-19 17:56:57 +00:00
LoadLanguageFile " $$ {NSISDIR} \ Contrib \ Language files \ PortugueseBR.nlf "
2020-06-18 20:17:25 +00:00
LoadLanguageFile " $$ {NSISDIR} \ Contrib \ Language files \ Portuguese.nlf "
2020-11-29 17:57:56 +00:00
LoadLanguageFile " $$ {NSISDIR} \ Contrib \ Language files \ Turkish.nlf "
2021-12-21 15:39:57 +00:00
LoadLanguageFile " $$ {NSISDIR} \ Contrib \ Language files \ French.nlf "
2022-02-12 13:44:31 +00:00
LoadLanguageFile " $$ {NSISDIR} \ Contrib \ Language files \ SimpChinese.nlf "
2021-12-21 15:39:57 +00:00
2016-12-03 20:52:02 +00:00
Unicode true
2013-01-26 20:37:51 +00:00
Name " Syncplay $version "
2017-12-25 20:46:44 +00:00
OutFile " Syncplay-$version-Setup.exe "
2013-01-15 18:27:21 +00:00
InstallDir $ $ PROGRAMFILES \Syncplay
RequestExecutionLevel admin
2019-03-10 23:09:06 +00:00
ManifestDPIAware false
2013-01-15 18:27:21 +00:00
XPStyle on
2019-04-13 13:39:55 +00:00
Icon syncplay \resources \icon . ico ; Change DIR
2013-01-15 18:27:21 +00:00
SetCompressor / SOLID lzma
2014-11-29 13:56:26 +00:00
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 "
2014-11-29 13:56:26 +00:00
2022-07-31 15:35:33 +00:00
VIAddVersionKey / LANG = $ $ { LANG_ESPERANTO } " ProductName " " Syncplay "
VIAddVersionKey / LANG = $ $ { LANG_ESPERANTO } " FileVersion " " $version.0 "
VIAddVersionKey / LANG = $ $ { LANG_ESPERANTO } " LegalCopyright " " Syncplay "
VIAddVersionKey / LANG = $ $ { LANG_ESPERANTO } " FileDescription " " Syncplay "
2013-01-15 18:27:21 +00:00
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 "
2014-11-29 13:56:26 +00:00
2014-10-14 11:56:08 +00:00
VIAddVersionKey / LANG = $ $ { LANG_RUSSIAN } " ProductName " " Syncplay "
VIAddVersionKey / LANG = $ $ { LANG_RUSSIAN } " FileVersion " " $version.0 "
VIAddVersionKey / LANG = $ $ { LANG_RUSSIAN } " LegalCopyright " " Syncplay "
VIAddVersionKey / LANG = $ $ { LANG_RUSSIAN } " FileDescription " " Syncplay "
2018-07-23 21:08:44 +00:00
2018-02-09 19:14:37 +00:00
VIAddVersionKey / LANG = $ $ { LANG_ITALIAN } " ProductName " " Syncplay "
VIAddVersionKey / LANG = $ $ { LANG_ITALIAN } " FileVersion " " $version.0 "
VIAddVersionKey / LANG = $ $ { LANG_ITALIAN } " LegalCopyright " " Syncplay "
VIAddVersionKey / LANG = $ $ { LANG_ITALIAN } " FileDescription " " Syncplay "
2014-11-29 13:56:26 +00:00
2019-02-27 10:04:28 +00:00
VIAddVersionKey / LANG = $ $ { LANG_SPANISH } " ProductName " " Syncplay "
VIAddVersionKey / LANG = $ $ { LANG_SPANISH } " FileVersion " " $version.0 "
VIAddVersionKey / LANG = $ $ { LANG_SPANISH } " LegalCopyright " " Syncplay "
VIAddVersionKey / LANG = $ $ { LANG_SPANISH } " FileDescription " " Syncplay "
2020-04-19 17:56:57 +00:00
VIAddVersionKey / LANG = $ $ { LANG_PORTUGUESEBR } " ProductName " " Syncplay "
VIAddVersionKey / LANG = $ $ { LANG_PORTUGUESEBR } " FileVersion " " $version.0 "
VIAddVersionKey / LANG = $ $ { LANG_PORTUGUESEBR } " LegalCopyright " " Syncplay "
VIAddVersionKey / LANG = $ $ { LANG_PORTUGUESEBR } " FileDescription " " Syncplay "
2020-06-18 20:17:25 +00:00
VIAddVersionKey / LANG = $ $ { LANG_PORTUGUESE } " ProductName " " Syncplay "
VIAddVersionKey / LANG = $ $ { LANG_PORTUGUESE } " FileVersion " " $version.0 "
VIAddVersionKey / LANG = $ $ { LANG_PORTUGUESE } " LegalCopyright " " Syncplay "
VIAddVersionKey / LANG = $ $ { LANG_PORTUGUESE } " FileDescription " " Syncplay "
2020-11-29 17:57:56 +00:00
VIAddVersionKey / LANG = $ $ { LANG_TURKISH } " ProductName " " Syncplay "
VIAddVersionKey / LANG = $ $ { LANG_TURKISH } " FileVersion " " $version.0 "
VIAddVersionKey / LANG = $ $ { LANG_TURKISH } " LegalCopyright " " Syncplay "
VIAddVersionKey / LANG = $ $ { LANG_TURKISH } " FileDescription " " Syncplay "
2021-12-21 15:39:57 +00:00
VIAddVersionKey / LANG = $ $ { LANG_FRENCH } " ProductName " " Syncplay "
VIAddVersionKey / LANG = $ $ { LANG_FRENCH } " FileVersion " " $version.0 "
VIAddVersionKey / LANG = $ $ { LANG_FRENCH } " LegalCopyright " " Syncplay "
VIAddVersionKey / LANG = $ $ { LANG_FRENCH } " FileDescription " " Syncplay "
2022-02-12 13:44:31 +00:00
VIAddVersionKey / LANG = $ $ { LANG_SIMPCHINESE } " ProductName " " Syncplay "
VIAddVersionKey / LANG = $ $ { LANG_SIMPCHINESE } " FileVersion " " $version.0 "
VIAddVersionKey / LANG = $ $ { LANG_SIMPCHINESE } " LegalCopyright " " Syncplay "
VIAddVersionKey / LANG = $ $ { LANG_SIMPCHINESE } " FileDescription " " Syncplay "
2021-03-07 19:25:23 +00:00
2014-06-29 19:56:18 +00:00
LangString ^ SyncplayLanguage $ $ { LANG_ENGLISH } " en "
2013-01-29 12:30:40 +00:00
LangString ^ Associate $ $ { LANG_ENGLISH } " Associate Syncplay with multimedia files. "
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 "
2015-01-03 13:58:18 +00:00
LangString ^ AutomaticUpdates $ $ { LANG_ENGLISH } " Check for updates automatically "
2013-01-29 14:15:40 +00:00
LangString ^ UninstConfig $ $ { LANG_ENGLISH } " Delete configuration file. "
2014-11-29 13:56:26 +00:00
2022-07-31 15:35:33 +00:00
LangString ^ SyncplayLanguage $ $ { LANG_ESPERANTO } " eo "
LangString ^ Associate $ $ { LANG_ESPERANTO } " Asocii vidaŭdaĵajn dosierojn kun Syncplay. "
LangString ^ Shortcut $ $ { LANG_ESPERANTO } " Krei mallongigojn en la jenaj lokoj: "
LangString ^ StartMenu $ $ { LANG_ESPERANTO } " Start-menuo "
LangString ^ Desktop $ $ { LANG_ESPERANTO } " Labortablo "
LangString ^ QuickLaunchBar $ $ { LANG_ESPERANTO } " Tujbreto "
LangString ^ AutomaticUpdates $ $ { LANG_ESPERANTO } " Kontroli ĝisdatigojn memage "
LangString ^ UninstConfig $ $ { LANG_ESPERANTO } " Forigi dosieron kun agordaro. "
2014-06-29 19:56:18 +00:00
LangString ^ SyncplayLanguage $ $ { LANG_POLISH } " pl "
2013-01-29 12:30:40 +00:00
LangString ^ Associate $ $ { LANG_POLISH } " Skojarz Syncplaya z multimediami "
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. "
2014-11-29 13:56:26 +00:00
2014-10-14 11:56:08 +00:00
LangString ^ SyncplayLanguage $ $ { LANG_RUSSIAN } " ru "
LangString ^ Associate $ $ { LANG_RUSSIAN } " Ассоциировать Syncplay с видеофайлами "
LangString ^ Shortcut $ $ { LANG_RUSSIAN } " Создать ярлыки: "
LangString ^ StartMenu $ $ { LANG_RUSSIAN } " в меню Пуск "
LangString ^ Desktop $ $ { LANG_RUSSIAN } " на рабочем столе "
LangString ^ QuickLaunchBar $ $ { LANG_RUSSIAN } " в меню быстрого запуска "
2015-01-03 13:58:18 +00:00
LangString ^ AutomaticUpdates $ $ { LANG_RUSSIAN } " Проверять обновления автоматически " ; TODO : Confirm Russian translation ( " Check for updates automatically " )
2014-10-14 11:56:08 +00:00
LangString ^ UninstConfig $ $ { LANG_RUSSIAN } " Удалить файл настроек. "
2014-11-29 13:56:26 +00:00
2014-11-29 15:01:45 +00:00
LangString ^ SyncplayLanguage $ $ { LANG_GERMAN } " de "
2015-10-27 16:17:12 +00:00
LangString ^ Associate $ $ { LANG_GERMAN } " Syncplay als Standardprogramm für Multimedia-Dateien verwenden. "
2014-11-29 15:01:45 +00:00
LangString ^ Shortcut $ $ { LANG_GERMAN } " Erstelle Verknüpfungen an folgenden Orten: "
2014-11-29 15:54:57 +00:00
LangString ^ StartMenu $ $ { LANG_GERMAN } " Startmenü "
2014-11-29 15:01:45 +00:00
LangString ^ Desktop $ $ { LANG_GERMAN } " Desktop "
LangString ^ QuickLaunchBar $ $ { LANG_GERMAN } " Schnellstartleiste "
2015-10-06 15:54:11 +00:00
LangString ^ AutomaticUpdates $ $ { LANG_GERMAN } " Automatisch nach Updates suchen " ;
2014-11-29 15:01:45 +00:00
LangString ^ UninstConfig $ $ { LANG_GERMAN } " Konfigurationsdatei löschen. "
2018-07-23 21:08:44 +00:00
2018-02-09 19:14:37 +00:00
LangString ^ SyncplayLanguage $ $ { LANG_ITALIAN } " it "
LangString ^ Associate $ $ { LANG_ITALIAN } " Associa Syncplay con i file multimediali. "
LangString ^ Shortcut $ $ { LANG_ITALIAN } " Crea i collegamenti nei percorsi seguenti: "
LangString ^ StartMenu $ $ { LANG_ITALIAN } " Menu Start "
LangString ^ Desktop $ $ { LANG_ITALIAN } " Desktop "
LangString ^ QuickLaunchBar $ $ { LANG_ITALIAN } " Barra di avvio rapido "
LangString ^ AutomaticUpdates $ $ { LANG_ITALIAN } " Controllo automatico degli aggiornamenti "
LangString ^ UninstConfig $ $ { LANG_ITALIAN } " Cancella i file di configurazione. "
2014-11-29 15:01:45 +00:00
2019-02-27 10:04:28 +00:00
LangString ^ SyncplayLanguage $ $ { LANG_SPANISH } " es "
LangString ^ Associate $ $ { LANG_SPANISH } " Asociar Syncplay con archivos multimedia. "
LangString ^ Shortcut $ $ { LANG_SPANISH } " Crear accesos directos en las siguientes ubicaciones: "
LangString ^ StartMenu $ $ { LANG_SPANISH } " Menú de inicio "
LangString ^ Desktop $ $ { LANG_SPANISH } " Escritorio "
LangString ^ QuickLaunchBar $ $ { LANG_SPANISH } " Barra de acceso rápido "
LangString ^ AutomaticUpdates $ $ { LANG_SPANISH } " Buscar actualizaciones automáticamente "
LangString ^ UninstConfig $ $ { LANG_SPANISH } " Borrar archivo de configuración. "
2020-04-19 17:56:57 +00:00
LangString ^ SyncplayLanguage $ $ { LANG_PORTUGUESEBR } " pt_BR "
LangString ^ Associate $ $ { LANG_PORTUGUESEBR } " Associar Syncplay aos arquivos multimídia. "
LangString ^ Shortcut $ $ { LANG_PORTUGUESEBR } " Criar atalhos nos seguintes locais: "
LangString ^ StartMenu $ $ { LANG_PORTUGUESEBR } " Menu Iniciar "
LangString ^ Desktop $ $ { LANG_PORTUGUESEBR } " Área de trabalho "
LangString ^ QuickLaunchBar $ $ { LANG_PORTUGUESEBR } " Barra de acesso rápido "
LangString ^ AutomaticUpdates $ $ { LANG_PORTUGUESEBR } " Verificar atualizações automaticamente "
LangString ^ UninstConfig $ $ { LANG_PORTUGUESEBR } " Deletar arquivo de configuração. "
2020-06-18 20:17:25 +00:00
LangString ^ SyncplayLanguage $ $ { LANG_PORTUGUESE } " pt_PT "
LangString ^ Associate $ $ { LANG_PORTUGUESE } " Associar Syncplay aos ficheiros multimédia. "
LangString ^ Shortcut $ $ { LANG_PORTUGUESE } " Criar atalhos nos seguintes locais: "
LangString ^ StartMenu $ $ { LANG_PORTUGUESE } " Menu Iniciar "
LangString ^ Desktop $ $ { LANG_PORTUGUESE } " Área de trabalho "
LangString ^ QuickLaunchBar $ $ { LANG_PORTUGUESE } " Barra de acesso rápido "
LangString ^ AutomaticUpdates $ $ { LANG_PORTUGUESE } " Verificar atualizações automaticamente "
LangString ^ UninstConfig $ $ { LANG_PORTUGUESE } " Apagar ficheiro de configuração. "
2020-11-29 17:57:56 +00:00
LangString ^ SyncplayLanguage $ $ { LANG_TURKISH } " tr "
LangString ^ Associate $ $ { LANG_TURKISH } " Syncplay ' i ortam dosyaları yla ilişkilendirin. "
LangString ^ Shortcut $ $ { LANG_TURKISH } " Aşağı daki konumlarda kı sayollar oluşturun: "
LangString ^ StartMenu $ $ { LANG_TURKISH } " Başlangı ç menüsü "
LangString ^ Desktop $ $ { LANG_TURKISH } " Masaüstü "
LangString ^ QuickLaunchBar $ $ { LANG_TURKISH } " Hı zlı Başlatma Çubuğu "
LangString ^ AutomaticUpdates $ $ { LANG_TURKISH } " Güncellemeleri otomatik denetle "
LangString ^ UninstConfig $ $ { LANG_TURKISH } " Yapı landı rma dosyası nı silin. "
2021-12-21 15:39:57 +00:00
LangString ^ SyncplayLanguage $ $ { LANG_FRENCH } " fr "
LangString ^ Associate $ $ { LANG_FRENCH } " Associer Syncplay avec les fichiers multimedias. "
LangString ^ Shortcut $ $ { LANG_FRENCH } " Créer Racourcis pour les chemins suivants: "
LangString ^ StartMenu $ $ { LANG_FRENCH } " Menu Démarrer "
LangString ^ Desktop $ $ { LANG_FRENCH } " Bureau "
LangString ^ QuickLaunchBar $ $ { LANG_FRENCH } " Barre de Lancement Rapide "
LangString ^ AutomaticUpdates $ $ { LANG_FRENCH } " Vérifier automatiquement les mises à jour "
LangString ^ UninstConfig $ $ { LANG_FRENCH } " Supprimer le fichier de configuration. "
2022-02-12 13:44:31 +00:00
LangString ^ SyncplayLanguage $ $ { LANG_SIMPCHINESE } " zh_CN "
LangString ^ Associate $ $ { LANG_SIMPCHINESE } " 将Syncplay与多媒体文件关联。 "
LangString ^ Shortcut $ $ { LANG_SIMPCHINESE } " 在以下位置创建快捷方式: "
LangString ^ StartMenu $ $ { LANG_SIMPCHINESE } " 开始菜单 "
LangString ^ Desktop $ $ { LANG_SIMPCHINESE } " 桌面 "
LangString ^ QuickLaunchBar $ $ { LANG_SIMPCHINESE } " 快速启动栏 "
LangString ^ AutomaticUpdates $ $ { LANG_SIMPCHINESE } " 自动检查更新 "
LangString ^ UninstConfig $ $ { LANG_SIMPCHINESE } " 删除配置文件 "
2020-11-29 17:57:56 +00:00
2014-11-29 15:01:45 +00:00
; Remove text to save space
LangString ^ ClickInstall $ $ { LANG_GERMAN } " "
2013-01-15 18:27:21 +00:00
PageEx license
2019-04-13 13:39:55 +00:00
LicenseData syncplay \resources \license . rtf
2013-01-15 18:27:21 +00:00
PageExEnd
2013-01-29 12:30:40 +00:00
Page custom DirectoryCustom DirectoryCustomLeave
2013-01-15 18:27:21 +00:00
Page instFiles
2014-11-29 13:56:26 +00:00
2013-01-29 14:15:40 +00:00
UninstPage custom un . installConfirm un . installConfirmLeave
2013-01-15 18:27:21 +00:00
UninstPage instFiles
2014-11-29 13:56:26 +00:00
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
2016-07-02 20:00:53 +00:00
; Var CheckBox_Associate
2015-01-03 13:58:18 +00:00
Var CheckBox_AutomaticUpdates
2013-01-29 12:30:40 +00:00
Var CheckBox_StartMenuShortcut
Var CheckBox_DesktopShortcut
Var CheckBox_QuickLaunchShortcut
2016-07-02 20:00:53 +00:00
; Var CheckBox_Associate_State
2015-01-03 13:58:18 +00:00
Var CheckBox_AutomaticUpdates_State
2013-01-29 12:30:40 +00:00
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
2014-11-29 13:56:26 +00:00
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
2014-11-29 13:56:26 +00:00
2013-01-29 12:30:40 +00:00
Var Size
Var SizeHex
Var AvailibleSpace
Var AvailibleSpaceGiB
Var Drive
Var VLC_Directory
2014-11-29 13:56:26 +00:00
2016-07-02 20:00:53 +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
2014-11-29 13:56:26 +00:00
2013-01-15 18:27:21 +00:00
! 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
2014-11-29 13:56:26 +00:00
2016-07-02 20:00:53 +00:00
; ! macro ASSOCIATE EXT
; ! insertmacro APP_ASSOCIATE " $$ {EXT} " " Syncplay.$$ {EXT} " " $$INSTDIR \ Syncplay.exe, %1% " \
; " Open with Syncplay " " $$INSTDIR \ Syncplay.exe $$ \" % 1$$ \" "
; ! macroend
2014-11-29 13:56:26 +00:00
2013-01-29 19:08:43 +00:00
! macro UNASSOCIATE EXT
! insertmacro APP_UNASSOCIATE " $$ {EXT} " " Syncplay.$$ {EXT} "
! macroend
2014-11-29 13:56:26 +00:00
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
2014-06-29 17:18:38 +00:00
System : : Call ' kernel32::CreateMutexA(i 0, i 0, t " SyncplayMutex " ) i .r1 ?e '
2013-01-29 12:30:40 +00:00
Pop $ $ R0
StrCmp $ $ R0 0 + 3
MessageBox MB_OK | MB_ICONEXCLAMATION " The installer is already running. "
Abort
2014-06-29 17:18:38 +00:00
2016-07-02 20:00:53 +00:00
; StrCpy $ $ CheckBox_Associate_State $ $ { BST_CHECKED }
2013-01-29 12:30:40 +00:00
StrCpy $ $ CheckBox_StartMenuShortcut_State $ $ { BST_CHECKED }
2014-06-29 17:18:38 +00:00
2013-01-29 18:19:32 +00:00
Call GetSize
2013-01-29 12:30:40 +00:00
Call DriveSpace
2021-10-17 12:40:57 +00:00
$ $ { GetParameters } $ $ 0
ClearErrors
$ $ { GetOptions } $ $ 0 " /LANG= " $ $ 0
$ $ { IfNot } $ $ { Errors }
$ $ { AndIf } $ $ 0 < > 0
StrCpy $ $ LANGUAGE $ $ 0
$ $ { Else }
Call Language
$ $ { EndIf }
2013-01-29 12:30:40 +00:00
FunctionEnd
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
; Language selection dialog
Function Language
Push " "
Push $ $ { LANG_ENGLISH }
Push English
2022-07-31 15:35:33 +00:00
Push $ $ { LANG_ESPERANTO }
Push Esperanto
2022-04-13 19:10:25 +00:00
Push $ $ { LANG_FRENCH }
Push Français
2018-07-23 21:08:44 +00:00
Push $ $ { LANG_RUSSIAN }
2014-11-29 13:56:26 +00:00
Push Русский
2014-11-29 15:01:45 +00:00
Push $ $ { LANG_GERMAN }
Push Deutsch
2018-07-23 21:08:44 +00:00
Push $ $ { LANG_ITALIAN }
2018-02-09 19:14:37 +00:00
Push Italiano
2019-02-27 10:04:28 +00:00
Push $ $ { LANG_SPANISH }
Push Español
2020-04-19 17:56:57 +00:00
Push $ $ { LANG_PORTUGUESEBR }
Push ' Português do Brasil '
2020-06-18 20:17:25 +00:00
Push $ $ { LANG_PORTUGUESE }
Push ' Português de Portugal '
2020-11-29 17:57:56 +00:00
Push $ $ { LANG_TURKISH }
Push ' Türkçe '
2022-02-12 13:44:31 +00:00
Push $ $ { LANG_SIMPCHINESE }
Push ' 简体中文 '
2013-01-29 12:30:40 +00:00
Push A ; A means auto count languages
2014-06-29 19:56:18 +00:00
LangDLL : : LangDialog " Language Selection " " Please select the language of Syncplay and the installer "
2013-01-29 12:30:40 +00:00
Pop $ $ LANGUAGE
StrCmp $ $ LANGUAGE " cancel " 0 + 2
Abort
FunctionEnd
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
Function DirectoryCustom
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
nsDialogs : : Create 1018
Pop $ $ Dialog
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
GetFunctionAddress $ $ R8 DirectoryCustomLeave
nsDialogs : : OnBack $ $ R8
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
$ $ { NSD_CreateIcon } 0 u 0 u 22 u 20 u " "
2013-01-29 14:15:40 +00:00
Pop $ $ Icon_Syncplay
$ $ { NSD_SetIconFromInstaller } $ $ Icon_Syncplay $ $ Icon_Syncplay_Handle
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
$ $ { NSD_CreateLabel } 25 u 0 u 241 u 34 u " $$(^DirText) "
Pop $ $ Label_Text
2014-06-29 17:18:38 +00:00
$ $ { NSD_CreateText } 8 u 38 u 187 u 12 u " $$INSTDIR "
2013-01-29 12:30:40 +00:00
Pop $ $ Text_Directory
$ $ { NSD_SetFocus } $ $ Text_Directory
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
$ $ { NSD_CreateBrowseButton } 202 u 37 u 55 u 14 u " $$(^BrowseBtn) "
Pop $ $ Button_Browse
$ $ { NSD_OnClick } $ $ Button_Browse DirectoryBrowseDialog
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
$ $ { NSD_CreateGroupBox } 1 u 27 u 264 u 30 u " $$(^DirSubText) "
Pop $ $ GroupBox_DirSub
2015-01-03 13:58:18 +00:00
$ $ { NSD_CreateLabel } 0 u 122 u 132 8 u " $$(^SpaceRequired)$$SizeMB "
2013-01-29 12:30:40 +00:00
Pop $ $ Label_Size
2014-06-29 17:18:38 +00:00
2015-01-03 13:58:18 +00:00
$ $ { NSD_CreateLabel } 321 u 122 u 132 8 u " $$(^SpaceAvailable)$$AvailibleSpaceGiB.$$AvailibleSpaceGB "
2013-01-29 12:30:40 +00:00
Pop $ $ Label_Space
2014-06-29 17:18:38 +00:00
2016-07-02 20:00:53 +00:00
; $ $ { NSD_CreateCheckBox } 8 u 59 u 187 u 10 u " $$(^Associate) "
; Pop $ $ CheckBox_Associate
2014-06-29 17:18:38 +00:00
2019-02-02 01:21:56 +00:00
$ $ { NSD_CreateCheckBox } 8 u 72 u 250 u 10 u " $$(^AutomaticUpdates) "
2015-01-03 13:58:18 +00:00
Pop $ $ CheckBox_AutomaticUpdates
$ $ { NSD_Check } $ $ CheckBox_AutomaticUpdates
2019-02-02 01:21:56 +00:00
$ $ { NSD_CreateLabel } 8 u 95 u 187 u 10 u " $$(^Shortcut) "
2013-01-29 12:30:40 +00:00
Pop $ $ Label_Shortcut
2014-06-29 17:18:38 +00:00
2020-11-29 18:04:48 +00:00
$ $ { NSD_CreateCheckbox } 8 u 105 u 70 u 10 u " $$(^StartMenu) "
2013-01-29 12:30:40 +00:00
Pop $ $ CheckBox_StartMenuShortcut
2019-02-02 01:21:56 +00:00
$ $ { NSD_CreateCheckbox } 78 u 105 u 70 u 10 u " $$(^Desktop) "
2013-01-29 12:30:40 +00:00
Pop $ $ CheckBox_DesktopShortcut
2014-06-29 17:18:38 +00:00
2019-02-02 01:21:56 +00:00
$ $ { NSD_CreateCheckbox } 158 u 105 u 130 u 10 u " $$(^QuickLaunchBar) "
2013-01-29 12:30:40 +00:00
Pop $ $ CheckBox_QuickLaunchShortcut
2014-06-29 17:18:38 +00:00
2016-07-02 20:00:53 +00:00
; $ $ { If } $ $ CheckBox_Associate_State == $ $ { BST_CHECKED }
; $ $ { NSD_Check } $ $ CheckBox_Associate
; $ $ { EndIf }
2013-01-29 12:30:40 +00:00
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
$ $ { If } $ $ CheckBox_StartMenuShortcut_State == $ $ { BST_CHECKED }
2018-07-23 21:08:44 +00:00
$ $ { NSD_Check } $ $ CheckBox_StartMenuShortcut
2013-01-29 12:30:40 +00:00
$ $ { EndIf }
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
$ $ { If } $ $ CheckBox_DesktopShortcut_State == $ $ { BST_CHECKED }
2018-07-23 21:08:44 +00:00
$ $ { NSD_Check } $ $ CheckBox_DesktopShortcut
2013-01-29 12:30:40 +00:00
$ $ { EndIf }
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
$ $ { If } $ $ CheckBox_QuickLaunchShortcut_State == $ $ { BST_CHECKED }
2018-07-23 21:08:44 +00:00
$ $ { NSD_Check } $ $ CheckBox_QuickLaunchShortcut
2013-01-29 12:30:40 +00:00
$ $ { EndIf }
2014-06-29 17:18:38 +00:00
2015-01-03 13:58:18 +00:00
$ $ { If } $ $ CheckBox_AutomaticUpdates_State == $ $ { BST_CHECKED }
2018-07-23 21:08:44 +00:00
$ $ { NSD_Check } $ $ CheckBox_AutomaticUpdates
2015-01-03 13:58:18 +00:00
$ $ { EndIf }
2013-01-29 12:30:40 +00:00
nsDialogs : : Show
2013-01-29 14:15:40 +00:00
$ $ { NSD_FreeIcon } $ $ Icon_Syncplay_Handle
2013-01-29 12:30:40 +00:00
FunctionEnd
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
Function DirectoryCustomLeave
2013-01-29 17:49:41 +00:00
$ $ { NSD_GetText } $ $ Text_Directory $ $ INSTDIR
2016-07-02 20:00:53 +00:00
; $ $ { NSD_GetState } $ $ CheckBox_Associate $ $ CheckBox_Associate_State
2015-01-03 13:58:18 +00:00
$ $ { NSD_GetState } $ $ CheckBox_AutomaticUpdates $ $ CheckBox_AutomaticUpdates_State
2013-01-29 12:30:40 +00:00
$ $ { NSD_GetState } $ $ CheckBox_StartMenuShortcut $ $ CheckBox_StartMenuShortcut_State
$ $ { NSD_GetState } $ $ CheckBox_DesktopShortcut $ $ CheckBox_DesktopShortcut_State
$ $ { NSD_GetState } $ $ CheckBox_QuickLaunchShortcut $ $ CheckBox_QuickLaunchShortcut_State
FunctionEnd
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
Function DirectoryBrowseDialog
2014-06-29 17:18:38 +00:00
nsDialogs : : SelectFolderDialog $ $ ( ^ DirBrowseText )
2013-01-29 12:30:40 +00:00
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
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
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
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
; 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
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
Function InstallOptions
2016-07-02 20:00:53 +00:00
; $ $ { If } $ $ CheckBox_Associate_State == $ $ { BST_CHECKED }
; Call Associate
; DetailPrint " Associated Syncplay with multimedia files "
; $ $ { EndIf }
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
$ $ { If } $ $ CheckBox_StartMenuShortcut_State == $ $ { BST_CHECKED }
CreateDirectory $ $ SMPROGRAMS \Syncplay
2019-06-22 22:43:21 +00:00
SetOutPath " $$INSTDIR "
2014-06-29 17:18:38 +00:00
CreateShortCut " $$SMPROGRAMS \ Syncplay \ Syncplay.lnk " " $$INSTDIR \ Syncplay.exe " " "
CreateShortCut " $$SMPROGRAMS \ Syncplay \ Syncplay Server.lnk " " $$INSTDIR \ syncplayServer.exe " " "
2013-01-29 12:30:40 +00:00
CreateShortCut " $$SMPROGRAMS \ Syncplay \ Uninstall.lnk " " $$INSTDIR \ Uninstall.exe " " "
2018-07-17 21:32:49 +00:00
WriteINIStr " $$SMPROGRAMS \ Syncplay \ SyncplayWebsite.url " " InternetShortcut " " URL " " https://syncplay.pl "
2013-01-29 12:30:40 +00:00
$ $ { EndIf }
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
$ $ { If } $ $ CheckBox_DesktopShortcut_State == $ $ { BST_CHECKED }
2019-06-22 22:43:21 +00:00
SetOutPath " $$INSTDIR "
2013-01-29 12:30:40 +00:00
CreateShortCut " $$DESKTOP \ Syncplay.lnk " " $$INSTDIR \ Syncplay.exe " " "
$ $ { EndIf }
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
$ $ { If } $ $ CheckBox_QuickLaunchShortcut_State == $ $ { BST_CHECKED }
2019-06-22 22:43:21 +00:00
SetOutPath " $$INSTDIR "
2013-01-29 12:30:40 +00:00
CreateShortCut " $$QUICKLAUNCH \ Syncplay.lnk " " $$INSTDIR \ Syncplay.exe " " "
$ $ { EndIf }
FunctionEnd
2014-06-29 17:18:38 +00:00
2013-01-15 18:27:21 +00:00
; Associates extensions with Syncplay
2016-07-02 20:00:53 +00:00
; Function Associate
; ! 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 3 gp
; ! insertmacro ASSOCIATE 3 gpp
; ! insertmacro ASSOCIATE 3 g2
; ! insertmacro ASSOCIATE 3 pg2
; ! insertmacro ASSOCIATE flv
; ! insertmacro ASSOCIATE f4v
; ! insertmacro ASSOCIATE rm
; ! insertmacro ASSOCIATE wmv
; ! insertmacro ASSOCIATE swf
; ! insertmacro ASSOCIATE rmvb
; ! insertmacro ASSOCIATE divx
; ! insertmacro ASSOCIATE amv
; FunctionEnd
2014-06-29 17:18:38 +00:00
2013-01-15 18:27:21 +00:00
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 "
2014-06-29 17:18:38 +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 \r esources \ 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 "
2018-03-22 18:05:32 +00:00
WriteRegStr HKLM " Software \ Microsoft \ Windows \ CurrentVersion \ Uninstall \ Syncplay " " URLInfoAbout " " https://syncplay.pl/ "
2013-01-15 18:27:21 +00:00
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 "
2014-06-29 19:56:18 +00:00
WriteINIStr $ $ APPDATA \syncplay . ini general language $ $ ( ^ SyncplayLanguage )
2015-01-03 13:58:18 +00:00
$ $ { If } $ $ CheckBox_AutomaticUpdates_State == $ $ { BST_CHECKED }
WriteINIStr $ $ APPDATA \syncplay . ini general CheckForUpdatesAutomatically " True "
$ $ { Else }
WriteINIStr $ $ APPDATA \syncplay . ini general CheckForUpdatesAutomatically " False "
$ $ { EndIf }
2013-01-15 18:27:21 +00:00
FunctionEnd
2014-06-29 17:18:38 +00:00
2013-01-29 14:15:40 +00:00
Function un . installConfirm
nsDialogs : : Create 1018
Pop $ $ Uninst_Dialog
2014-06-29 17:18:38 +00:00
2013-01-29 14:15:40 +00:00
$ $ { NSD_CreateIcon } 0 u 1 u 22 u 20 u " "
Pop $ $ Uninst_Icon
$ $ { NSD_SetIconFromInstaller } $ $ Uninst_Icon $ $ Uninst_Icon_Handle
2014-06-29 17:18:38 +00:00
2013-01-29 14:15:40 +00:00
$ $ { NSD_CreateLabel } 0 u 45 u 55 u 8 u " $$(^UninstallingSubText) "
Pop $ $ Uninst_Label_Directory
2014-06-29 17:18:38 +00:00
2013-01-29 14:15:40 +00:00
$ $ { NSD_CreateLabel } 25 u 0 u 241 u 34 u " $$(^UninstallingText) "
Pop $ $ Uninst_Label_Text
2014-06-29 17:18:38 +00:00
2013-01-29 14:15:40 +00:00
ReadRegStr $ $ INSTDIR HKLM " Software \ Microsoft \ Windows \ CurrentVersion \ Uninstall \ Syncplay " " InstallLocation "
2014-06-29 17:18:38 +00:00
$ $ { NSD_CreateText } 56 u 43 u 209 u 12 u " $$INSTDIR "
2013-01-29 14:15:40 +00:00
Pop $ $ Uninst_Text_Directory
EnableWindow $ $ Uninst_Text_Directory 0
2014-06-29 17:18:38 +00:00
2013-01-29 14:15:40 +00:00
$ $ { NSD_CreateCheckBox } 0 u 60 u 250 u 10 u " $$(^UninstConfig) "
Pop $ $ Uninst_CheckBox_Config
2014-06-29 17:18:38 +00:00
2013-01-29 14:15:40 +00:00
nsDialogs : : Show
$ $ { NSD_FreeIcon } $ $ Uninst_Icon_Handle
FunctionEnd
2014-06-29 17:18:38 +00:00
2013-01-29 14:15:40 +00:00
Function un . installConfirmLeave
$ $ { NSD_GetState } $ $ Uninst_CheckBox_Config $ $ Uninst_CheckBox_Config_State
FunctionEnd
2014-06-29 17:18:38 +00:00
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 3 gp
! insertmacro UNASSOCIATE 3 gpp
! insertmacro UNASSOCIATE 3 g2
! insertmacro UNASSOCIATE 3 pg2
! insertmacro UNASSOCIATE flv
! insertmacro UNASSOCIATE f4v
! insertmacro UNASSOCIATE rm
! insertmacro UNASSOCIATE wmv
! insertmacro UNASSOCIATE swf
! insertmacro UNASSOCIATE rmvb
! insertmacro UNASSOCIATE divx
2014-06-29 17:18:38 +00:00
! insertmacro UNASSOCIATE amv
2013-01-15 18:27:21 +00:00
FunctionEnd
2014-06-29 17:18:38 +00:00
2013-01-29 12:30:40 +00:00
Function un . InstallOptions
Delete $ $ SMPROGRAMS \Syncplay \Syncplay . lnk
2014-06-29 17:18:38 +00:00
Delete " $$SMPROGRAMS \ Syncplay \ Syncplay Server.lnk "
2013-01-29 12:30:40 +00:00
Delete $ $ SMPROGRAMS \Syncplay \Uninstall . lnk
Delete $ $ SMPROGRAMS \Syncplay \SyncplayWebsite . url
RMDir $ $ SMPROGRAMS \Syncplay
Delete $ $ DESKTOP \Syncplay . lnk
Delete $ $ QUICKLAUNCH \Syncplay . lnk
2014-06-29 17:18:38 +00:00
ReadRegStr $ $ VLC_Directory HKLM " Software \ Microsoft \ Windows \ CurrentVersion \ Uninstall \ Syncplay " " VLCInstallLocation "
IfFileExists " $$VLC_Directory \ lua \ intf \ syncplay.lua " 0 + 2
2013-01-29 12:30:40 +00:00
Delete $ $ VLC_Directory \lua \intf \syncplay . lua
2013-01-15 18:27:21 +00:00
FunctionEnd
2014-11-29 13:56:26 +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
2014-11-29 13:56:26 +00:00
2013-01-16 14:00:57 +00:00
$ installFiles
2014-11-29 13:56:26 +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
2014-11-29 13:56:26 +00:00
2013-01-15 18:27:21 +00:00
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
2014-06-29 17:18:38 +00:00
RMDir $ $ INSTDIR \Syncplay \\resources \lua \intf
RMDir $ $ INSTDIR \Syncplay \\resources \lua
RMDir $ $ INSTDIR \Syncplay \\resources
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 }
2014-06-29 17:18:38 +00:00
IfFileExists " $$APPDATA \ .syncplay " 0 + 2
2013-01-29 14:15:40 +00:00
Delete $ $ APPDATA \. syncplay
2014-06-29 17:18:38 +00:00
IfFileExists " $$APPDATA \ syncplay.ini " 0 + 2
Delete $ $ APPDATA \syncplay . ini
2013-01-29 14:15:40 +00:00
$ $ { 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 )
2018-04-23 22:44:19 +00:00
print ( " Total size eq: {} " . format ( totalSize ) )
2018-07-23 21:08:44 +00:00
installFiles = self . prepareInstallListTemplate ( fileList )
2013-01-16 14:00:57 +00:00
uninstallFiles = self . prepareDeleteListTemplate ( fileList )
2018-07-23 21:08:44 +00:00
2014-07-02 22:20:31 +00:00
if os . path . isfile ( SETUP_SCRIPT_PATH ) :
2013-01-15 18:27:21 +00:00
raise RuntimeError ( " Cannot create setup script, file exists at {} " . format ( SETUP_SCRIPT_PATH ) )
2018-07-23 21:08:44 +00:00
contents = Template ( NSIS_SCRIPT_TEMPLATE ) . substitute (
version = syncplay . version ,
uninstallFiles = uninstallFiles ,
installFiles = installFiles ,
totalSize = totalSize ,
)
2016-12-03 20:52:02 +00:00
with codecs . open ( SETUP_SCRIPT_PATH , " w " , " utf-8-sig " ) as outfile :
2018-06-18 15:02:03 +00:00
outfile . write ( contents )
2018-07-23 21:08:44 +00:00
2013-01-15 18:27:21 +00:00
def compile ( self ) :
2014-07-02 22:20:31 +00:00
if not os . path . isfile ( NSIS_COMPILE ) :
2013-01-29 18:19:32 +00:00
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 )
2018-07-23 21:08:44 +00:00
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 ( " \\ " )
2018-04-23 22:44:19 +00:00
if new_root not in fileList :
2013-01-16 14:00:57 +00:00
fileList [ new_root ] = [ ]
fileList [ new_root ] . append ( file_ )
2018-07-23 21:08:44 +00:00
return fileList , totalSize
2013-01-16 14:00:57 +00:00
def prepareInstallListTemplate ( self , fileList ) :
create = [ ]
2018-04-23 22:44:19 +00:00
for dir_ in fileList . keys ( ) :
2013-01-16 14:00:57 +00:00
create . append ( ' SetOutPath " $INSTDIR \\ {} " ' . format ( dir_ ) )
for file_ in fileList [ dir_ ] :
create . append ( ' FILE " {} \\ {} \\ {} " ' . format ( OUT_DIR , dir_ , file_ ) )
return " \n " . join ( create )
2018-07-23 21:08:44 +00:00
2013-01-16 14:00:57 +00:00
def prepareDeleteListTemplate ( self , fileList ) :
delete = [ ]
2018-04-23 22:44:19 +00:00
for dir_ in fileList . keys ( ) :
2013-01-16 14:00:57 +00:00
for file_ in fileList [ dir_ ] :
delete . append ( ' DELETE " $INSTDIR \\ {} \\ {} " ' . format ( dir_ , file_ ) )
2018-07-23 21:08:44 +00:00
delete . append ( ' RMdir " $INSTDIR \\ {} " ' . format ( file_ ) )
2013-01-16 14:00:57 +00:00
return " \n " . join ( delete )
2018-07-23 21:08:44 +00:00
2018-07-29 15:15:20 +00:00
def pruneUnneededLibraries ( ) :
from pathlib import Path
cwd = os . getcwd ( )
libDir = cwd + ' \\ ' + OUT_DIR + ' \\ lib \\ '
unneededModules = [ ' PySide2.Qt3D* ' , ' PySide2.QtAxContainer.pyd ' , ' PySide2.QtCharts.pyd ' , ' PySide2.QtConcurrent.pyd ' ,
' PySide2.QtDataVisualization.pyd ' , ' PySide2.QtHelp.pyd ' , ' PySide2.QtLocation.pyd ' ,
' PySide2.QtMultimedia.pyd ' , ' PySide2.QtMultimediaWidgets.pyd ' , ' PySide2.QtOpenGL.pyd ' ,
' PySide2.QtPositioning.pyd ' , ' PySide2.QtPrintSupport.pyd ' , ' PySide2.QtQml.pyd ' ,
' PySide2.QtQuick.pyd ' , ' PySide2.QtQuickWidgets.pyd ' , ' PySide2.QtScxml.pyd ' , ' PySide2.QtSensors.pyd ' ,
' PySide2.QtSql.pyd ' , ' PySide2.QtSvg.pyd ' , ' PySide2.QtTest.pyd ' , ' PySide2.QtTextToSpeech.pyd ' ,
2019-01-11 19:15:05 +00:00
' PySide2.QtUiTools.pyd ' , ' PySide2.QtWebChannel.pyd ' , ' PySide2.QtWebEngine.pyd ' ,
' PySide2.QtWebEngineCore.pyd ' , ' PySide2.QtWebEngineWidgets.pyd ' , ' PySide2.QtWebSockets.pyd ' ,
2018-07-29 15:15:20 +00:00
' PySide2.QtWinExtras.pyd ' , ' PySide2.QtXml.pyd ' , ' PySide2.QtXmlPatterns.pyd ' ]
unneededLibs = [ ' Qt53D* ' , ' Qt5Charts.dll ' , ' Qt5Concurrent.dll ' , ' Qt5DataVisualization.dll ' , ' Qt5Gamepad.dll ' , ' Qt5Help.dll ' ,
' Qt5Location.dll ' , ' Qt5Multimedia.dll ' , ' Qt5MultimediaWidgets.dll ' , ' Qt5OpenGL.dll ' , ' Qt5Positioning.dll ' ,
' Qt5PrintSupport.dll ' , ' Qt5Quick.dll ' , ' Qt5QuickWidgets.dll ' , ' Qt5Scxml.dll ' , ' Qt5Sensors.dll ' , ' Qt5Sql.dll ' ,
2019-01-11 19:15:05 +00:00
' Qt5Svg.dll ' , ' Qt5Test.dll ' , ' Qt5TextToSpeech.dll ' , ' Qt5WebChannel.dll ' , ' Qt5WebEngine.dll ' ,
' Qt5WebEngineCore.dll ' , ' Qt5WebEngineWidgets.dll ' , ' Qt5WebSockets.dll ' , ' Qt5WinExtras.dll ' , ' Qt5Xml.dll ' ,
' Qt5XmlPatterns.dll ' ]
2018-07-29 15:15:20 +00:00
windowsDLL = [ ' MSVCP140.dll ' , ' VCRUNTIME140.dll ' ]
deleteList = unneededModules + unneededLibs + windowsDLL
deleteList . append ( ' api-* ' )
for filename in deleteList :
for p in Path ( libDir ) . glob ( filename ) :
p . unlink ( )
def copyQtPlugins ( paths ) :
import shutil
from PySide2 import QtCore
basePath = QtCore . QLibraryInfo . location ( QtCore . QLibraryInfo . PluginsPath )
basePath = basePath . replace ( ' / ' , ' \\ ' )
destBase = os . getcwd ( ) + ' \\ ' + OUT_DIR
for elem in paths :
elemDir , elemName = os . path . split ( elem )
source = basePath + ' \\ ' + elem
dest = destBase + ' \\ ' + elem
destDir = destBase + ' \\ ' + elemDir
os . makedirs ( destDir , exist_ok = True )
shutil . copy ( source , dest )
2018-07-23 21:08:44 +00:00
2013-01-15 18:27:21 +00:00
class build_installer ( py2exe ) :
def run ( self ) :
py2exe . run ( self )
2018-07-29 15:15:20 +00:00
print ( ' *** deleting unnecessary libraries and modules *** ' )
pruneUnneededLibraries ( )
print ( ' *** copying qt plugins *** ' )
copyQtPlugins ( qt_plugins )
2013-01-15 18:27:21 +00:00
script = NSISScript ( )
script . create ( )
2018-07-29 15:15:20 +00:00
print ( " *** compiling the NSIS setup script *** " )
2013-01-15 18:27:21 +00:00
script . compile ( )
2018-04-23 22:44:19 +00:00
print ( " *** DONE *** " )
2013-01-15 18:27:21 +00:00
2019-08-19 17:03:38 +00:00
guiIcons = glob ( ' syncplay/resources/*.ico ' ) + glob ( ' syncplay/resources/*.png ' ) + [ ' syncplay/resources/spinner.mng ' ]
2019-04-13 13:39:55 +00:00
2018-07-23 21:08:44 +00:00
resources = [
2019-04-13 13:39:55 +00:00
" syncplay/resources/syncplayintf.lua " ,
" syncplay/resources/license.rtf " ,
2021-03-28 20:08:51 +00:00
" syncplay/resources/third-party-notices.txt "
2018-07-23 21:08:44 +00:00
]
2013-06-08 16:57:57 +00:00
resources . extend ( guiIcons )
2019-04-13 13:39:55 +00:00
intf_resources = [ " syncplay/resources/lua/intf/syncplay.lua " ]
2013-06-08 16:57:57 +00:00
2018-07-29 15:15:20 +00:00
qt_plugins = [ ' platforms \\ qwindows.dll ' , ' styles \\ qwindowsvistastyle.dll ' ]
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 ' ,
2014-06-29 17:18:38 +00:00
author_email = ' dev@syncplay.pl ' ,
2012-10-15 18:33:24 +00:00
description = ' Syncplay ' ,
2012-10-12 16:37:12 +00:00
)
2018-07-23 21:08:44 +00:00
2012-10-12 16:37:12 +00:00
info = dict (
common_info ,
2018-07-23 21:08:44 +00:00
windows = [ {
2022-07-31 15:35:33 +00:00
" script " : " syncplayClient.py " ,
" icon_resources " : [ ( 1 , " syncplay \\ resources \\ icon.ico " ) ] ,
' dest_base ' : " Syncplay " } ,
2018-07-23 21:08:44 +00:00
] ,
2013-06-08 13:00:44 +00:00
console = [ ' syncplayServer.py ' ] ,
2014-08-09 16:47:31 +00:00
# *** If you wish to make the Syncplay client use console mode (for --no-gui to work) then comment out the above two lines and uncomment the following line:
# console=['syncplayServer.py', {"script":"syncplayClient.py", "icon_resources":[(1, "resources\\icon.ico")], 'dest_base': "Syncplay"}],
2018-07-29 15:15:20 +00:00
2018-07-23 21:08:44 +00:00
options = {
' py2exe ' : {
' dist_dir ' : OUT_DIR ,
2019-04-13 13:39:55 +00:00
' packages ' : ' PySide2, cffi, OpenSSL, certifi ' ,
2022-04-29 09:49:36 +00:00
' includes ' : ' twisted, sys, encodings, datetime, os, time, math, urllib, ast, unicodedata, _ssl, win32pipe, win32file, sqlite3 ' ,
2021-03-07 19:25:23 +00:00
' excludes ' : ' venv, doctest, pdb, unittest, win32clipboard, win32pdh, win32security, win32trace, win32ui, winxpgui, win32process, tcl, tkinter ' ,
2018-07-23 21:08:44 +00:00
' dll_excludes ' : ' msvcr71.dll, MSVCP90.dll, POWRPROF.dll ' ,
' optimize ' : 2 ,
' compressed ' : 1
}
} ,
data_files = [ ( " resources " , resources ) , ( " resources/lua/intf " , intf_resources ) ] ,
2021-03-07 19:25:23 +00:00
zipfile = " lib/libsync.zip " ,
2018-07-23 21:08:44 +00:00
cmdclass = { " py2exe " : build_installer } ,
2012-10-12 16:37:12 +00:00
)
2019-04-13 13:39:55 +00:00
sys . argv . extend ( [ ' py2exe ' ] )
2019-12-30 12:56:27 +00:00
setup ( * * info )