GNOME Bugzilla – Bug 724880
GI does not run under MSYS+W32-CPython correctly
Last modified: 2015-02-07 16:53:17 UTC
W32 CPython can only run .exe files via subprocess. To run other things (like scripts) an interpreter must be specified explicitly. A generic workaround is to create a shell script, put the command in there, then run the script with a shell. This way GI can run anything that shell can. MSYS is detected by a presence of the MSYSTEM environment variable, shell is taken from the SHELL environment variable (subprocess needs an absolute path, so a which() implementation is used to find the shell).
Created attachment 269906 [details] [review] Support running under MSYS
Review of attachment 269906 [details] [review]: Coding style is inconsistent with the rest of the code - no spaces between identifier and paren. I fixed that up. ::: giscanner/dumper.py @@ +303,3 @@ + tf, tf_name = tempfile.mkstemp () + f = os.fdopen (tf, 'wb') + fcontents = '#!/bin/sh\nunset PWD\n{}\n'.format (' '.join ([x.replace ('\\','/') for x in args])) This is kind of hacky it feels like we could just ship this script as an internal helper rather than generate it each run. But...eh, it's OK. @@ +316,3 @@ + else: + if msys: + os.remove (tf_name) This can be deduplicated inside a "finally:" block. I did so.
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]