diff --git a/setupext.py b/setupext.py index de784f051d5f..ba74045077f8 100644 --- a/setupext.py +++ b/setupext.py @@ -1270,6 +1270,8 @@ def get_extension(self): ext = make_extension('matplotlib.backends._macosx', sources) ext.extra_link_args.extend(['-framework', 'Cocoa']) + if platform.python_implementation().lower() == 'pypy': + ext.extra_compile_args.append('-DPYPY=1') return ext diff --git a/src/_macosx.m b/src/_macosx.m index 4f025268ef8d..8ec3ebfae01d 100644 --- a/src/_macosx.m +++ b/src/_macosx.m @@ -3,8 +3,10 @@ #include #include +#ifndef PYPY /* Remove this once Python is fixed: https://bugs.python.org/issue23237 */ #define PYOSINPUTHOOK_REPETITIVE 1 +#endif /* Proper way to check for the OS X version we are compiling for, from http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_development */ @@ -277,7 +279,9 @@ static void lazy_init(void) { NSApp = [NSApplication sharedApplication]; +#ifndef PYPY PyOS_InputHook = wait_for_stdin; +#endif NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; WindowServerConnectionManager* connectionManager = [WindowServerConnectionManager sharedManager];