distutils and decorators

R

Robert Brewer

We're trying to get CherryPy 2.1 RC 1 out the door, but setup.py is
giving us some problems. In our test suite, we want to test a decorator
that we provide. Of course, decorators won't work in Python 2.3, so I
put the actual decorated functions into a separate module, and import it
into the test suite only when running Python 2.4:

if sys.hexversion > 0x020400A2:
from cp_decorator_tests import Exposing, ExposingNewStyle

Now "setup.py install" is complaining when run under Python 2.3, since
it tries to byte-compile every .py file. Output from a second install
run:

C:\Python23\Lib\site-packages\cptrunk>python setup.py install
running install
running build
running build_py
running install_lib
byte-compiling
C:\Python23\Lib\site-packages\cherrypy\test\cp_decorator_tests.py to
cp_decorator_tests.pyc
File
"C:\Python23\Lib\site-packages\cherrypy\test\cp_decorator_tests.py",
line 4
@cherrypy.expose("1")
^
SyntaxError: invalid syntax
running install_data


1. Is there some way to tell setup to skip the byte-compiling on that
single file, or

2. Is there some way to only ship cp_decorator_tests.py if you're
running 2.4, or

3. Is there some better way to optionally test decorators, like using
eval, or

4. other...?


Robert Brewer
System Architect
Amor Ministries
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top