[Distutils] svn tagging setuptools command
Phillip J. Eby
pje at telecommunity.com
Tue Aug 30 19:52:56 CEST 2005
At 12:22 PM 8/30/2005 -0500, Ian Bicking wrote:
>Interesting, I'll have to try that out. So I'm thinking I might be able
>to have someone add this to setup.cfg:
>
> [sqlobject]
> dbmodule = mypackage.db
>
>And use that to kind of implicitly enable the SQLObject commands. At
>least, assuming I can access arbitrary sections of the config from the
>setup (since sqlobject would imply several commands). Or alterately in
>setup.py. Hrm... maybe it has to be in setup.py, though, since setup.cfg
>is only used after the command is invoked, so it can't keep the command
>from being available? Well, I suppose experimentation is in order.
setup.cfg is loaded and parsed before the command line is, but *after*
argument processing. So there isn't really a way to hook into any of that,
short of loading the config file yourself from a keyword argument
processor. It'd be better for you to define a setup() keyword like
'sqlobject_dbmodule'. See the CVS version of setuptools.txt under "Adding
``setup()`` Arguments" for detailed info.
The setup() would also have to list 'setup_requires="SQLObject>=0.7b1"' or
whatever in order to ensure that the keyword argument is recognized,
though. So, the setup might look like:
setup(
...
setup_requires=["SQLObject>=0.7b1"],
sqlobject_dbmodule = "mypackage.db",
)
And there you go. Your "sqlobject_dbmodule" entry point in the
"distutils.setup_keywords" group will then define a validation function to
check that sqlobject_dbmodule has the right type/syntax, and then insert
any useful command classes into the dist.cmdclass dictionary, making them
available before command line parsing takes place.
More information about the Distutils-SIG
mailing list