[Distutils] Skipping compilation of some .py files on "install"?
Barry A. Warsaw
barry@zope.com
Sat May 25 12:10:02 2002
The email package has two files to help it maintain compatibility with
Python 2.1 and Python 2.2+. There's a _compat21.py and a _compat22.py
that contains tricky bits that are different between the two Python
versions. Other code that needs something out of these modules, first
tries to import _compat22.py, wrapping this import so that if errors
occur, it backs down to _compat21.py.
The problem comes when I do "python2.1 setup.py install", which tries
to bytecompile all the .py files. Naturally Python 2.1 won't be able
to compile _compat22.py and indeed you get a SyntaxError.
Is there a way -- in my setup.py -- that I can first detected which
Python version I'm using (should be easy), and then skip byte
compilation of _compat22.py when I find I'm using Python 2.1?
Thanks,
-Barry