extended options not overriding user-specified values

I'm trying to extend the install, install_lib and install_scripts commands in distutils to support some extra options that, when specified, will let me select some intelligent defaults for attributes like install_lib and install_scripts. I've figured out that I can extend the recognized options by subclassing the command classes along the following lines: class install(distutils.command.install.install): boolean_options = _install.boolean_options + [ 'my-new-option' ] def initialize_options(self): _install.initialize_options(self) self.my_new_option = 0 def finalize_options(self): _install.finalize_options(self) # manipulate attributes based on my_new_option But here's the part that has me baffled: Since the point of "my_new_option" above is to select intelligent defaults for install_lib and install_scripts, I *don't* want to override the user who explicitly specifies "--install-{lib,scripts}=/some/dir" on the command line. So... is there any way can I tell, in my finalize_options(), whether install_lib and install_scripts were set by the user or not? I've picked my way through the code, but I don't see anything that seems to support this directly. Perhaps there's a way I could use parse_command_line() or _parse_command_opts() to figure this out? If not, I suppose I could always do it by hand, too... I'd rather not code up one solution only to find that I just didn't grok that there was a better one staring me in the face. Any advice or pointers would be appreciated. Thanks! --SK
participants (1)
-
Steven Knight