From c543615f62e228263fb5fcb8ab0c3e1b5980e317 Mon Sep 17 00:00:00 2001 From: Romain Failliot Date: Thu, 21 Jul 2016 03:27:13 -0400 Subject: [PATCH] New cxfreeze setup and Inno Setup scripts for v0.5. --- windows-installer/diffuse.new.iss | 60 +++++++ windows-installer/setup.new.py | 256 ++++++++++++++++++++++++++++++ 2 files changed, 316 insertions(+) create mode 100644 windows-installer/diffuse.new.iss create mode 100644 windows-installer/setup.new.py diff --git a/windows-installer/diffuse.new.iss b/windows-installer/diffuse.new.iss new file mode 100644 index 0000000..d043026 --- /dev/null +++ b/windows-installer/diffuse.new.iss @@ -0,0 +1,60 @@ + +; Script generated by the Inno Setup Script Wizard. +; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! + +#define MyAppName "Diffuse Merge Tool" +#define MyAppVersion "0.5.0-alpha" +#define MyAppPublisher "Diffuse Team" +#define MyAppURL "https://github.com/MightyCreak/diffuse/" +#define MyAppExeName "diffuse.exe" + +#define SrcDir ".\build\exe.win-amd64-3.4\" + +[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={{82CF8E8E-7CA3-4D21-B5C7-91A35696424F} +AppName={#MyAppName} +AppVersion={#MyAppVersion} +AppVerName={#MyAppName} {#MyAppVersion} +AppPublisher={#MyAppPublisher} +AppPublisherURL={#MyAppURL} +AppSupportURL={#MyAppURL} +AppUpdatesURL={#MyAppURL} +ArchitecturesAllowed=x64 +ArchitecturesInstallIn64BitMode=x64 +DefaultDirName={pf}\{#MyAppName} +DisableProgramGroupPage=yes +OutputBaseFilename=setup-diffuse-{#MyAppVersion}-x64 +Compression=lzma +SolidCompression=yes + +[Languages] +Name: "en"; MessagesFile: "compiler:Default.isl,.\en.isl" +Name: "cs"; MessagesFile: "compiler:Languages\Czech.isl,.\cs.isl" +Name: "de"; MessagesFile: "compiler:Languages\German.isl,.\de.isl" +Name: "es"; MessagesFile: "compiler:Languages\Spanish.isl,.\es.isl" +Name: "it"; MessagesFile: "compiler:Languages\Italian.isl,.\it.isl" +Name: "ja"; MessagesFile: "compiler:Languages\Japanese.isl,.\ja.isl" +Name: "ko"; MessagesFile: "compiler:Languages\Korean.isl,.\ko.isl" +Name: "pl"; MessagesFile: "compiler:Languages\Polish.isl,.\pl.isl" +Name: "ru"; MessagesFile: "compiler:Languages\Russian.isl,.\ru.isl" +Name: "zh_CN"; MessagesFile: "compiler:Languages\ChineseSimplified.isl,.\zh_CN.isl" +Name: "zh_TW"; MessagesFile: "compiler:Languages\ChineseTraditional.isl,.\zh_TW.isl" + +[Tasks] +Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked + +[Files] +Source: "{#SrcDir}diffuse.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "{#SrcDir}*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs +; NOTE: Don't use "Flags: ignoreversion" on any shared system files + +[Icons] +Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" +Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon + +[Run] +Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent + diff --git a/windows-installer/setup.new.py b/windows-installer/setup.new.py new file mode 100644 index 0000000..e4dbb25 --- /dev/null +++ b/windows-installer/setup.new.py @@ -0,0 +1,256 @@ +import os +import site +import sys +import glob +import subprocess +from cx_Freeze import setup, Executable + +siteDir = site.getsitepackages()[1] +includeDllPath = os.path.join(siteDir, "gnome") + +# This is the list of dll which are required by PyGI. +# I get this list of DLL using http://technet.microsoft.com/en-us/sysinternals/bb896656.aspx +# Procedure: +# 1) Run your from from your IDE +# 2) Command for using listdlls.exe +# c:/path/to/listdlls.exe python.exe > output.txt +# 3) This would return lists of all dll required by you program +# in my case most of dll file were located in c:\python27\Lib\site-packages\gnome +# (I am using PyGI (all in one) installer) +# 4) Below is the list of gnome dll I recevied from listdlls.exe result. + +# If you prefer you can import all dlls from c:\python27\Lib\site-packages\gnome folder +missingDll = glob.glob(includeDllPath + "\\" + '*.dll') +missingDll = [ dll[len(includeDllPath) + 1:] for dll in missingDll ] + +print(missingDll) + +#missingDll = [ +## 'libaspell-15.dll', +# 'libatk-1.0-0.dll', +## 'libavcodec-56.dll', +## 'libavformat-56.dll', +## 'libavutil-54.dll', +# 'libcairo-gobject-2.dll', +## 'libdb-5.3.dll', +## 'libdbus-1-3.dll', +## 'libdbus-glib-1-2.dll', +## 'libdb_sql-5.3.dll', +## 'libdevhelp-3-2.dll', +## 'libenchant-1.dll', +# 'libepoxy-0.dll', +# 'libffi-6.dll', +# 'libfontconfig-1.dll', +# 'libfreetype-6.dll', +## 'libgailutil-3-0.dll', +## 'libgconf-2-4.dll', +## 'libgcrypt-11.dll', +## 'libgda-5.0-4.dll', +## 'libgda-ui-5.0-4.dll', +## 'libgdict-1.0-9.dll', +# 'libgdk-3-0.dll', +# 'libgdk_pixbuf-2.0-0.dll', +## 'libgdl-3-5.dll', +## 'libgedit.dll', +## 'libgee-0.8-2.dll', +## 'libgeoclue-0.dll', +## 'libgettextlib-0-18-3.dll', +## 'libgettextsrc-0-18-3.dll', +# 'libgio-2.0-0.dll', +# 'libgirepository-1.0-1.dll', +## 'libgit2-glib-1.0-0.dll', +## 'libgladeui-2-6.dll', +# 'libglib-2.0-0.dll', +# 'libgmodule-2.0-0.dll', +## 'libgnutls-28.dll', +# 'libgobject-2.0-0.dll', +## 'libgoocanvas-2.0-9.dll', +## 'libgsf-1-114.dll', +## 'libgsf-win32-1-114.dll', +## 'libgspell-1-0.dll', +## 'libgssapi-3.dll', +## 'libgstallocators-1.0-0.dll', +## 'libgstapp-1.0-0.dll', +## 'libgstaudio-1.0-0.dll', +## 'libgstbase-1.0-0.dll', +## 'libgstcheck-1.0-0.dll', +## 'libgstcontroller-1.0-0.dll', +## 'libgstfft-1.0-0.dll', +## 'libgstnet-1.0-0.dll', +## 'libgstpbutils-1.0-0.dll', +## 'libgstreamer-1.0-0.dll', +## 'libgstriff-1.0-0.dll', +## 'libgstrtp-1.0-0.dll', +## 'libgstrtsp-1.0-0.dll', +## 'libgstrtspserver-1.0-0.dll', +## 'libgstsdp-1.0-0.dll', +## 'libgsttag-1.0-0.dll', +## 'libgstvideo-1.0-0.dll', +## 'libgthread-2.0-0.dll', +# 'libgtk-3-0.dll', +## 'libgtkhex-3-0.dll', +## 'libgtksourceview-3.0-1.dll', +## 'libgtkspell3-3-0.dll', +## 'libgtranslator.dll', +## 'libgucharmap_2_90-7.dll', +## 'libgxml-0.10-10.dll', +# 'libharfbuzz-0.dll', +## 'libharfbuzz-gobject-0.dll', +## 'libharfbuzz-icu-0.dll', +## 'libicu52.dll', +# 'libintl-8.dll', +## 'libisocodes-0.dll', +# 'libjasper-1.dll', +## 'libjavascriptcoregtk-3.0-0.dll', +# 'libjpeg-8.dll', +## 'libjson-glib-1.0-0.dll', +## 'liblua51.dll', +## 'libopenssl.dll', +## 'liborc-0.4-0.dll', +## 'liborc-test-0.4-0.dll', +## 'libp11-kit-0.dll', +# 'libpango-1.0-0.dll', +# 'libpangocairo-1.0-0.dll', +# 'libpangoft2-1.0-0.dll', +# 'libpangowin32-1.0-0.dll', +## 'libpeas-1.0-0.dll', +## 'libpeas-gtk-1.0-0.dll', +# 'libpng16-16.dll', +## 'libproxy.dll', +# 'librsvg-2-2.dll', +## 'libsasl2.dll', +## 'libsecret-1-0.dll', +## 'libsoup-2.4-1.dll', +## 'libsqlite3-0.dll', +## 'libstdc++.dll', +## 'libswresample-1.dll', +# 'libtiff-5.dll', +## 'libvisual-0.4-0.dll', +## 'libwebkitgtk-3.0-0.dll', +# 'libwebp-5.dll', +# 'libwinpthread-1.dll', +# 'libxmlxpat.dll', +## 'libxslt-1.dll', +# 'libzzz.dll', +#] + +includeFiles = [] +for dll in missingDll: + includeFiles.append((os.path.join(includeDllPath, dll), dll)) + #includeFiles.append(dll) + +# You can import all Gtk Runtime data from gtk folder +#gtkLibs= ['etc','lib','share'] + +# You can import only important Gtk Runtime data from gtk folder +gtkLibs = ['lib\\gdk-pixbuf-2.0', + 'lib\\girepository-1.0', + 'share\\glib-2.0', + 'lib\\gtk-3.0'] + + +for lib in gtkLibs: + includeFiles.append((os.path.join(includeDllPath, lib), lib)) + +base = None +if sys.platform == "win32": + base = "Win32GUI" + +if not os.path.exists("temp"): + os.mkdir("temp") + +from shutil import copyfile +copyfile("..\\src\\usr\\bin\\diffuse", "temp\\diffuse") + +setup( + name = "diffuse", + version = "0.5", + description = "Diffuse Merge Tool", + options = {'build_exe' : { + 'compressed': True, + 'includes': ["gi"], + 'excludes': ['wx', 'email', 'pydoc_data', 'curses'], + 'packages': ["gi"], + 'include_files': includeFiles + }}, + executables = [ + Executable("temp\\diffuse", + base=base + ) + ] +) + +# makes a directory without complaining if it already exists +def mkdir(s): + if not os.path.isdir(s): + os.mkdir(s) + +# copies a file to 'dest' +def copyFile(src, dest, use_text_mode=False,enc=None): + print('copying "%s" to "%s"' % (src, dest)) + if use_text_mode: + r, w = 'r', 'w' + else: + r, w = 'rb', 'wb' + f = open(src, r) + s = f.read() + f.close() + if enc is not None: + s = codecs.encode(unicode(s, 'utf_8'), enc) + f = open(dest, w) + f.write(s) + f.close() + +# recursively copies a directory to 'dest' +def copyDir(src, dest): + print('copying "%s" to "%s"' % (src, dest)) + mkdir(dest) + for f in os.listdir(src): + s = os.path.join(src, f) + d = os.path.join(dest, f) + if os.path.isfile(s): + copyFile(s, d) + elif os.path.isdir(s): + copyDir(s, d) + +# include GTK dependencies +#gtk_dir = os.environ['GTK_BASEPATH'] +gtk_dir = "C:\\Python34\\Lib\\site-packages\\gnome" +build_dir = "build\\exe.win-amd64-3.4" +copyDir(os.path.join(gtk_dir, 'etc'), os.path.join(build_dir, 'etc')) +copyDir(os.path.join(gtk_dir, 'lib'), os.path.join(build_dir, 'lib')) +mkdir(os.path.join(build_dir, 'share')) +copyDir(os.path.join(gtk_dir, 'share\\icons'), os.path.join(build_dir, 'share\\icons')) +copyDir(os.path.join(gtk_dir, 'share\\themes'), os.path.join(build_dir, 'share\\themes')) + +# +# Add all support files. +# + +# syntax highlighting support +mkdir(os.path.join(build_dir, 'syntax')) +for p in glob.glob('..\\src\\usr\\share\\diffuse\\syntax\\*.syntax'): + copyFile(p, os.path.join(build_dir, 'syntax', os.path.basename(p)), True) +copyFile('diffuserc', os.path.join(build_dir, 'diffuserc')) + +# application icon +copyDir('..\\src\\usr\\share\\icons', os.path.join(build_dir, 'share\\icons')) + +# translations +mkdir(os.path.join(build_dir, 'share\\locale')) +locale_dir = os.path.join(gtk_dir, 'share\\locale') +for s in glob.glob('..\\translations\\*.po'): + lang = s[16:-3] + # Diffuse localisations + print('Compiling %s translation' % (lang, )) + lang_dir = '' + for p in [ 'locale', lang, 'LC_MESSAGES' ]: + lang_dir = os.path.join(build_dir, p) + mkdir(lang_dir) + lang_dir = os.path.join(lang_dir, 'diffuse.mo') + if subprocess.Popen(['msgfmt', '-o', lang_dir, s]).wait() != 0: + raise OSError('Failed to compile "%s" into "%s".' % (s, lang_dir)) + # GTK localisations + lang_dir = os.path.join(locale_dir, lang) + if os.path.isdir(lang_dir): + copyDir(lang_dir, os.path.join(build_dir, 'share\\locale', lang))