openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #08063
[Bug 939653] Re: Install / RedHat 6.2 / pip fails with InstallationError
Hello,
That is quite unfortunately caused by a bug in certain Python 2.6
versions on RedHat/CentOS. OpenERP uses standard Python 2.6 features
that seem to work on all other Python 2.6 platforms.
As discussed on Launchpad answer #185679 and in the forum [1], it seems
that on affected Python 2.6 versions it is impossible to nest more than
4 "if" filters in a list comprehension expression.
The ir.model class uses a list comprehension expression with 5 nested
ifs:
def _get_fields_type(self, cr, uid, context=None):
return sorted([(k,k) for k,v in fields.__dict__.iteritems()
if type(v) == types.TypeType
if issubclass(v, fields._column)
if v != fields._column
if not v._deprecated
if not issubclass(v, fields.function)])
We could implement a workaround for CentOS in this specific case, but it does not guarantee that we will not see other similar (but less obvious) cases of this same problem, because it breaks our fundamental hypothesis of "cross-platformness" of Python!
My google skills did not reveal any obvious bug report on Fedora/CentOS/RedHat, so it would perhaps be a good idea to report this upstream and get it fixed where it should be.
One way to rewrite the above code without so many nested `if`s is to
simply replace them with `and`s:
def _get_fields_type(self, cr, uid, context=None):
return sorted([(k,k) for k,v in fields.__dict__.iteritems()
if type(v) == types.TypeType and \
issubclass(v, fields._column) and \
v != fields._column and \
not v._deprecated and \
not issubclass(v, fields.function)])
[1] http://www.openerp.com/forum/topic30304.html
** Changed in: openobject-addons
Importance: Undecided => Low
** Changed in: openobject-addons
Status: Invalid => Confirmed
** Changed in: openobject-addons
Assignee: (unassigned) => OpenERP's Framework R&D (openerp-dev-framework)
** Project changed: openobject-addons => openobject-server
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/939653
Title:
Install / RedHat 6.2 / pip fails with InstallationError
Status in OpenERP Server:
Confirmed
Bug description:
This is with official 6.1 openerp downloaded here http://nightly.openerp.com/6.1/releases/openerp-6.1-1.tar.gz
Followed the README
The last step (# pip install .) fails with the following message:
...
copying and adjusting openerp-server -> build/scripts-2.6
changing mode of build/scripts-2.6/openerp-server from 644 to 755
running install_lib
byte-compiling /usr/lib/python2.6/site-
packages/openerp/addons/base/ir/ir_model.py to ir_model.pyc
python: Python/compile.c:3437: stackdepth_walk: Assertion `depth >= 0'
failed.
----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-
g0BVFR-
build/setup.py';exec(compile(open(__file__).read().replace('\r\n',
'\n'), __file__, 'exec'))" install --single-version-externally-managed
--record /tmp/pip-Zjgm4Z-record/install-record.txt failed with error
code -6 in /tmp/pip-g0BVFR-build
Exception information:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/pip-1.1-py2.6.egg/pip/basecommand.py", line 104, in main
status = self.run(options, args)
File "/usr/lib/python2.6/site-packages/pip-1.1-py2.6.egg/pip/commands/install.py", line 250, in run
requirement_set.install(install_options, global_options)
File "/usr/lib/python2.6/site-packages/pip-1.1-py2.6.egg/pip/req.py", line 1133, in install
requirement.install(install_options, global_options)
File "/usr/lib/python2.6/site-packages/pip-1.1-py2.6.egg/pip/req.py", line 577, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File "/usr/lib/python2.6/site-packages/pip-1.1-py2.6.egg/pip/__init__.py", line 256, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-g0BVFR-build/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-Zjgm4Z-record/install-record.txt failed with error code -6 in /tmp/pip-g0BVFR-build
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/939653/+subscriptions
References