[pypy-commit] pypy py3k-test-cpyext: hg merge test-cpyext
rlamy
pypy.commits at gmail.com
Mon Oct 3 15:00:59 EDT 2016
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3k-test-cpyext
Changeset: r87551:f07101bd8ca8
Date: 2016-10-03 20:00 +0100
http://bitbucket.org/pypy/pypy/changeset/f07101bd8ca8/
Log: hg merge test-cpyext
diff --git a/pypy/module/cpyext/test/conftest.py b/pypy/module/cpyext/test/conftest.py
--- a/pypy/module/cpyext/test/conftest.py
+++ b/pypy/module/cpyext/test/conftest.py
@@ -3,6 +3,10 @@
def pytest_configure(config):
if config.option.runappdirect:
+ import sys
+ import py
+ from pypy import pypydir
+ sys.path.append(str(py.path.local(pypydir) / 'tool' / 'cpyext'))
return
from pypy.tool.pytest.objspace import gettestobjspace
# For some reason (probably a ll2ctypes cache issue on linux64)
diff --git a/pypy/module/cpyext/test/test_cpyext.py b/pypy/module/cpyext/test/test_cpyext.py
--- a/pypy/module/cpyext/test/test_cpyext.py
+++ b/pypy/module/cpyext/test/test_cpyext.py
@@ -243,12 +243,12 @@
PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)
cls.w_import_module = w_import_module
- def w_import_extension(self, modname, w_functions, prologue="",
+ def w_import_extension(self, modname, functions, prologue="",
include_dirs=None, more_init="", PY_SSIZE_T_CLEAN=False):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.import_extension(
- modname, w_functions, prologue=prologue,
+ modname, functions, prologue=prologue,
include_dirs=include_dirs, more_init=more_init,
PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)
cls.w_import_extension = w_import_extension
diff --git a/pypy/tool/cpyext/__init__.py b/pypy/tool/cpyext/__init__.py
new file mode 100644
--- /dev/null
+++ b/pypy/tool/cpyext/__init__.py
@@ -0,0 +1,4 @@
+"""
+Support code for pypy/module/cpyext/test/. This is here so that it can be
+imported by Python3 when running -A tests.
+"""
diff --git a/pypy/tool/cpyext/extbuild.py b/pypy/tool/cpyext/extbuild.py
--- a/pypy/tool/cpyext/extbuild.py
+++ b/pypy/tool/cpyext/extbuild.py
@@ -2,7 +2,6 @@
import sys
import py
from pypy import pypydir
-from rpython.translator.gensupp import uniquemodulename
if os.name != 'nt':
so_ext = 'so'
@@ -25,6 +24,13 @@
self.extra_libs = extra_libs
self.ext = ext
+ def get_builddir(self, name):
+ builddir = py.path.local.make_numbered_dir(
+ rootdir=py.path.local(self.builddir_base),
+ prefix=name + '-',
+ keep=0) # keep everything
+ return builddir
+
def compile_extension_module(self, name, include_dirs=None,
source_files=None, source_strings=None):
"""
@@ -33,18 +39,15 @@
name is the name of the module, possibly including dots if it is a
module inside a package.
-
- Any extra keyword arguments are passed on to ExternalCompilationInfo to
- build the module (so specify your source with one of those).
"""
include_dirs = include_dirs or []
modname = name.split('.')[-1]
- dirname = (py.path.local(self.builddir_base)/uniquemodulename('module')).ensure(dir=1)
+ dirname = self.get_builddir(name=modname)
if source_strings:
assert not source_files
files = convert_sources_to_files(source_strings, dirname)
source_files = files
- soname = c_compile(source_files, outputfilename=str(dirname/modname),
+ soname = c_compile(source_files, outputfilename=str(dirname / modname),
compile_extra=self.compile_extra,
link_extra=self.link_extra,
include_dirs=self.include_extra + include_dirs,
@@ -148,9 +151,10 @@
PyInit_%(name)s(void) {
%(init)s
}
- """ % dict(name=name, init=init, body=body,
- PY_SSIZE_T_CLEAN='#define PY_SSIZE_T_CLEAN'
- if PY_SSIZE_T_CLEAN else '')
+ """ % dict(
+ name=name, init=init, body=body,
+ PY_SSIZE_T_CLEAN='#define PY_SSIZE_T_CLEAN'
+ if PY_SSIZE_T_CLEAN else '')
return code
@@ -163,7 +167,7 @@
libraries = libraries or []
library_dirs = library_dirs or []
if sys.platform == 'win32':
- link_extra = link_extra + ['/DEBUG'] # generate .pdb file
+ link_extra = link_extra + ['/DEBUG'] # generate .pdb file
if sys.platform == 'darwin':
# support Fink & Darwinports
for s in ('/sw/', '/opt/local/'):
@@ -193,7 +197,7 @@
from distutils.ccompiler import new_compiler
from distutils import sysconfig
compiler = new_compiler(force=1)
- sysconfig.customize_compiler(compiler) # XXX
+ sysconfig.customize_compiler(compiler) # XXX
objects = []
for cfile in cfilenames:
cfile = py.path.local(cfile)
More information about the pypy-commit
mailing list