how to add command line flags to distutils setup script?

"Martin v. Löwis" martin at v.loewis.de
Tue Dec 9 02:08:19 CET 2008


skip at pobox.com wrote:
> Suppose I have a setup.py script which imports distutils.core.setup.  Is
> there some way to, for example, add a command line flag to the build command
> so that I can run it like
> 
>     python setup.py build --frob=True
> 
> ? 

You should inherit from the build command, extend the user_options
attribute, and pass the new class as "build" class into the commands
dictionary of setup. You might need to extend initialize_options and
finalize_options as well.

Regards,
Martin



More information about the Python-list mailing list