Rev 5069: (garyvdm) Add a 'bzrw.exe' target to the build process. in file:///home/pqm/archives/thelove/bzr/2.2/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Aug 2 23:32:52 BST 2010


At file:///home/pqm/archives/thelove/bzr/2.2/

------------------------------------------------------------
revno: 5069 [merge]
revision-id: pqm at pqm.ubuntu.com-20100802223250-8e5mmqli51pmseuy
parent: pqm at pqm.ubuntu.com-20100729120106-psygyxky8i3jh7j7
parent: garyvdm at gmail.com-20100802195652-o1ppjemhwrr98i61
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.2
timestamp: Mon 2010-08-02 23:32:50 +0100
message:
  (garyvdm) Add a 'bzrw.exe' target to the build process.
added:
  tools/win32/py2exe_boot_common.py boot_common.py-20100726104937-42rsvhmwpm52nrv5-1
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
=== modified file 'NEWS'
--- a/NEWS	2010-07-29 06:45:20 +0000
+++ b/NEWS	2010-08-02 19:56:52 +0000
@@ -59,6 +59,10 @@
 * Add ``bzrlib.merge.MergeIntoMerger``, which can merge part or all of a
   tree, and works with unrelated branches.  (Andrew Bennetts)
 
+* Add py2exe windows target ``bzrw.exe``. This allow for starting a Bazaar
+  GUI with out have a console open in the background.
+  (Gary van der Merwe, #433781)
+
 Documentation
 *************
 

=== modified file 'setup.py'
--- a/setup.py	2010-07-26 10:15:32 +0000
+++ b/setup.py	2010-08-02 19:56:52 +0000
@@ -9,6 +9,7 @@
 import os
 import os.path
 import sys
+import copy
 
 if sys.version_info < (2, 4):
     sys.stderr.write("[ERROR] Not a supported Python version. Need 2.4+\n")
@@ -557,6 +558,8 @@
                                      company_name = "Canonical Ltd.",
                                      comments = META_INFO['description'],
                                     )
+    gui_target = copy.copy(target)
+    gui_target.dest_base = "bzrw"
 
     packages = BZRLIB['packages']
     packages.remove('bzrlib')
@@ -647,7 +650,7 @@
     console_targets = [target,
                        'tools/win32/bzr_postinstall.py',
                        ]
-    gui_targets = []
+    gui_targets = [gui_target]
     data_files = topics_files + plugins_files
 
     if 'qbzr' in plugins:
@@ -692,6 +695,8 @@
                                "dll_excludes": dll_excludes,
                                "dist_dir": "win32_bzr.exe",
                                "optimize": 2,
+                               "custom_boot_script":
+                                        "tools/win32/py2exe_boot_common.py",
                               },
                    }
 

=== added file 'tools/win32/py2exe_boot_common.py'
--- a/tools/win32/py2exe_boot_common.py	1970-01-01 00:00:00 +0000
+++ b/tools/win32/py2exe_boot_common.py	2010-08-02 16:12:01 +0000
@@ -0,0 +1,35 @@
+# Common py2exe boot script - executed for all target types.
+
+# In the standard py2exe boot script, it setup stderr so that anything written
+# to it will be written to exe.log, and a message dialog is shown.
+# For Bazaar, we log most things to .bzr.log, and there are many things that
+# write to stderr, that are not errors, and so we don't want the py2exe dialog
+# message, So also blackhole stderr.
+
+import sys
+if sys.frozen == "windows_exe":
+
+    class Blackhole(object):
+        softspace = 0
+        def write(self, text):
+            pass
+        def flush(self):
+            pass
+    sys.stdout = Blackhole()
+    sys.stderr = Blackhole()
+    del Blackhole
+del sys
+
+# Disable linecache.getline() which is called by
+# traceback.extract_stack() when an exception occurs to try and read
+# the filenames embedded in the packaged python code.  This is really
+# annoying on windows when the d: or e: on our build box refers to
+# someone elses removable or network drive so the getline() call
+# causes it to ask them to insert a disk in that drive.
+import linecache
+def fake_getline(filename, lineno, module_globals=None):
+    return ''
+linecache.orig_getline = linecache.getline
+linecache.getline = fake_getline
+
+del linecache, fake_getline




More information about the bazaar-commits mailing list