[pypy-svn] r7567 - in pypy/trunk/src: goal pypy/translator/tool
arigo at codespeak.net
arigo at codespeak.net
Mon Nov 22 16:20:31 CET 2004
Author: arigo
Date: Mon Nov 22 16:20:31 2004
New Revision: 7567
Modified:
pypy/trunk/src/goal/translate_pypy.py
pypy/trunk/src/pypy/translator/tool/buildpyxmodule.py
Log:
- PYPY_CC no longer has to specify the Python include path explicitely.
- added a '-tcc' option to translate_pypy.py.
- provide full path names to the compiler specified as PYPY_CC, to help
with tcc storing relative paths as debug information.
Modified: pypy/trunk/src/goal/translate_pypy.py
==============================================================================
--- pypy/trunk/src/goal/translate_pypy.py (original)
+++ pypy/trunk/src/goal/translate_pypy.py Mon Nov 22 16:20:31 2004
@@ -11,8 +11,9 @@
-o Generate and compile the C code, but don't run it
--mark-some-objects
Mark all functions that have SomeObject in their signature.
+ -tcc Equivalent to the envvar PYPY_CC='tcc -shared -o "%s.so" "%s.c"'
"""
-import autopath, sys, threading, pdb
+import autopath, sys, threading, pdb, os
from pypy.objspace.std.objspace import StdObjSpace, W_Object
from pypy.objspace.std.intobject import W_IntObject
from pypy.translator.translator import Translator
@@ -118,6 +119,7 @@
'-o': False,
'--mark-some-objects': False,
'-no-a': False,
+ '-tcc': False,
}
for arg in sys.argv[1:]:
if arg in ('-h', '--help'):
@@ -125,6 +127,8 @@
sys.exit()
assert arg in options, "unknown option %r" % (arg,)
options[arg] = True
+ if options['-tcc']:
+ os.environ['PYPY_CC'] = 'tcc -shared -o "%s.so" "%s.c"'
def about(x):
""" interactive debugging helper """
Modified: pypy/trunk/src/pypy/translator/tool/buildpyxmodule.py
==============================================================================
--- pypy/trunk/src/pypy/translator/tool/buildpyxmodule.py (original)
+++ pypy/trunk/src/pypy/translator/tool/buildpyxmodule.py Mon Nov 22 16:20:31 2004
@@ -26,11 +26,11 @@
return module
def compiler_command():
+ # e.g. for tcc, you might set this to
+ # "tcc -shared -o %s.so %s.c"
return os.getenv('PYPY_CC')
def enable_fast_compilation():
- if compiler_command():
- return # don't bother importing distutils
from distutils import sysconfig
gcv = sysconfig.get_config_vars()
opt = gcv.get('OPT') # not always existent
@@ -61,8 +61,11 @@
try:
if compiler_command():
# GCC-ish options only
- cmd = compiler_command().replace('%s', modname)
- for dir in include_dirs:
+ from distutils import sysconfig
+ gcv = sysconfig.get_config_vars()
+ cmd = compiler_command().replace('%s',
+ str(dirpath.join(modname)))
+ for dir in [gcv['INCLUDEPY']] + list(include_dirs):
cmd += ' -I%s' % dir
cmdexec(cmd)
else:
More information about the Pypy-commit
mailing list