Problems with python optimization setting

Braddock braddock at braddock.com
Sat Jul 6 22:47:17 EDT 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi guys,
Working on Internet-in-a-Box integration with OLPC School Server CE.

There are multiple problems caused by the python optimization setting
in OLPC OS 13.1.0.

PYTHONOPTIMIZE=2 is set in /etc/profile.d/zzz_olpc.sh

It causes Python to generate lightly optimized .pyo files instead of
.pyc files.

This breaks virtualenv and building python packages into RPMs.  Both
these problems go away with an 'unset PYTHONOPTIMIZE'

$ virtualenv v
New python executable in v/bin/python
ImportError: Bad magic number in /tmp/v/lib/python2.7/site.pyo
ERROR: The executable v/bin/python is not functioning
ERROR: It thinks sys.prefix is u'/tmp' (should be u'/tmp/v')
ERROR: virtualenv is not compatible with this system or executable


This also breaks building of Python packages into RPMs.  For a failing
example:

wget
https://pypi.python.org/packages/source/b/backports.lzma/backports.lzma-0.0.2.tar.gz
tar xzf backports.lzma-0.0.2.tar.gz
(cd backports.lzma-0.0.2; python setup.py bdist_rpm)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJR2Na1AAoJEHWLR/DQzlZuhfAH/3Um5xAQAirjt6FHyswa/KLg
ZfN2Sf1LVZRIXPIjZ8av4BqOJqOnYD3giqrX1tTymWQcaL9sjb5MOXRyWGcd44w8
ZUYgdEJBa6LBTssNukIZL6+DKtaGFNYuJfRB8OnZzrCmaIQL36UBfNTKL65MxUJI
z7+c3b90PQgJ063AM6gOcpu8dsfFZZbvep9PG7neechee23Rx2FH3MItY9wSNHoM
I2sUjrRiATdX8wXWyvo1Yu70wHLFJ2Ndv9kov/OICJCjIH+odXFPfq8DjJUlAZV/
IY4w2GWsBJMzbyRR1LMQ/Pql6BYqPX12N+15fGe5Txmyo9JkAIRm3A6IGKWAy2o=
=7X6D
-----END PGP SIGNATURE-----



More information about the Devel mailing list