[pypy-svn] r20796 - in pypy/dist/pypy/translator/llvm: . module
rxe at codespeak.net
rxe at codespeak.net
Tue Dec 6 17:52:08 CET 2005
Author: rxe
Date: Tue Dec 6 17:52:07 2005
New Revision: 20796
Modified:
pypy/dist/pypy/translator/llvm/externs2ll.py
pypy/dist/pypy/translator/llvm/module/genexterns.c
Log:
Use distutils to decide where default python include files live.
Modified: pypy/dist/pypy/translator/llvm/externs2ll.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/externs2ll.py (original)
+++ pypy/dist/pypy/translator/llvm/externs2ll.py Tue Dec 6 17:52:07 2005
@@ -42,10 +42,11 @@
f.close()
plain = filename[:-2]
- cmd = "llvm-gcc -I%s -I%s -S %s.c -o %s.ll 2>&1" % (get_llvm_cpath(),
- get_c_cpath(),
- plain,
- plain)
+ cmd = "llvm-gcc -I%s -I%s -I%s -S %s.c -o %s.ll 2>&1" % (get_llvm_cpath(),
+ get_c_cpath(),
+ get_python_inc(),
+ plain,
+ plain)
os.system(cmd)
llcode = open(plain + '.ll').read()
@@ -132,6 +133,10 @@
return decls
+def get_python_inc():
+ import distutils.sysconfig
+ return distutils.sysconfig.get_python_inc()
+
def generate_llfile(db, extern_decls, entrynode, standalone):
ccode = []
function_names = []
@@ -165,17 +170,7 @@
assert False, "unhandled extern_decls %s %s %s" % (c_name, type(obj), obj)
# start building our source
- src = open(get_genexterns_path()).read()
-
- # XXX MESS: set python version to include
- if sys.platform == 'darwin':
- python_h = '"/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3/Python.h"'
- else:
- python_h = '<python2.3/Python.h>'
-
- src = src.replace('__PYTHON_H__', python_h)
-
ccode = "".join(ccode)
- ccode += src
+ ccode += open(get_genexterns_path()).read()
return get_ll(ccode, function_names)
Modified: pypy/dist/pypy/translator/llvm/module/genexterns.c
==============================================================================
--- pypy/dist/pypy/translator/llvm/module/genexterns.c (original)
+++ pypy/dist/pypy/translator/llvm/module/genexterns.c Tue Dec 6 17:52:07 2005
@@ -16,12 +16,8 @@
RPyListOfString *_RPyListOfString_New(int);
void _RPyListOfString_SetItem(RPyListOfString *, int, RPyString *);
-#include <errno.h>
-#include <locale.h>
-#include <ctype.h>
-
-// the placeholder in the next line gets replaced by the actual python.h path
-#include __PYTHON_H__
+// include this to get constants and macros for below includes
+#include <Python.h>
// overflows/zeros/values raising operations
#include "raisingop.h"
More information about the Pypy-commit
mailing list