Files
MINGW-packages/mingw-w64-python3/0760-msys-monkeypatch-os-system-via-sh-exe.patch
2014-10-11 14:46:25 +01:00

22 lines
818 B
Diff

diff -urN a/setup.py b/setup.py
--- a/setup.py 2014-10-11 14:22:49.750443100 +0100
+++ b/setup.py 2014-10-11 14:22:52.319590000 +0100
@@ -35,6 +35,17 @@
return sys.platform
host_platform = get_platform()
+# On MSYS, os.system needs to be wrapped with sh.exe
+# as otherwise all the io redirection will fail.
+# Arguably, this could happen inside the real os.system
+# rather than this monkey patch.
+if sys.platform == "win32" and "MSYSTEM" in os.environ:
+ os_system = os.system
+ def msys_system(command):
+ command_in_sh = 'sh.exe -c "%s"' % command.replace("\\", "\\\\")
+ return os_system(command_in_sh)
+ os.system = msys_system
+
# Were we compiled --with-pydebug or with #define Py_DEBUG?
COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))