From 6365966205d96eba08872f3b9e462701f417e392 Mon Sep 17 00:00:00 2001 From: Romain Failliot Date: Fri, 22 Jul 2016 03:46:50 -0400 Subject: [PATCH] Fix and improve executable generation for Windows * Bump to v0.5.0-alpha.2 * Now it really works on Windows! * Filtering the DLLs pulled with the executable, reducing the total size of the app from 170MB to 60MB. * Adding the Diffuse icon to the .exe. --- windows-installer/diffuse.new.iss | 2 +- windows-installer/setup.new.py | 291 ++++++++++++++++-------------- 2 files changed, 152 insertions(+), 141 deletions(-) diff --git a/windows-installer/diffuse.new.iss b/windows-installer/diffuse.new.iss index d043026..f099314 100644 --- a/windows-installer/diffuse.new.iss +++ b/windows-installer/diffuse.new.iss @@ -3,7 +3,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "Diffuse Merge Tool" -#define MyAppVersion "0.5.0-alpha" +#define MyAppVersion "0.5.0-alpha.2" #define MyAppPublisher "Diffuse Team" #define MyAppURL "https://github.com/MightyCreak/diffuse/" #define MyAppExeName "diffuse.exe" diff --git a/windows-installer/setup.new.py b/windows-installer/setup.new.py index e4dbb25..92cd318 100644 --- a/windows-installer/setup.new.py +++ b/windows-installer/setup.new.py @@ -6,7 +6,7 @@ import subprocess from cx_Freeze import setup, Executable siteDir = site.getsitepackages()[1] -includeDllPath = os.path.join(siteDir, "gnome") +gnomeSiteDir = 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 @@ -20,163 +20,163 @@ includeDllPath = os.path.join(siteDir, "gnome") # 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 ] +#missingDll = glob.glob(gnomeSiteDir + "\\" + '*.dll') +#missingDll = [ dll[len(gnomeSiteDir) + 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', +] -#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', -#] +print("missingDll = [") +for dll in missingDll: + print(" '" + dll + "',") +print("]") includeFiles = [] for dll in missingDll: - includeFiles.append((os.path.join(includeDllPath, dll), dll)) + includeFiles.append((os.path.join(gnomeSiteDir, dll), dll)) #includeFiles.append(dll) # You can import all Gtk Runtime data from gtk folder -#gtkLibs= ['etc','lib','share'] +#gnomeLibs= ['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'] +gnomeLibs = [ + 'lib\\gdk-pixbuf-2.0', + 'lib\\girepository-1.0', + 'lib\\gtk-3.0', + 'share\\glib-2.0' +] - -for lib in gtkLibs: - includeFiles.append((os.path.join(includeDllPath, lib), lib)) +for lib in gnomeLibs: + includeFiles.append((os.path.join(gnomeSiteDir, 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"], + 'includes': ["gi", "cairo"], 'excludes': ['wx', 'email', 'pydoc_data', 'curses'], - 'packages': ["gi"], + 'packages': ["gi", "cairo"], 'include_files': includeFiles }}, executables = [ - Executable("temp\\diffuse", - base=base - ) + Executable( + "..\\src\\usr\\bin\\diffuse", + icon="diffuse.ico", + base=base + ) ] ) @@ -214,14 +214,25 @@ def copyDir(src, dest): 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')) + +gnomeCopyDirs =[ + 'etc', + #'lib', + #'lib\\GConf', + 'lib\\gdk-pixbuf-2.0', + 'lib\\gio', + 'lib\\girepository-1.0', + 'lib\\gtk-3.0', + 'share\\icons', + 'share\\themes' +] + +for gnomeDir in gnomeCopyDirs: + buildGnomeDir = os.path.join(build_dir, gnomeDir) + if not os.path.isdir(buildGnomeDir): + os.makedirs(buildGnomeDir) + copyDir(os.path.join(gnomeSiteDir, gnomeDir), buildGnomeDir) # # Add all support files. @@ -238,7 +249,7 @@ 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') +locale_dir = os.path.join(gnomeSiteDir, 'share\\locale') for s in glob.glob('..\\translations\\*.po'): lang = s[16:-3] # Diffuse localisations