PATCH: Repair Windows builds

Mark Mitchell mark at codesourcery.com
Wed May 26 01:27:30 UTC 2004


This patch fixes two problems on Windows.  The first was that we were
trying to write out the "uname" annotation on Windows, but it's None,
which causes a crash.  The second was that "import qm.sigmask" in a
local -- unexecuted -- scope causes Python 2.2.3 to complain about
uninitialized local variables.  The fix is to move the "import" to the
global scope, which IIRC, is the only place it is guaranteed to work
according to the Python spec.

--
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery.com

2004-05-25  Mark Mitchell  <mark at codesourcery.com>

	* qm/test/execution_engine.py
	(ExecutionEngine._WriteInitialAnnotations): Check that uname is
	not None before trying to write it out.
	* qm/test/qmtest (qm.sigmask): Import it in the global scope, not
	...
	(main): ... here.

Index: qm/test/execution_engine.py
===================================================================
RCS file: /home/qm/Repository/qm/qm/test/execution_engine.py,v
retrieving revision 1.28
diff -c -5 -p -r1.28 execution_engine.py
*** qm/test/execution_engine.py	31 Mar 2004 10:32:44 -0000	1.28
--- qm/test/execution_engine.py	26 May 2004 01:20:43 -0000
*************** class ExecutionEngine:
*** 839,849 ****
              if username is not None:
                  rs.WriteAnnotation("qmtest.run.username", username)
              if userid is not None:
                  rs.WriteAnnotation("qmtest.run.userid", userid)
              rs.WriteAnnotation("qmtest.run.version", qm.version)
!             rs.WriteAnnotation("qmtest.run.uname", uname)
              rs.WriteAnnotation("qmtest.run.command_line", args_str)
  
  
  ########################################################################
  # Local Variables:
--- 839,850 ----
              if username is not None:
                  rs.WriteAnnotation("qmtest.run.username", username)
              if userid is not None:
                  rs.WriteAnnotation("qmtest.run.userid", userid)
              rs.WriteAnnotation("qmtest.run.version", qm.version)
!             if uname is not None:
!                 rs.WriteAnnotation("qmtest.run.uname", uname)
              rs.WriteAnnotation("qmtest.run.command_line", args_str)
  
  
  ########################################################################
  # Local Variables:
Index: qm/test/qmtest
===================================================================
RCS file: /home/qm/Repository/qm/qm/test/qmtest,v
retrieving revision 1.4
diff -c -5 -p -r1.4 qmtest
*** qm/test/qmtest	6 May 2004 00:35:35 -0000	1.4
--- qm/test/qmtest	26 May 2004 01:20:43 -0000
*************** qm.prefix = qm_home
*** 86,95 ****
--- 86,97 ----
  import qm.cmdline
  import qm.diagnostic
  import qm.platform
  import qm.structured_text
  import qm.test.cmdline
+ if sys.platform != "win32":
+     import qm.sigmask
  
  ########################################################################
  # Functions
  ########################################################################
  
*************** def main():
*** 129,139 ****
      # Make sure our Python is recent enough.
      check_python_version()
  
      # Save the initial signal mask, as early as possible.
      if sys.platform != "win32":
-         import qm.sigmask
          qm.sigmask.save_mask()
  
      # Parse the command line.
      command = qm.test.cmdline.QMTest(sys.argv[1:], qm_path)
  
--- 131,140 ----



More information about the qmtest mailing list