fairly tight control, and the '_setup_stop_after' and '_setup_distribution'
globals to provide the tight control.
This isn't entirely reliable yet: it dies horribly with a NameError on the
example PIL setup script in examples/pil_setup.py (at least with Python
1.5.2; untested with current Python). There's some strangeness going
on with execfile(), but I don't understand it and don't have time
to track it down right now.
Changed 'core.setup()' so it sets them to reasonable defaults.
Tweaked how the "usage" string is generated: 'core' now provides
'gen_usage()', which is used instead of 'USAGE'.
Modified "build_py" and "sdist" commands to refer to
'self.distribution.script_name' rather than 'sys.argv[0]'.
the Command class from core.py to cmd.py. No other code needs changing
though; distutils.core still provides the Command and Distribution classes,
although indirectly now.
Simplified 'Command.get_peer_option()' a tad -- just call 'find_peer()'
to get the peer command object.
Updated 'Command.copy_file()' to take a 'link' parameter, just like
'util.copy_file()' does now.
Added 'Command.make_archive()' to wrap 'util.make_archive()'.
Fix 'Command.set_undefined_option()' to call 'ensure_ready()' rather
than 'finalize_options()' (which is only supposed to be called once,
which is the whole point of 'ensure_ready()').
Added comment to 'set_peer_option()' to remind myself that this method
cannot work and is fundamentally wrong-headed.
* "--help" can now come either before or after particular commands
to get help on and can give help on multiple commands, eg.
"--help install dist" gives help on those two commands
* added "--help-commands" option, implemented by the 'print_commands()'
and 'print_command_list()' methods
want no output. Still no option for a happy medium though.
Added "--help" global option.
Changed 'parse_command_line()' to recognize help options (both for the
whole distribution and per-command), and to distinguish "regular run"
and "user asked for help" by returning false in the latter case.
Also in 'parse_command_line()', detect invalid command name on command
line by catching DistutilsModuleError.
a 'negative_opt' class attribute right after 'global_options'; changed
how we call 'fancy_getopt()' accordingly.
Initialize 'maintainer' and 'maintainer_email' attributes to Distribution
to avoid AttributeError when 'author' and 'author_email' not defined.
Initialize 'help' attribute in Command constructor (to avoid
AttributeError when user *doesn't* ask for help).
In 'setup()':
* show usage message before dying when we catch DistutilsArgError
* only run commands if 'parse_command_line()' returned true (that
way, we exit immediately when a help option is found)
* catch KeyboardInterrupt and IOError from running commands
Bulked up usage message to show --help options.
Comment, docstring, and error message tweaks.
global options table.
Every Command instance now has its own copies of the global options,
which automatically fallback to the Distribution instance. Changes:
- initialize them in constructor
- added '__getattr__()' to handle the fallback logic
- changed every 'self.distribution.{verbose,dry_run}' in Command to
'self.{verbose,dry_run}'.
- filesystem utility methods ('copy_file()' et al) don't take 'update'
parameter anymore -- instead we pass 'not force' to the underlying
function as 'update'
Changed parsing of command line so that global options apply to all
commands as well -- that's how (eg.) Command.verbose will be initialized.
Simplified 'make_file()' to use 'newer_group()' (from util module).
Deleted some cruft.
Some docstring tweaks.
they make sure that 'set_final_options()' has been called, but isn't
called redundantly.
Changed Distribution to call 'ensure_ready()' where it used to call
'set_final_options()', and in a few extra places as well.
Lots of comment/docstring revisions and additions in both classes.
New one-liner utility methods in Command: 'find_peer()', 'spawn()'.
'alias_options' table and getting rid of some hairy code in the
Distribution constructor.
Resurrected the distribution options that describe the modules present
in the module distribution ('py_modules', 'ext_modules'), and added
a bunch more: 'packages', 'package_dir', 'ext_package', 'include_dirs',
'install_path'.
Updated some comments.
Added 'warn()' method to Command.
'Command.get_command_name()' now stores generated command name in
self.command_name.
attributes, etc. Biggest change was to the Distribution constructor
-- it now looks for an 'options' attribute, which contains values
(options) that are explicitly farmed out to the commands. Also,
certain options supplied to Distribution (ie. in the 'setup()' call in
setup.py) are now "command option aliases", meaning they are dropped
right into a certain command rather than being distribution options.
This is handled by a new Distribution class attribute,
'alias_options'.
Various comment changes to reflect the new way-of-thinking.
Added 'get_command_name()' method to Command -- was assuming its
existence all along as 'command_name()', so changed the code that
needs it to call 'get_command_name()'.
'run_command()' to refer to it before attempting to run a command --
that way, command classes can freely invoke other commands without fear
of duplicate execution.
Beefed up some comments and docstrings.
meaningful return values: respectively, whether the copy was done, and
the list of files that were copied. This meant some trivial changes in
core.py as well: the Command methods that mirror 'copy_file()' and
'copy_tree()' have to pass on their return values.
and dry-run flags consistently painless): 'execute()', 'mkpath()',
'copy_file()', 'copy_tree()', 'make_file()', and stub for 'make_files()'
(not sure yet if it's useful).