Hi,

I am currently using CPython 2 extensions and code in a project that's mostly written in C. I've been moving the extensions from the CPython API to PyPy/CFFI; but now I'm struggling with integrating the CFFI extensions into the Autotools build process.

With CPython, there is the autoconf macro `AM_PATH_PYTHON' for determining the interpreter path and module directories[0]. Is there anything similar for PyPy?

In order to build and install the extension modules correctly, I need to find out the appropriate

  (1) .so filename extension,
  (2) compiler flags,
  (3) linker flags, and
  (4) installation directory.

Finding out the flags works the same as it does in CPython 3,

  >>>> from distutils.ccompiler import new_compiler
  >>>> from distutils.sysconfig import customize_compiler
  >>>> c = new_compiler()
  >>>> customize_compiler(c)
  >>>> c.compiler_so[1:]
  ['-pthread', '-DNDEBUG', '-O2', '-fPIC']
  >>>> c.linker_so[1:]
  ['-pthread', '-shared']

but finding out the .so filename

  >>> import _imp
  >>> _imp.extension_suffixes()[0]
  '.cpython-37m-x86_64-linux-gnu.so'

doesn't work with PyPy:

  >>>> import _imp
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  ImportError: No module named _imp

How do I determine the correct filename extension for PyPy extension modules?

Roland


[0] https://www.gnu.org/software/automake/manual/html_node/Python.html

_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to