summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2012-11-22 22:48:32 +0000
committerCalum Lind <calumlind+deluge@gmail.com>2012-11-22 23:19:05 +0000
commit5d43c2ac944f318874470a3beda951174faa01e1 (patch)
tree1d959dff4ebed8ee8647c1f352b0b5124eb61c22
parent845b95d88f7065986a68e79c8645fb6a22dfdff7 (diff)
downloaddeluge-5d43c2ac944f318874470a3beda951174faa01e1.zip
deluge-5d43c2ac944f318874470a3beda951174faa01e1.tar.gz
deluge-5d43c2ac944f318874470a3beda951174faa01e1.tar.bz2
Update bbfreeze and nsis scripts for win32 packaging
bbfreeze script: * Creates a VERSION.tmp file for use by nsis script * Includes all theme, icon and locale files. Closes #2096 & #2145 * Add email.mime.multipart and email.mime.text. Closes #2074 * deluged.exe and deluge-web.exe will no longer show a cmd window and created deluged-debug.exe and deluge-web-debug.exe as replacements if still needed * Overridden bbfreeze gtk recipe thus no longer requiring file editing. * Remove unnecessary python module includes nsis script: * Deluge version now based upon bbfreeze output * Installer will warn if deluge already running. Closes #1217 * Removed deluged and deluge-web shortcuts from start menu * Increased compression level for lzma
-rw-r--r--win32/Win32 README.txt40
-rw-r--r--win32/deluge-bbfreeze.py84
-rw-r--r--win32/deluge-win32-installer.nsi32
3 files changed, 95 insertions, 61 deletions
diff --git a/win32/Win32 README.txt b/win32/Win32 README.txt
index a93caab..894afc2 100644
--- a/win32/Win32 README.txt
+++ b/win32/Win32 README.txt
@@ -9,46 +9,14 @@ Instructions for building the Deluge NSIS Installer for Windows XP/Vista/7.
== Build Steps ==
- 1. Build Deluge on Windows.
+ 1. Build and Install Deluge on Windows.
- 2. Verify/update the Deluge version in the win32 packaging scripts.
-
- bbfreeze script - Edit 'build_version' variable in:
-
- win32/deluge-bbfreeze.py
-
- NSIS script - Edit 'PROGRAM_VERSION' variable in:
-
- win32/deluge-win32-installer.nsi
-
- 3. Modify bbfreeze program.
-
- We want to include all the gtk libraries in the installer so that users don't
- require a separate GTK+ installation so we need to slightly modify bbfreeze.
-
- The modification is to add a line to bbfreeze\recipes.py, usually located here:
-
- C:\Python26\Lib\site-packages\bbfreeze-*-py2.6-win32.egg\bbfreeze\recipes.py
-
- Find the line containing 'def recipe_gtk_and_friends' and after it add:
-
- return True
-
- 4. Run the bbfreeze script from the win32 directory:
+ 2. Run the bbfreeze script from the win32 directory:
python deluge-bbfreeze.py
- The script places the bbfreeze'd version of Deluge in
-
- build-win32/deluge-bbfreeze-build_version
+ The result is a bbfreeze'd version of Deluge in `build-win32/deluge-bbfreeze-build_version`.
- Note: The assumption for this script is that Python 2.6 is installed
- in 'C:\Python26' otherwise the 'python_path' variable should be changed.
-
- 5. Run the NSIS script (right-click and choose `Compile with NSIS`)
+ 3. Run the NSIS script (right-click and choose `Compile with NSIS`)
The result is a standalone installer in the `build-win32` directory.
-
-The Uninstaller will remove everything from the installation directory. The file
-association for '.torrent' will also be removed but only if it's associated with Deluge
-
diff --git a/win32/deluge-bbfreeze.py b/win32/deluge-bbfreeze.py
index cb5324e..e44cf07 100644
--- a/win32/deluge-bbfreeze.py
+++ b/win32/deluge-bbfreeze.py
@@ -1,45 +1,101 @@
-build_version = "1.3.5"
-python_path = "C:\\Python26\\"
-
-import os, glob
+import os, glob, sys
import shutil
+import deluge.common
+
+# Get build_version from installed deluge
+build_version = deluge.common.get_version()
+print "Deluge Version: %s" % build_version
+python_path = os.path.dirname(sys.executable) + "\\"
+print "Python Path: %s" % python_path
+gtk_root = python_path + "Lib\\site-packages\\gtk-2.0\\runtime\\"
+
+# Copy entry scripts with new name, which represents final .exe filename
shutil.copy(python_path + "Scripts\deluge-script.pyw", python_path + "Scripts\deluge.py")
shutil.copy(python_path + "Scripts\deluge-script.pyw", python_path + "Scripts\deluge-debug.py")
shutil.copy(python_path + "Scripts\deluged-script.py", python_path + "Scripts\deluged.py")
+shutil.copy(python_path + "Scripts\deluged-script.py", python_path + "Scripts\deluged-debug.py")
shutil.copy(python_path + "Scripts\deluge-web-script.py", python_path + "Scripts\deluge-web.py")
+shutil.copy(python_path + "Scripts\deluge-web-script.py", python_path + "Scripts\deluge-web-debug.py")
shutil.copy(python_path + "Scripts\deluge-gtk-script.pyw", python_path + "Scripts\deluge-gtk.py")
shutil.copy(python_path + "Scripts\deluge-console-script.py", python_path + "Scripts\deluge-console.py")
-includes=("libtorrent", "gzip", "zipfile", "re", "socket", "struct", "cairo", "pangocairo", "atk", "pango", "twisted.internet.utils", "gio", "gtk.glade", "email.mime")
+# Include python modules not picked up automatically by bbfreeze
+includes=(
+ "libtorrent", "cairo", "pangocairo", "atk", "pango", "twisted.internet.utils",
+ "gio", "gzip", "email.mime.multipart", "email.mime.text"
+ )
excludes=("numpy", "OpenGL", "psyco", "win32ui")
dst = "..\\build-win32\\deluge-bbfreeze-" + build_version + "\\"
+# Need to override bbfreeze function so that it includes all gtk libraries
+# in the installer so users don't require a separate GTK+ installation.
+import bbfreeze.recipes
+def recipe_gtk_override(mf):
+ return True
+bbfreeze.recipes.recipe_gtk_and_friends = recipe_gtk_override
+
from bbfreeze import Freezer
f = Freezer(dst, includes=includes, excludes=excludes)
f.include_py = False
f.addScript(python_path + "Scripts\deluge.py", gui_only=True)
f.addScript(python_path + "Scripts\deluge-debug.py", gui_only=False)
-f.addScript(python_path + "Scripts\deluged.py", gui_only=False)
-f.addScript(python_path + "Scripts\deluge-web.py", gui_only=False)
+f.addScript(python_path + "Scripts\deluged.py", gui_only=True)
+f.addScript(python_path + "Scripts\deluged-debug.py", gui_only=False)
+f.addScript(python_path + "Scripts\deluge-web.py", gui_only=True)
+f.addScript(python_path + "Scripts\deluge-web-debug.py", gui_only=False)
f.addScript(python_path + "Scripts\deluge-gtk.py", gui_only=True)
f.addScript(python_path + "Scripts\deluge-console.py", gui_only=False)
f() # starts the freezing process
# add icons to the exe files
import icon
-
icon_path = os.path.join(os.path.dirname(__file__), "deluge.ico")
icon.CopyIcons(dst+"deluge.exe", icon_path)
icon.CopyIcons(dst+"deluge-debug.exe", icon_path)
-icon.CopyIcons(dst+"deluged.exe", icon_path)
-icon.CopyIcons(dst+"deluge-web.exe", icon_path)
-icon.CopyIcons(dst+"deluge-gtk.exe", icon_path)
-icon.CopyIcons(dst+"deluge-console.exe", icon_path)
+icon.CopyIcons(dst+"deluged.exe", icon_path)
+icon.CopyIcons(dst+"deluged-debug.exe", icon_path)
+icon.CopyIcons(dst+"deluge-web.exe", icon_path)
+icon.CopyIcons(dst+"deluge-web-debug.exe", icon_path)
+icon.CopyIcons(dst+"deluge-gtk.exe", icon_path)
+icon.CopyIcons(dst+"deluge-console.exe", icon_path)
# exclude files which are already included in GTK or Windows
-excludeFiles = ("MSIMG32.dll", "MSVCR90.dll", "MSVCP90.dll", "POWRPROF.dll", "DNSAPI.dll", "USP10.dll")
-for file in excludeFiles:
+excludeDlls = ("MSIMG32.dll", "MSVCR90.dll", "MSVCP90.dll", "POWRPROF.dll", "DNSAPI.dll", "USP10.dll")
+for file in excludeDlls:
for filename in glob.glob(dst + file):
print "removing file:", filename
os.remove(filename)
+
+# copy gtk locale files
+gtk_locale = os.path.join(gtk_root, 'share/locale')
+locale_include_list = ['gtk20.mo', 'locale.alias']
+def ignored_files(adir,filenames):
+ return [
+ filename for filename in filenames
+ if not os.path.isdir(os.path.join(adir, filename))
+ and filename not in locale_include_list
+ ]
+shutil.copytree(gtk_locale, os.path.join(dst, 'share/locale'), ignore=ignored_files)
+
+# copy gtk theme files
+theme_include_list = [
+ "share/icons/hicolor/index.theme",
+ "lib/gtk-2.0/2.10.0/engines",
+ "share/themes/MS-Windows",
+ "etc/gtk-2.0/gtkrc"]
+for path in theme_include_list:
+ full_path = os.path.join(gtk_root, path)
+ if os.path.isdir(full_path):
+ shutil.copytree(full_path, os.path.join(dst, path))
+ else:
+ dst_dir = os.path.join(dst, os.path.dirname(path))
+ try:
+ os.makedirs(dst_dir)
+ except:
+ pass
+ shutil.copy(full_path, dst_dir)
+
+file = open('VERSION.tmp', 'w')
+file.write("build_version = \"%s\"" % build_version)
+file.close()
diff --git a/win32/deluge-win32-installer.nsi b/win32/deluge-win32-installer.nsi
index 735992a..e4e0811 100644
--- a/win32/deluge-win32-installer.nsi
+++ b/win32/deluge-win32-installer.nsi
@@ -1,5 +1,5 @@
# Deluge Windows installer script
-# Version 0.4 28-Apr-2009
+# Version 0.6 22-Nov-2012
# Copyright (C) 2009 by
# Jesper Lund <mail@jesperlund.com>
@@ -26,21 +26,26 @@
#
# Set default compressor
-SetCompressor lzma
+SetCompressor /FINAL /SOLID lzma
+SetCompressorDictSize 64
###
### --- The PROGRAM_VERSION !define need to be updated with new Deluge versions ---
###
# Script version; displayed when running the installer
-!define DELUGE_INSTALLER_VERSION "0.5"
+!define DELUGE_INSTALLER_VERSION "0.6"
# Deluge program information
!define PROGRAM_NAME "Deluge"
-!define PROGRAM_VERSION "1.3.5"
+# Deluge program information
+!searchparse /file VERSION.tmp `build_version = "` PROGRAM_VERSION `"`
+!ifndef PROGRAM_VERSION
+ !error "Program Version Undefined"
+!endif
!define PROGRAM_WEB_SITE "http://deluge-torrent.org"
-# Python files generated with bbfreeze (without DLLs from GTK+ runtime)
+# Python files generated with bbfreeze
!define DELUGE_PYTHON_BBFREEZE_OUTPUT_DIR "..\build-win32\deluge-bbfreeze-${PROGRAM_VERSION}"
# --- Interface settings ---
@@ -93,6 +98,15 @@ SetCompressor lzma
# --- Functions ---
+Function .onInit
+ System::Call 'kernel32::OpenMutex(i 0x100000, b 0, t "deluge") i .R0'
+ IntCmp $R0 0 notRunning
+ System::Call 'kernel32::CloseHandle(i $R0)'
+ MessageBox MB_OK|MB_ICONEXCLAMATION "Deluge is running. Please close it first" /SD IDOK
+ Abort
+ notRunning:
+FunctionEnd
+
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
@@ -126,7 +140,7 @@ ShowUnInstDetails show
# Install main application
Section "Deluge Bittorrent Client" Section1
SectionIn RO
-
+
SetOutPath $INSTDIR
File /r "${DELUGE_PYTHON_BBFREEZE_OUTPUT_DIR}\*.*"
@@ -140,8 +154,6 @@ Section -StartMenu_Desktop_Links
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\Deluge"
CreateShortCut "$SMPROGRAMS\Deluge\Deluge.lnk" "$INSTDIR\deluge.exe"
- CreateShortCut "$SMPROGRAMS\Deluge\Deluge daemon.lnk" "$INSTDIR\deluged.exe"
- CreateShortCut "$SMPROGRAMS\Deluge\Deluge webUI.lnk" "$INSTDIR\deluge-web.exe"
CreateShortCut "$SMPROGRAMS\Deluge\Project homepage.lnk" "$INSTDIR\Homepage.url"
CreateShortCut "$SMPROGRAMS\Deluge\Uninstall Deluge.lnk" "$INSTDIR\Deluge-uninst.exe"
CreateShortCut "$DESKTOP\Deluge.lnk" "$INSTDIR\deluge.exe"
@@ -194,11 +206,9 @@ LangString DESC_Section3 ${LANG_ENGLISH} "Select this option to have Deluge hand
Section Uninstall
RmDir /r "$INSTDIR"
-
+
SetShellVarContext all
Delete "$SMPROGRAMS\Deluge\Deluge.lnk"
- Delete "$SMPROGRAMS\Deluge\Deluge daemon.lnk"
- Delete "$SMPROGRAMS\Deluge\Deluge webUI.lnk"
Delete "$SMPROGRAMS\Deluge\Uninstall Deluge.lnk"
Delete "$SMPROGRAMS\Deluge\Project homepage.lnk"
Delete "$DESKTOP\Deluge.lnk"