how to add command line flags to distutils setup script?

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

skip at wrote:
> Suppose I have a 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 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.


More information about the Python-list mailing list