Community: Framework mailing list archives

expert-framework@mail.odoo.com

PyPy

by
Nicolas PIGANEAU
- 05/29/2015 12:09:06
Hi, 

Has anyone tried to run Odoo on PyPy recently ? 

On my side, I used: 
- lxml-cffi from git://github.com/amauryfa/lxml.git 
- latest gevent sources (after merging https://github.com/gevent/gevent/pull/552 ) 
- psycopg2cffi and psycopg2cffi-compat (pip install)

I had also to patch Odoo sources to add pypy opcodes to safe_eval: 

--- ../GitHub/odoo/openerp/tools/safe_eval.py	(date 1432802291000)
+++ ../GitHub/odoo/openerp/tools/safe_eval.py	(date 1432901508000)
@@ -69,6 +69,7 @@
 
 _SAFE_OPCODES = _EXPR_OPCODES.union(set(opmap[x] for x in [
     'LOAD_NAME', 'CALL_FUNCTION', 'COMPARE_OP', 'LOAD_ATTR',
+    'CALL_METHOD','LOOKUP_METHOD',
     'STORE_NAME', 'GET_ITER', 'FOR_ITER', 'LIST_APPEND', 'DELETE_NAME',
     'JUMP_FORWARD', 'JUMP_IF_TRUE', 'JUMP_IF_FALSE', 'JUMP_ABSOLUTE',
     'MAKE_FUNCTION', 'SLICE+0', 'SLICE+1', 'SLICE+2', 'SLICE+3', 'BREAK_LOOP',


And also add this one if I wanted to start in multi-worker mode (for some reason pypy complained they were float instead of int): 

--- ../GitHub/odoo/openerp/service/server.py	(date 1432802291000)
+++ ../GitHub/odoo/openerp/service/server.py	(date 1432901508000)
@@ -713,7 +713,7 @@
             raise Exception('CPU time limit exceeded.')
         signal.signal(signal.SIGXCPU, time_expired)
         soft, hard = resource.getrlimit(resource.RLIMIT_CPU)
-        resource.setrlimit(resource.RLIMIT_CPU, (cpu_time + config['limit_time_cpu'], hard))
+        resource.setrlimit(resource.RLIMIT_CPU, (int(cpu_time + config['limit_time_cpu']), hard))
 
     def process_work(self):
         pass


Then my server starts all right and I am able to go to the database manager page.
Creating a database seems to work, but it is then impossible to load the created database. Indeed, it seems some imports have been skipped.
In particular, ir_model_data is only filled with xml_ids of the base module.

So I created a database from a cpython instance and accessed it through my pypy instance. I could login, but then the loading stopped after 
displaying the top menu. A look in firebug showed that JS complained about "nv" not being defined in graph_widget.js. 

So I checked what had been loaded, and found out that only one every other scripts had been loaded from this module, but also from all 
other modules. Same goes for css files: one loaded, one skipped, one loaded, etc. for each line of the assets_backend extension template 
(web_graph/views/web_graph.xml in this case).

I suppose this an issue linked with lxml, that sort of misses one line every two lines but I haven't got a clue on where to go now. 

Any idea or experience on this?

Thanks !

Nicolas PIGANEAU

-------------------
NDP Systèmes
06 68 93 87 56
http://www.ndp-systemes.fr