[Distutils] Re: Opening up backdoors to 'setup()'
Wed Aug 30 20:08:01 2000
On 29 August 2000, Paul F. Dubois said:
> Just to be clear, I do not have any "script" I want to run. The call to
> setup is "it".
> I am doing something like apply(setup, , kw) having set up the dictionary
> I do not have a file and don't want to write one.
Right, that's what I understood. You don't have to write a file at all, all
you have to do is add a 'script_args' element to your 'kw' dict to override
sys.argv[1:]. For good form, you might need to add 'script_name' to
override sys.argv. This matters in two places: the "build_py" command
excludes 'script_name' when it does *.py to find all modules in a package,
to prevent the setup script being installed; and the "sdist" command
regenerates the MANIFEST file if it is older than 'script_name', on the
theory that you may have added or removed modules if you edited your setup
The business about a file to run is for Amos, who wants to pull random setup
scripts off the net and extract useful information from them. The
clean-looking way to do this is to pass the filename (of the setup script)
into the Distutils and ask it to do the dirty work for you.
> So far, by the way, I have not encountered a single user who was not
> completely and utterly mystified by the traceback, which as a nice side
> effect generally caused the compile error they needed to see to scroll off
Huh? Which traceback are you talking about here? Any traceback from a
setup script is a bug in the Distutils (unless it's custom code in the setup
script, can't do much about that). Any "user" errors -- either by the
installer or the developer who wrote the setup script -- *are* caught by
'setup()'; failure to catch such errors is a Distutils bug and should be
treated as such.