summaryrefslogtreecommitdiffstats
path: root/packaging
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2015-08-26 16:53:21 +0100
committerCalum Lind <calumlind+deluge@gmail.com>2015-08-26 17:25:33 +0100
commit50f6f2d3ec86c613525461ffadb8bef722525520 (patch)
tree2ad59a17f7ab6fe2c00b5f0e2f0564e8cd8e2ddc /packaging
parent4b3684bc5de735c5cef794daf896ff7cd2601cf7 (diff)
downloaddeluge-50f6f2d3ec86c613525461ffadb8bef722525520.tar.gz
deluge-50f6f2d3ec86c613525461ffadb8bef722525520.tar.bz2
deluge-50f6f2d3ec86c613525461ffadb8bef722525520.zip
[Packaging] bbfreeze tweaks and comments
* Reduce output from bbfreeze and add debug option to enable again.
Diffstat (limited to 'packaging')
-rw-r--r--packaging/win32/deluge-bbfreeze.py77
1 files changed, 51 insertions, 26 deletions
diff --git a/packaging/win32/deluge-bbfreeze.py b/packaging/win32/deluge-bbfreeze.py
index 6aeec2f6e..73c7a323d 100644
--- a/packaging/win32/deluge-bbfreeze.py
+++ b/packaging/win32/deluge-bbfreeze.py
@@ -1,3 +1,16 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2012-2015 Calum Lind <calumlind@gmail.com>
+# Copyright (C) 2010 Damien Churchill <damoxc@gmail.com>
+# Copyright (C) 2009-2010 Andrew Resch <andrewresch@gmail.com>
+# Copyright (C) 2009 Jesper Lund <mail@jesperlund.com>
+#
+# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
+# the additional special exception to link portions of this program with the OpenSSL library.
+# See LICENSE for more details.
+#
+
import glob
import os
import re
@@ -32,25 +45,34 @@ class VersionInfo(object):
self.debug = debug
self.verbose = verbose
+DEBUG = False
+if len(sys.argv) == 2 and sys.argv[1].lower() == "debug":
+ DEBUG = True
+
# 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)
if python_path.endswith("Scripts"):
python_path = python_path[:-8]
python_path += os.path.sep
-print "Python Path: %s" % python_path
-
gtk_root = os.path.join(gtk.__path__[0], "..", "runtime") + os.path.sep
+build_dir = "..\\build-win32\\deluge-bbfreeze-" + build_version + "\\"
+
+if DEBUG:
+ print("Python Path: %s" % python_path)
+ print("Gtk Path: %s" % gtk_root)
+ print("bbfreeze Output Path: %s" % build_dir)
+
+print("Freezing Deluge %s..." % build_version)
+# Disable printing to console for bbfreezing.
+if not DEBUG:
+ sys.stdout = open(os.devnull, "w")
# 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", "_cffi_backend")
excludes = ("numpy", "OpenGL", "psyco", "win32ui")
-build_dir = "..\\build-win32\\deluge-bbfreeze-" + build_version + "\\"
-
def recipe_gtk_override(mf):
# Override bbfreeze function so that it includes all gtk libraries
@@ -72,14 +94,12 @@ for script in glob.glob(python_path + "Scripts\\deluge*-script.py*"):
new_script = script.replace("-script", "")
shutil.copy(script, new_script)
+ gui_script = False
script_splitext = os.path.splitext(os.path.basename(new_script))
if script_splitext[1] == ".pyw" or script_splitext[0] in force_gui:
gui_script = True
- else:
- gui_script = False
try:
fzr.addScript(new_script, gui_only=gui_script)
-
script_list.append(new_script)
except:
os.remove(script)
@@ -91,23 +111,17 @@ fzr()
for script in script_list:
os.remove(script)
-# Add version information to exe files.
-for script in script_list:
- script_exe = os.path.splitext(os.path.basename(script))[0] + ".exe"
- if not re.search('[a-zA-Z_-]', build_version):
- versionInfo = VersionInfo(build_version,
- description="Deluge Bittorrent Client",
- company="Deluge Team",
- product="Deluge",
- copyright="GPLv3")
- stamp(os.path.join(build_dir, script_exe), versionInfo)
-
# Exclude files which are already included in GTK or Windows.
excludeDlls = ("MSIMG32.dll", "MSVCR90.dll", "MSVCP90.dll", "POWRPROF.dll", "DNSAPI.dll", "USP10.dll")
for dll in excludeDlls:
- for filename in glob.glob(os.path.join(build_dir, dll)):
- print "removing file:", filename
- os.remove(filename)
+ try:
+ os.remove(os.path.join(build_dir, dll))
+ except OSError:
+ pass
+
+# Re-enable printing.
+if not DEBUG:
+ sys.stdout = sys.__stdout__
# Copy gtk locale files.
gtk_locale = os.path.join(gtk_root, 'share/locale')
@@ -143,7 +157,18 @@ for path_root, path in theme_include_list:
pass
shutil.copy(full_path, dst_dir)
+# Add version information to exe files.
+for script in script_list:
+ script_exe = os.path.splitext(os.path.basename(script))[0] + ".exe"
+ # Don't add to dev build versions.
+ if not re.search('[a-zA-Z_-]', build_version):
+ versionInfo = VersionInfo(build_version,
+ description="Deluge Bittorrent Client",
+ company="Deluge Team",
+ product="Deluge",
+ copyright="GPLv3")
+ stamp(os.path.join(build_dir, script_exe), versionInfo)
+
# Copy version info to file for nsis script.
-file = open('VERSION.tmp', 'w')
-file.write("build_version = \"%s\"" % build_version)
-file.close()
+with open('VERSION.tmp', 'w') as ver_file:
+ ver_file.write("build_version = \"%s\"" % build_version)