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.
This commit is contained in:
Romain Failliot 2016-07-22 03:46:50 -04:00
parent 01daf905f3
commit 6365966205
2 changed files with 152 additions and 141 deletions

View File

@ -3,7 +3,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Diffuse Merge Tool" #define MyAppName "Diffuse Merge Tool"
#define MyAppVersion "0.5.0-alpha" #define MyAppVersion "0.5.0-alpha.2"
#define MyAppPublisher "Diffuse Team" #define MyAppPublisher "Diffuse Team"
#define MyAppURL "https://github.com/MightyCreak/diffuse/" #define MyAppURL "https://github.com/MightyCreak/diffuse/"
#define MyAppExeName "diffuse.exe" #define MyAppExeName "diffuse.exe"

View File

@ -6,7 +6,7 @@ import subprocess
from cx_Freeze import setup, Executable from cx_Freeze import setup, Executable
siteDir = site.getsitepackages()[1] 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. # 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 # I get this list of DLL using http://technet.microsoft.com/en-us/sysinternals/bb896656.aspx
@ -20,161 +20,161 @@ includeDllPath = os.path.join(siteDir, "gnome")
# 4) Below is the list of gnome dll I recevied from listdlls.exe result. # 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 # If you prefer you can import all dlls from c:\python27\Lib\site-packages\gnome folder
missingDll = glob.glob(includeDllPath + "\\" + '*.dll') #missingDll = glob.glob(gnomeSiteDir + "\\" + '*.dll')
missingDll = [ dll[len(includeDllPath) + 1:] for dll in missingDll ] #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 = [ print("missingDll = [")
## 'libaspell-15.dll', for dll in missingDll:
# 'libatk-1.0-0.dll', print(" '" + dll + "',")
## 'libavcodec-56.dll', print("]")
## '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 = [] includeFiles = []
for dll in missingDll: for dll in missingDll:
includeFiles.append((os.path.join(includeDllPath, dll), dll)) includeFiles.append((os.path.join(gnomeSiteDir, dll), dll))
#includeFiles.append(dll) #includeFiles.append(dll)
# You can import all Gtk Runtime data from gtk folder # 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 # You can import only important Gtk Runtime data from gtk folder
gtkLibs = ['lib\\gdk-pixbuf-2.0', gnomeLibs = [
'lib\\gdk-pixbuf-2.0',
'lib\\girepository-1.0', 'lib\\girepository-1.0',
'share\\glib-2.0', 'lib\\gtk-3.0',
'lib\\gtk-3.0'] 'share\\glib-2.0'
]
for lib in gnomeLibs:
for lib in gtkLibs: includeFiles.append((os.path.join(gnomeSiteDir, lib), lib))
includeFiles.append((os.path.join(includeDllPath, lib), lib))
base = None base = None
if sys.platform == "win32": if sys.platform == "win32":
base = "Win32GUI" base = "Win32GUI"
if not os.path.exists("temp"):
os.mkdir("temp")
from shutil import copyfile
copyfile("..\\src\\usr\\bin\\diffuse", "temp\\diffuse")
setup( setup(
name = "diffuse", name = "diffuse",
version = "0.5", version = "0.5",
description = "Diffuse Merge Tool", description = "Diffuse Merge Tool",
options = {'build_exe' : { options = {'build_exe' : {
'compressed': True, 'compressed': True,
'includes': ["gi"], 'includes': ["gi", "cairo"],
'excludes': ['wx', 'email', 'pydoc_data', 'curses'], 'excludes': ['wx', 'email', 'pydoc_data', 'curses'],
'packages': ["gi"], 'packages': ["gi", "cairo"],
'include_files': includeFiles 'include_files': includeFiles
}}, }},
executables = [ executables = [
Executable("temp\\diffuse", Executable(
"..\\src\\usr\\bin\\diffuse",
icon="diffuse.ico",
base=base base=base
) )
] ]
@ -214,14 +214,25 @@ def copyDir(src, dest):
copyDir(s, d) copyDir(s, d)
# include GTK dependencies # 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" 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')) gnomeCopyDirs =[
mkdir(os.path.join(build_dir, 'share')) 'etc',
copyDir(os.path.join(gtk_dir, 'share\\icons'), os.path.join(build_dir, 'share\\icons')) #'lib',
copyDir(os.path.join(gtk_dir, 'share\\themes'), os.path.join(build_dir, 'share\\themes')) #'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. # Add all support files.
@ -238,7 +249,7 @@ copyDir('..\\src\\usr\\share\\icons', os.path.join(build_dir, 'share\\icons'))
# translations # translations
mkdir(os.path.join(build_dir, 'share\\locale')) 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'): for s in glob.glob('..\\translations\\*.po'):
lang = s[16:-3] lang = s[16:-3]
# Diffuse localisations # Diffuse localisations