[Distutils] bugfix for GUI.exe launcher

Alexander Michael lxander.m at gmail.com
Thu Jan 3 23:49:38 CET 2008


On Jan 3, 2008 4:12 PM, Phillip J. Eby <pje at telecommunity.com> wrote:
> At 02:22 PM 1/3/2008 -0500, Alexander Michael wrote:
> >I raised this issue in the beginning of December [1]_ but haven't
> >received a response yet (nor have I seen it corrected in the SVN). I
> >would like to see this corrected, but I was under the impression that
> >bug reports for setuptools should be sent to the distutils-sig
> >mailling list. Do you know how we should next proceed to get this
> >fixed?
>
> I've been having difficulty reproducing the error, so it's hard for
> me to confirm that the patch fixes it.  If somebody wants to extend
> their patch to include a test that fails on their system without the
> patch but succeeds with it, I'd be happy to go ahead and include it.
>
> See setuptools/tests/win_script_wrapper.txt for the existing test
> code, which currently only covers the CLI wrapper, not the GUI one.

I've added a test for the GUI wrapper to the referenced file, which I've
attached. Running doctest in verbose mode on it produces:

**********************************************************************
File "win_script_wrapper.txt", line 129, in win_script_wrapper.txt
Failed example:
    print output.read()
Expected:
    <BLANKLINE>
Got:
    Could not exec #!C:\Python25\python.exe
**********************************************************************
File "win_script_wrapper.txt", line 131, in win_script_wrapper.txt
Failed example:
    print open(os.path.join(sample_directory, 'test_output.txt'), 'rb').read()
Exception raised:
    Traceback (most recent call last):
      File "C:\Python25\lib\doctest.py", line 1212, in __run
        compileflags, 1) in test.globs
      File "<doctest win_script_wrapper.txt[25]>", line 1, in <module>
        print open(os.path.join(sample_directory, 'test_output.txt'),
'rb').read()
    IOError: [Errno 2] No such file or directory:
'c:\\docume~1\\alex\\locals~1\\temp\\tmpccuxgd\\test_output.txt'
**********************************************************************
1 items had failures:
   2 of  28 in win_script_wrapper.txt
***Test Failed*** 2 failures.

This test passes with the modifications:

*** launcher.c.orig     Thu Jan  3 17:19:54 2008
--- launcher.c  Tue Dec 18 09:37:21 2007
*************** int run(int argc, char **argv, int is_gu
*** 231,238 ****

      if (is_gui) {
          /* Use exec, we don't need to wait for the GUI to finish */
!         execv(python, (const char * const *)(newargs));
!         return fail("Could not exec %s", python);   /* shouldn't get here! */
      }

      /* We *do* need to wait for a CLI to finish, so use spawn */
--- 231,238 ----

      if (is_gui) {
          /* Use exec, we don't need to wait for the GUI to finish */
!         execv(ptr, (const char * const *)(newargs));
!         return fail("Could not exec %s", ptr);   /* shouldn't get here! */
      }

      /* We *do* need to wait for a CLI to finish, so use spawn */

Thank you!
Alex
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: win_script_wrapper.txt
Url: http://mail.python.org/pipermail/distutils-sig/attachments/20080103/ebe1bba8/attachment-0001.txt 


More information about the Distutils-SIG mailing list