[pypy-svn] r62674 - in pypy/trunk/pypy/translator/platform: . test
santagada at codespeak.net
santagada at codespeak.net
Sat Mar 7 00:24:47 CET 2009
Author: santagada
Date: Sat Mar 7 00:24:47 2009
New Revision: 62674
Added:
pypy/trunk/pypy/translator/platform/test/test_darwin.py (contents, props changed)
Modified:
pypy/trunk/pypy/translator/platform/darwin.py
Log:
implemented support for frameworks on the darwin platform and a test for it.
Modified: pypy/trunk/pypy/translator/platform/darwin.py
==============================================================================
--- pypy/trunk/pypy/translator/platform/darwin.py (original)
+++ pypy/trunk/pypy/translator/platform/darwin.py Sat Mar 7 00:24:47 2009
@@ -31,3 +31,16 @@
# currently __thread is not supported by Darwin gccs
return False
+ def _frameworks(self, frameworks):
+ args = []
+ for f in frameworks:
+ args.append('-framework')
+ args.append(f)
+ return args
+
+ def _link_args_from_eci(self, eci):
+ args = super(Darwin, self)._link_args_from_eci(eci)
+ frameworks = self._frameworks(eci.frameworks)
+ include_dirs = self._includedirs(eci.include_dirs)
+ return (args + frameworks + include_dirs)
+
Added: pypy/trunk/pypy/translator/platform/test/test_darwin.py
==============================================================================
--- (empty file)
+++ pypy/trunk/pypy/translator/platform/test/test_darwin.py Sat Mar 7 00:24:47 2009
@@ -0,0 +1,38 @@
+
+""" File containing darwin platform tests
+"""
+
+import py
+from pypy.tool.udir import udir
+from pypy.translator.platform.darwin import Darwin
+from pypy.translator.platform.test.test_platform import TestPlatform as BasicTest
+from pypy.translator.tool.cbuild import ExternalCompilationInfo
+
+class TestDarwin(BasicTest):
+ platform = Darwin()
+
+ def test_frameworks(self):
+ objcfile = udir.join('test_simple.m')
+ objcfile.write(r'''
+ #import <Foundation/Foundation.h>
+ #include "test.h"
+
+ int main (int argc, const char * argv[]) {
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ NSArray *args = [[NSProcessInfo processInfo] arguments];
+ NSCountedSet *cset = [[NSCountedSet alloc] initWithArray:args];
+
+ printf("%d\n", XXX_STUFF);
+
+ [cset release];
+ [pool release];
+ return 0;
+ }
+ ''')
+ includedir = py.magic.autopath().dirpath().join('include')
+ eci = ExternalCompilationInfo(frameworks=('Cocoa',),
+ include_dirs=(includedir,))
+ executable = self.platform.compile([objcfile], eci)
+ res = self.platform.execute(executable)
+ self.check_res(res)
+
More information about the Pypy-commit
mailing list