[Distutils] passing options to Command from setup.py

Tarek Ziadé ziade.tarek at gmail.com
Wed Sep 2 12:32:52 CEST 2009

2009/9/2 Sébastien Barthélemy <barthelemy at crans.org>:
> Hello,
> is there a way to pass options to a custom distutils.core.Command from
> setup.py instead of setup.cfg ? I could not find any doc about that.
> Thanks !


when you create a command, you can define options (look at any command
in dstutils/command)
then you can pass these options either in the command line (1), either
in the setup() arguments (2)
either in a cfg file.

1) command line:

$ python setup.py my_command --my-option=foo

2) in setup.py:

setup(command_options={'my_command': {'my_option': ('setup.py', 'foo') } })

(the "setup.py" value is just a source value that is not actually used
here. it's used
when command_options is built from .cfg files)

3) in a cfg file

my_option = foo


Tarek Ziadé | http://ziade.org

More information about the Distutils-SIG mailing list