6

is there any way to use this regex module with pypy?

https://pypi.python.org/pypi/regex

or any alternative regex module that works with pypy and has the features of this regex module. I did copy regex module files from my python installation into pypys lib_pypy folder, but i cannot import this module, the error is:

ImportError: No module named _regex

it seems that it cannot import _regex.pyd file. I'm using pypy3-2.1-beta1-win32, windows xp.

I also tried building the library with pypy:

pypy setup.py build -c mingw32

and i've got this error:

error: package directory 'Python3' does not exist

I tried removing package_dir={'': PKG_BASE} from setup.py and retry the build, and then there was another error:

File "...\pypy3-2.1-beta1-win32\lib-python\3\distutils\cygwinccompiler.py", line 352, in check_config_h
    fn = sysconfig.get_config_h_filename()
AttributeError: 'module' object has no attribute 'get_config_h_filename'
Pooya Eghbali
  • 209
  • 2
  • 6

1 Answers1

2

I'm afraid the library would have to be adapted to work with PyPy—PyPy doesn't support the same C extension mechanism CPython does. Also, I'm not sure if Python 3 support is ready or even usable in PyPy as of yet: they're still collecting donations for the py3k PyPy sub-project as per the right side of the home page of their site: http://pypy.org.

As to the C extension problem, if you have the time and willingness, you can try to port the library to use the CFFI module of PyPy (import cffi) to call into the C parts of regex. Luckily, as per http://doc.pypy.org/en/latest/release-2.0.0-beta2.html, CFFI is now built in to PyPy.

Erik Kaplun
  • 37,128
  • 15
  • 99
  • 111