How to install with -O?

Aahz aahz at pythoncraft.com
Thu Dec 5 23:54:36 EST 2002


[First of all, please don't top-post; notice that it's more difficult to
read this:

A: No.
Q: Is top-posting okay?
]


In article <mailman.1038601365.18263.python-list at python.org>,
Michael Gilfix  <mgilfix at eecs.tufts.edu> wrote:
>On Thu, Nov 28 @ 19:56, Aahz wrote:
>> In article <mailman.1038511660.30945.python-list at python.org>,
>> Michael Gilfix  <mgilfix at eecs.tufts.edu> wrote:
>>>
>>>  Hi all. I've been using __debug__ in my python programs with the
>>>hope to byte-compile my programs with -O on install and remove the
>>>__debug__ code. However, I haven't figured out quite how to do this
>>>with distutils, and some searching through the documentation didn't
>>>reveal anything. Has anyone solved this problem?
>> 
>> Unfortunately, there are only two ways to force optimized mode: running
>> "python -O" and setting PYTHONOPTIMIZE.
>
>  Hi Aahz. So, I can just set the PYTHONOPTIMIZE variable in my
>setup.py and python will take care of itself (both in unix n'
>windows)? Perhaps I should work on a distutils patch...

Well, no.  You need to convince your user to set PYTHONOPTIMIZE, though
with Windows you may be able to modify the registry directly.  A better
idea is probably to distribute your application with a batch file that
sets PYTHONOPTIMIZE before running your app, and tell your users to run
from the batch file.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"To me vi is Zen.  To use vi is to practice zen.  Every command is a
koan.  Profound to the user, unintelligible to the uninitiated.  You
discover truth everytime you use it."  --reddy at lion.austin.ibm.com



More information about the Python-list mailing list