Commit Graph

514 Commits

Author SHA1 Message Date
Greg Ward fcd974efbb Normalized all the end-of-class lines. 2000-05-25 01:10:04 +00:00
Greg Ward a570c05997 Catch failure to open installed Makefile, and report it as a
DistutilsPlatformError: "invalid Python installation".  (This will
happen on Red Hat-ish systems where the python-devel package is not
installed.)
2000-05-23 23:14:00 +00:00
Greg Ward 40313cfe6e Fix 'get_command_obj()' so it checks if a command object has an attribute
before setting it -- this will catch bad options (eg. typos) in config files.
2000-05-23 04:11:14 +00:00
Greg Ward 77751c0b49 Added some debuging output (actually moved here from dist.py) --
dump the Distribution's 'command_options' dict after parsing config files,
and then after parsing the command line.
2000-05-23 03:54:16 +00:00
Greg Ward 981f7368f6 Don't take advantage of OptionDummy's new "auto-initialization" feature
after all -- turns out it doesn't buy us much after all...
2000-05-23 03:53:10 +00:00
Greg Ward 474607777d Fixed so options from config files and command lines actually work:
* 'get_command_obj()' now sets command attributes based on
    the 'command_options' dictionary
  * some typos fixed
  * kludged 'parse_config_files()' to re-initialize the ConfigParser
    instance after each file, so we know for sure which config
    file each option comes form
  * added lots of handy debugging output
2000-05-23 03:47:35 +00:00
Greg Ward d7ad5039cb Fixed command description. 2000-05-23 01:55:16 +00:00
Greg Ward 5edcd90f8c Use 'get_command_obj()' instead of 'find_command_obj()'. 2000-05-23 01:55:01 +00:00
Greg Ward 3c67b1dd08 OptionDummy now has a constructor that takes a list of options: each string
in the option list is an attribute of the OptionDummy that will be
initialized to None.
2000-05-23 01:44:20 +00:00
Greg Ward 732745bb70 Tweaked usage message. 2000-05-23 01:43:08 +00:00
Greg Ward d5d8a9982b Marching towards full support of config files: thoroughly overhauled the
command-line parsing code, splitting it up into several methods (new
methods: '_parse_command_opts()', '_show_help()') and making it put options
into the 'command_options' dictionary rather than instantiating command
objects and putting them there.

Lots of other little changes:
  * merged 'find_command_class()' and 'create_command_obj()' and
    called the result 'get_command_class()'
  * renamed 'find_command_obj()' to 'get_command_obj()', and added
    command object creation and maintenance of the command object cache to
    its responsibilities (taken over from 'create_command_obj()')
  * parse config files one-at-a-time, so we can keep track of the
    filename for later error reporting
  * tweaked some help messages
  * fixed up many obsolete comments and docstrings
2000-05-23 01:42:17 +00:00
Greg Ward 4355093f94 Tweaked output of 'copy_file()': if copying to a new name, show the whole
destination path, otherwise show just the directory.
2000-05-20 16:05:34 +00:00
Greg Ward a4adafd55b Changed the semantics of the 'sub_commands' list: instead of function
objects, it now has method names.
Added three methods, 'has_lib()', 'has_scripts()', and 'has_data()'
  to determine if we need to run each of the three possible sub-commands.
Added 'get_sub_commands()' to take care of finding the methods named
  in 'sub_commands', running them, and interpreting the results to
  build a list of sub-commands that actually have to be run.
2000-05-20 15:17:09 +00:00
Greg Ward f355d473fa Check if the claimed build directory doesn't exist, and warn that we don't
have any Python modules to install (rather than bomb when we try to copy
a non-existent directory).
2000-05-20 15:08:57 +00:00
Greg Ward 44a61bbb66 Added 'has_scripts()', 'has_data_files()' methods. 2000-05-20 15:06:48 +00:00
Greg Ward 36c36fec7c Added missing import. 2000-05-20 14:07:59 +00:00
Greg Ward f7edea749d Lyle Johnson: added stubs for the four miscellaneous methods that must be
implemented by subclasses, since they are needed by 'gen_lib_options()'.
2000-05-20 13:31:32 +00:00
Greg Ward 5299b6afc5 Added support for the 'export_symbols' parameter to 'link_shared_object()'
and 'link_shared_lib()'.  In MSVCCompiler, this is meaningful: it adds
/EXPORT: options to the linker command line.  In UnixCCompiler, it
is ignored.
2000-05-20 13:23:21 +00:00
Gregory P. Smith 8711a2e150 Changed default developer name.
Added some guiding comments.
2000-05-13 03:35:05 +00:00
Gregory P. Smith 2c067ef904 Template for writing Distutils command modules. 2000-05-13 03:32:36 +00:00
Gregory P. Smith 86ee81e34b Contribution from Harry Henry Gebel: the 'bdist_rpm' command.
(Completely uninspected and untested by me, this is just to
get the code into CVS!)
2000-05-13 03:11:40 +00:00
Gregory P. Smith 21b9e910a5 In 'install_misc': 'self.outfiles' defaults to the empty list, so we don't
have to worry about "or []" in 'get_outputs()'.
2000-05-13 03:10:30 +00:00
Gregory P. Smith 6a901dd1bd List data files are listed in the Distribution attribute 'data_files',
rather than 'data'.
2000-05-13 03:09:50 +00:00
Gregory P. Smith c59d4e0777 Added the 'bdist_base' option, the base temp directory for all bdist commands. 2000-05-13 03:08:28 +00:00
Gregory P. Smith e30b7a91c7 Added 'get_inputs()' methods, needed by the "install" command's
'get_inputs()'.
2000-05-13 03:07:53 +00:00
Gregory P. Smith ba0506b349 Drastically simplified by taking advantage of the "install" command's
new flexibility, specifically the 'root' option.  Now, we just use
"install" to do a fake installation into a temporary directory
(the 'bdist_dir' option, which derives from the 'bdist_base' option of
"bdist"), and then tar/zip up that directory.  This means that dumb
built distributions are now relative to the root directory, rather than
the prefix or exec-prefix; this is probably a feature, but does make
them slightly less flexible.
2000-05-13 03:06:56 +00:00
Gregory P. Smith a04d807127 Rename 'build_bdist' to 'bdist_base', and get it by default from the
"bdist" command rather than "build".
2000-05-13 02:30:15 +00:00
Gregory P. Smith c008488981 Typo fix. 2000-05-13 02:20:43 +00:00
Gregory P. Smith 0ec8ef1601 Made the '--record' option take an argument, which is the name of the
file to write the list of installed files to.
2000-05-13 02:16:45 +00:00
Gregory P. Smith 7e855ef6ad Ditch the explicit search for *.py[co] files -- they're now included in
the list returned by 'get_outputs()', thanks to changes in the
"install_lib" command.
2000-05-13 02:13:53 +00:00
Gregory P. Smith 11fb783fa4 Added '_bytecode_filenames()' method, and use it in 'get_outputs()'
to ensure that compiled bytecode files are considered part of the output
of the "install_lib" command.
2000-05-13 02:11:10 +00:00
Gregory P. Smith f9ebf98725 Moved check for installation to non-sys.path location so it comes
last (after writing list of installed files) -- that way, the warning
is more visible.
2000-05-13 02:01:22 +00:00
Gregory P. Smith 8cb676195b Harry Henry Gebel: add the "--record" option to write the list of
installed files to INSTALLED_FILES.
2000-05-13 01:58:19 +00:00
Gregory P. Smith a190268bf6 Added the 'build_bdist' option and code to clean it up -- this is the
top-level temporary directory for creating built distributions.  (Won't
work yet, since the "build" command doesn't yet have a 'build_bdist'
option, and none of the "bdist" commands support it yet.)
2000-05-13 01:56:55 +00:00
Gregory P. Smith b5ebe5d640 Harry Henry Gebel: get extra compiler flags from the CFLAGS environment
variable.

(Is this really needed?  Can we drop it when the config file mechanism
allows users to set compiler flags in setup.cfg?)
2000-05-13 01:52:14 +00:00
Gregory P. Smith 52e399c904 Harry Henry Gebel: add support for the 'bdist_rpm' command, specifically
the 'no_format_option' class attribute.
2000-05-13 01:49:56 +00:00
Gregory P. Smith d5b53df18c Harry Henry Gebel: add 'bdist_rpm' command. 2000-05-13 01:48:15 +00:00
Gregory P. Smith de5c953a2b From Lyle Johnson: renamed 'implib_dir' to 'implib_file', and
correctly ensure that it's 'dirname' exists.
2000-05-13 01:35:33 +00:00
Gregory P. Smith 6fafca4e1d Added comment/docstring/revision header. 2000-05-12 01:58:29 +00:00
Gregory P. Smith 17f641c143 Fixed 'select_scheme()' so it doesn't override a directory attribute that's
already been set (eg. by a command-line option).
2000-05-12 01:54:50 +00:00
Gregory P. Smith 74ead8ff5d Added --skip-build option, so lazy debuggers/testers (mainly me) don't
have to wade through all the 'build' output when testing installation.
2000-05-12 01:46:47 +00:00
Gregory P. Smith f8f2b98bdd Caught up with renaming in 'install_misc' base class. 2000-05-12 01:34:33 +00:00
Gregory P. Smith ae988a57d2 Deleted some cruft.
Caught up with renaming in 'install_misc' base class.
Changed 'run()' to chmod installed scripts under Unix.
2000-05-12 01:32:30 +00:00
Gregory P. Smith ce2b6b838f In 'install_misc' class:
- renamed '_copydata()' to 'copy_files()'
  - changed it to record complete output filenames
  - dropped '_outputdata()' in favour of much simpler 'get_outputs()'
2000-05-12 01:31:37 +00:00
Gregory P. Smith b2e3bb3d6a Patch from Bastien Kleineidam:
adds the 'install_data' and 'install_scripts' commands; these two
are trivial thanks to the 'install_misc' base class in cmd.py.
(Minor tweaks and commentary by me; the code is untested so far.)
2000-05-12 00:52:23 +00:00
Gregory P. Smith bb8c71d563 Call 'parse_config_files()' at the appropriate point.
Tweaked error-generating code.
2000-05-12 00:42:19 +00:00
Gregory P. Smith 1426354cf6 Preliminary support for config files:
- added 'find_config_files()' and 'parse_config_files()' methods
  - added 'command_options' attribute
Comment/docstring updates.
2000-05-12 00:41:33 +00:00
Gregory P. Smith e7e35ac1c2 Made 'check_environ()' "public" by stripping the leading underscore;
added a global '_environ_checked' so we know if it's already been
called.
2000-05-12 00:40:00 +00:00
Gregory P. Smith 6cd0c43366 Fix from Lyle Johnson: add the '--compiler' option.
Also added creation of 'implib_dir', a temporary directory specific to
  MSVC++ -- but I checked in two ways of fixing it (Lyle's and mine),
  because I'm not sure which is right.
2000-05-12 00:34:12 +00:00
Gregory P. Smith 9668b78b9f Fix from Lyle Johnson: add the '--compiler' option. 2000-05-12 00:33:14 +00:00
Greg Ward 1500374667 Added comment about the MSVC-specific kludge. 2000-05-09 01:50:41 +00:00
Greg Ward 4779cdfae8 Don't use 'set_option()' or 'get_option()' method -- direct attribute access,
or getattr/setattr, is all that's needed.
2000-05-07 15:32:13 +00:00
Greg Ward c4537ac9b6 Got rid of several little-used and not-very-useful methods: 'get_option()',
'get_options()', 'get_command_option()', 'get_command_options()'.
2000-05-07 15:30:31 +00:00
Greg Ward f4f8e64957 Got rid of some little-used and not-very-useful methods: 'get_option()' and
'get_options()'.
2000-05-07 15:29:15 +00:00
Greg Ward 18856b80e2 Added the ability to sneak extra flags onto the C compiler command line
via an 'extra_compile_args' option in the 'build_info' dictionary.
2000-05-06 13:12:59 +00:00
Greg Ward 6a647bb910 Added the "--root" option as a sort of meta-install-base; if supplied,
it is forcibly prepended onto all installation directories, even if
  they are already absolute.
Added 'dump_dirs()' to clean up the debug output a bit.
2000-04-27 01:56:38 +00:00
Greg Ward 67f75d4bcb Added 'change_root()' to forcibly slap a new root directory onto a pathname,
even if it's already absolute.  Currently only implemented for Unix; I'm
not entirely sure of the right thing to do for DOS/Windows, and have no
clue what to do for Mac OS.
2000-04-27 01:53:46 +00:00
Greg Ward ff2d9b7154 Hacked things up a bit so that configuration variables are expanded
in command-line options, and in two phases at that: first, we expand
'install_base' and 'install_platbase', and then the other 'install_*'
options.  This lets us do tricky stuff like
    install --prefix='/tmp$sys_prefix'
...oooh, neat.

Simplified 'select_scheme()' -- it's no longer responsible for expanding
config vars, tildes, etc.

Define installation-specific config vars in 'self.config_vars', rather than
in a local dictionary of one method.  Also factored '_expand_attrs()' out
of 'expand_dirs()' and added 'expand_basedirs()'.

Added a bunch of debugging output so I (and others) can judge the
success of this crazy scheme through direct feedback.
2000-04-26 02:38:01 +00:00
Greg Ward 6ce94b72c6 Harry Henry Gebel: import exception classes. 2000-04-26 02:29:51 +00:00
Greg Ward e5a584e865 Harry Henry Gebel: add 'long_description' to DistributionMetadata. 2000-04-26 02:26:55 +00:00
Greg Ward 839d532e50 Supply short form for --manifest-only (-o) and --force-manifest (-f)
options.
2000-04-26 01:14:33 +00:00
Greg Ward 1b8e1d4c0d Harry Henry Gebel:
Fix 'sdist.write_manifest()' to respect the value of dry_run.
2000-04-26 01:12:40 +00:00
Greg Ward a74ce01c98 Bumped version to 0.8.2. 2000-04-25 01:55:58 +00:00
Greg Ward f194878d6a Harry Henry Gebel:
Adds bztar format to generate .tar.bz2 tarballs

Uses the -f argument to overright old tarballs automatically, I am
assuming that if the old tarball was wanted it would have been moved or
else the version number would have been changed.

Uses the -9 argument to bzip2 and gzip to use maximum
compression. Compress uses the maximum compression by default.

Tests for correct value for the 'compress' argument of make_tarball. This
is one less place for someone adding new compression programs to forget to
change.
2000-04-25 01:38:20 +00:00
Greg Ward 464023fb64 Lyle Johnson: fixed broken logic in 'native_path()'. 2000-04-25 01:33:11 +00:00
Greg Ward 66bf446273 Patch from Harry Henry Gebel: fix two stupid bugs in help-printing stuff. 2000-04-23 02:50:45 +00:00
Greg Ward 3af07e9a78 Sporadic, untested Python 1.5.1 compatibility changes. 2000-04-22 15:17:14 +00:00
Greg Ward aa458bc465 Merged in Python 1.5.1 compatibility changes from the 0.1.3 branch:
added 'abspath()' and 'extend()'.
2000-04-22 15:14:58 +00:00
Greg Ward d80506c238 Merged in code from the 0.1.5 release to handle IOError and OSError
exceptions better.
2000-04-22 03:20:49 +00:00
Greg Ward 6a9a545ab1 Check that 'self.formats' is good early on. 2000-04-22 03:11:55 +00:00
Greg Ward ddad73bca9 Catch DistutilsOptionError in 'setup()' -- it's thrown either because of
errors in the setup script or on the command line, so shouldn't result
in a traceback.
2000-04-22 03:11:17 +00:00
Greg Ward db80754abc Extracted the "what-do-I-do-for-this-format" logic from code in
'make_archive()' to a global static dictionary, ARCHIVE_FORMATS.
Added 'check_archive_formats()', which obviously makes good use of
  this dictionary.
2000-04-22 03:09:56 +00:00
Greg Ward 4982f98bc9 Fix how we generate the meta-data query methods to include 'get_fullname()'
and the other "composite meta-data" methods.
2000-04-22 02:52:44 +00:00
Greg Ward 0ae7f76b40 Changed to call 'get_fullname()', not 'get_full_name()', on Distribution object. 2000-04-22 02:51:25 +00:00
Greg Ward 535f2d9ace Fix 'check_metadata()' so it grovels through the distribution's metadata
object, rather than through the distribution itself (since I moved the meta-
data out to a DistributionMetadata instance).
2000-04-21 04:37:12 +00:00
Greg Ward 9d5afa9894 Patch from Andrew Kuchling: allow multiple include/exclude patterns
for all commands except 'prune' and 'graft'.
2000-04-21 04:31:10 +00:00
Greg Ward 58ec6ede20 Fixed the '--license' option so it's officially an alias for '--licence',
and now actually works.
2000-04-21 04:22:49 +00:00
Greg Ward 1e7b509526 Added the capability for alias options. 2000-04-21 04:22:01 +00:00
Greg Ward 320df700dc Added 'has_option()', 'get_attr_name()' methods. 2000-04-21 02:31:07 +00:00
Greg Ward 82715e1f11 Patch, originally from Bastian Kleineidam and savagely mutilated by me,
to add the "display metadata" options: --name, --version, --author,
and so forth.  Main changes:
  * added 'display_options' class attribute to list all the "display only"
    options (--help-commands plus the metadata options)
  * added DistributionMetadata class as a place to put the actual
    metadata information from the setup script (not to be confused with
    the metadata display options); the logic dealing with metadata
    (eg. return self.name or "UNKNOWN") is now  in this class
  * changed 'parse_command_line()' to use the new OO interface provided
    by fancy_getopt, mainly so we can get at the original order of
    options on the command line, so we can print multiple lines of
    distribution meta-data in the order specified by the user
  * added 'handle_display_options()' to handle display-only options
Also fixed some crufty old comments/docstrings.
2000-04-21 02:28:14 +00:00
Greg Ward 283c745c57 Made 'generate_help()' and 'print_help()' methods of FancyGetopt.
Added 'set_option_table()' method.
Added missing 'self' to 'get_option_order()'.
Cosmetic/comment/docstring tweaks.
2000-04-21 02:09:26 +00:00
Greg Ward ead5c291bb Continuing the refactoring: deleted the old 'fancy_getopt()' function,
leaving in its place a tiny wrapper around the FancyGetopt class
for backwards compatibility.
2000-04-21 01:44:00 +00:00
Greg Ward ffc10d9a2e Hefty refactoring: converted 'fancy_getopt()' function into FancyGetopt
class.  (Mainly this was to support the ability to go back after the
getopt operation is done and get extra information about the parse,
in particular the original order of options seen on the command line.
But it's a big improvement and should make it a lot easier to add
functionality in the future.)
2000-04-21 01:41:54 +00:00
Greg Ward 3314c8efc9 Bumped version to 0.8.1. 2000-04-19 02:23:21 +00:00
Greg Ward b1e4a6e101 Added kludge to deal with the "./ld_so_aix" problem: force all strings
in the Makefile that start with "./" to be absolute paths (with the
implied root being the directory where the Makefile itself was found).
2000-04-19 02:22:07 +00:00
Greg Ward 434ef8fe94 Don't load the config.h file, even under Unix, because we never use the
information from config.h.  Code is still there in case someone in the
future needs to parse an autoconf-generated config.h file.
2000-04-19 02:18:09 +00:00
Greg Ward f70c603149 Added 'link_executable()' method (Berthold Hoellmann).
Two small fixes to 'link_shared_object()'.
2000-04-19 02:16:49 +00:00
Greg Ward eacdea8572 Reformatted all exception documentation as docstrings. 2000-04-15 22:23:47 +00:00
Greg Ward 02a1a2b077 Cleaned up/simplified error-handling:
- DistutilsOptionError is now documented as it's actually used, ie.
    to indicate bogus option values (usually user options, eg. from
    the command-line)
  - added DistutilsSetupError to indicate errors that definitely arise
    in the setup script
  - got rid of DistutilsValueError, and changed all usage of it to
    either DistutilsSetupError or ValueError as appropriate
  - simplified a bunch of option get/set methods in Command and
    Distribution classes -- just pass on AttributeError most of
    the time, rather than turning it into something else
2000-04-15 22:15:07 +00:00
Greg Ward 8eef583025 Don't run "ranlib" if sysconfig's RANLIB (from Python's Makefile) starts
with ":".
2000-04-14 13:53:34 +00:00
Greg Ward 1561ae13b6 Use 'get_python_inc()' to figure out the Python include directories
rather than cobbling them togethere here.
2000-04-14 00:50:49 +00:00
Greg Ward 2b9e43f8d0 Coerce all paths in the manifest template to the local path syntax with
'native_path()'.
2000-04-14 00:49:30 +00:00
Greg Ward 1c79330e64 Cleaned up use of sysconfig module a bit: don't import more names
than we actually use, and do actually use AR and SO.
Run ranlib on static libraries.  (Should probably have a platform-check
  so we don't run ranlib when it's not necessary, ie. on most modern
  Unices.)
2000-04-14 00:48:15 +00:00
Greg Ward b6f5adaa12 Don't bother reading config.h on NT or Mac OS. (It's not really needed
on Unix either, so should probably disappear entirely.)
2000-04-14 00:39:31 +00:00
Greg Ward d197a3a12c Define 'self.force' in the constructor and remove the hack in '__getattr__()'
to account for it not being defined in the constructor.
2000-04-10 13:11:51 +00:00
Greg Ward 7aff6f34fe Delete some debugging print statements. 2000-04-10 01:31:58 +00:00
Greg Ward e9613ae05f Added a check for the 'force' attribute in '__getattr__()' -- better than
crashing when self.force not defined.
Revise 'copy_file()' and 'copy_tree()' docstrings accordingly.
Remove 'hasattr()' check for 'self.force' from 'make_file()'.
2000-04-10 01:30:44 +00:00
Greg Ward d38e6f7637 Added optional 'prefix' arguments to 'get_python_inc()' and
'get_python_lib()'.
2000-04-10 01:17:49 +00:00
Greg Ward cf6bea3dc7 Better variable names here and there. 2000-04-10 01:15:06 +00:00
Greg Ward c41d6b35a9 Added '--force' option -- very clear what it means for building (ignore
timestamps), so every build_* command has 'self.force', which follows the
'build' command if not set by the user.
2000-04-10 00:19:42 +00:00
Greg Ward 68a0757e23 Removed global '--force' option -- just too vague a concept to be applicable
to all commands in the same way.  Several Command methods now either expect
'self.force' to be defined, or check if it is defined and assume it's
false if not.
2000-04-10 00:18:16 +00:00
Greg Ward 582a8701cb Added __version__ to store the Distutils version number. 2000-04-10 00:02:16 +00:00
Greg Ward 60908f1408 Ditched the unused 'list_only' option.
Added code to include source files from 'build_clib' command to default file
  list -- currently this won't work, since 'build_clib' doesn't have a
  'get_source_files()' method!
2000-04-09 03:51:40 +00:00
Greg Ward b2e2c29295 Catch DistutilsFileError in addition to DistutilsExecError in 'setup()'. 2000-04-09 03:49:20 +00:00
Greg Ward b361233c76 Added (currently) pointless and trivial main body (for future tests). 2000-04-09 03:48:37 +00:00
Greg Ward d759f5f145 This little note is to clarify things for people who go poking around the
Python library hoping to find out more about the Distutils.
2000-04-09 02:31:45 +00:00
Greg Ward 7d508fe568 Add missing import of 'usage' string. 2000-04-06 02:07:41 +00:00
Greg Ward aebf706b4e Reorganization: ripped util.py to shreds, creating in the process:
- file_util.py: operations on single files
  - dir_util.py: operations on whole directories or directory trees
  - dep_util.py: simple timestamp-based dependency analysis
  - archive_util.py: creation of archive (tar, zip, ...) files
The functions left in util.py are miscellany that don't fit in any of the
new files.
2000-04-04 02:05:59 +00:00
Greg Ward fe6462c1f3 Reorganization: moved the Distribution class from core.py to dist.py, and
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.
2000-04-04 01:40:52 +00:00
Greg Ward 19ce16665d Fixed my simplification to Thomas' patch: winreg and win32api export the same
functions, but with different names.
2000-03-31 19:04:25 +00:00
Greg Ward 1027e3fde9 Simplified Thomas Heller's registry patch: just assign all those
HKEY_* and Reg* names once, rather than having near-duplicate code
in the two import attempts.

Also dropped the leading underscore on all the imported symbols,
as it's not appropriate (they're not local to this module).
2000-03-31 16:53:42 +00:00
Greg Ward 7642f5cf38 Patch from Thomas Heller: use the new winreg module if available. 2000-03-31 16:47:40 +00:00
Greg Ward b4c850c928 Added code to blow away the pseudo-installation tree and a 'keep_tree'
option to disable this (by default, it's false and we clean up).
2000-03-31 05:22:47 +00:00
Greg Ward e5796fecc6 Oops, got a little too enthusiastic deleting code in that last revision:
we still have to *run* the sub-command that creates a built distribution.
2000-03-31 05:21:27 +00:00
Greg Ward 1889de8889 Fixed 'make_archive()' to explicitly turn of compression when format is "tar". 2000-03-31 05:20:27 +00:00
Greg Ward 02296cea39 Rename 'formats' option to 'format', and remove the ability to generate
multiple built distributions in one run -- it seemed a bit dodgy and I'd
rather remove it than try to beat it into submission right now.
2000-03-31 05:08:50 +00:00
Greg Ward 6b213766d8 Import from 'types' module.
Added 'ztar', 'tar' to 'format_command' dictionary.
2000-03-31 04:53:41 +00:00
Greg Ward 6ce00b4440 Tweaked 'get_platform()' to include the first character of the OS release:
eg. sunos5, linux2, irix5.
2000-03-31 04:40:25 +00:00
Greg Ward 7d51034eef Removed some old test code: don't set 'plat' when calling 'new_compiler()'. 2000-03-31 04:37:40 +00:00
Greg Ward 95c0b269de Don't perpetrate the "_d" hack for naming debugging extensions -- that's
now done in the 'build_ext' command.
2000-03-31 03:52:16 +00:00
Greg Ward 842296480e Patch (mostly) from Thomas Heller for building on Windows:
* build to "Debug" or "Release" temp directory
  * put linker turds (.lib and .exp files) in the build temp directory
  * tack on "_d" to extensions built with debugging
  * added 'get_ext_libname()' help in putting linker turds to temp dir
Also, moved the code that simplifies None to empty list for a bunch
  of options to 'finalize_options()' instead of 'run()'.
2000-03-31 03:50:23 +00:00
Greg Ward 6e8ee5d8e9 Don't put Python's library directory into the library search path -- that's
specific to building Python extensions.
2000-03-31 03:34:09 +00:00
Greg Ward 6148c2cfa6 Added 'bdist' and 'bdist_dumb'. 2000-03-31 03:14:51 +00:00
Greg Ward 1b64a7e4a5 Added 'get_name()' and 'get_full_name()' methods to Distribution.
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()'.
2000-03-31 03:05:18 +00:00
Greg Ward 32ce329ce4 Added 'create_tree()'.
Changes to 'copy_file()':
  * added support for making hard links and symlinks
  * noted that it silently clobbers existing files when copying, but
    blows up if destination exists when linking -- hmmm...
  * error message tweak
Added 'base_name' parameter to 'make_tarball()' and 'make_zipfile()'.
Added 'make_archive()' -- wrapper around 'make_tarball()' or
  'make_zipfile()' to take care of the archive "root directory".
2000-03-31 03:02:22 +00:00
Greg Ward 318a9d7aa2 Added DistutilsInternalError. 2000-03-31 02:57:31 +00:00
Greg Ward e1664bdc59 The 'bdist_dumb' command, the first worker bee for use by 'bdist'. This is
the command that actually creates "dumb" binary distributions, ie.
tarballs and zip files that you just unpack under <prefix> or <exec-prefix>.
Very limited, but it's a start.
2000-03-31 02:56:34 +00:00
Greg Ward 0f77f9569c The 'bdist' command, for creating "built" (binary) distributions.
Initial revision is pretty limited; it only knows how to generate "dumb"
binary distributions, i.e. a tarball on Unix and a zip file on Windows.
Also, due to limitations in the installation code, it only knows how to
distribute Python library code.  But hey, it's a start.
2000-03-31 02:55:12 +00:00
Greg Ward 1aab6e9645 Added 'get_inputs()'. 2000-03-31 02:53:07 +00:00
Greg Ward ba38d12063 Fixed 'get_outputs()' so it actually works.
Added 'get_inputs()' (which is strikingly similar to 'get_outputs()' - sigh).
Cosmetic tweaks.
2000-03-31 02:52:02 +00:00
Greg Ward 578c10d9a5 Changed to use the new 'has_pure_modules()' and 'has_ext_modules()' methods
provided by Distribution.
Cosmetic and error message tweaks.
Simplified 'make_release_tree()':
  * extracted 'distutils.util.create_tree()'
  * don't have to do hard-linking ourselves -- it's now handled by
    'distutils.util.copy_file()' (although the detection of
    whether hard linking is available still needs to be factored out)
Removed 'make_tarball()' and 'make_zipfile()' entirely -- their role
  is now amply filled by 'distutils.util.make_archive()'.
Simplified 'make_distribution()':
  * use Distribution's new 'get_full_name()' method
  * use 'make_archive()' instead of if/elif/.../else on the archive format
2000-03-31 02:50:04 +00:00
Greg Ward 71d55835b3 Oops: 'build_extensions()' no longer takes an 'extensions' list. 2000-03-30 19:47:22 +00:00
Greg Ward 1d16a9f040 Put the Python "system" include dir last, rather than first. 2000-03-29 04:13:49 +00:00
Greg Ward 41b4dd66c8 Call 'find_exe()', not '_find_exe()'. 2000-03-29 04:13:00 +00:00
Greg Ward ed8a0e0f21 Patch inspired by Bastian Kleineidam <calvin@cs.uni-sb.de>:
use global __debug__ flag to determine if compiled files will be ".pyc"
or ".pyo".  Tweaked compilation output messages too.
2000-03-29 03:29:34 +00:00
Greg Ward 044b7c15c9 Changed 'copy_tree()' so it returns the list of all files that were copied or
might have been copied, regardless of the 'update' flag.
2000-03-29 03:27:45 +00:00
Greg Ward 739d06689d Documented Bastian's patch.
Made handling OSError in 'mkpath()' more standard.
2000-03-29 02:56:34 +00:00
Greg Ward da4d1aef4e Patch from Bastian Kleineidam <calvin@cs.uni-sb.de>:
make 'mkdir()' return list of directories created.
2000-03-29 02:53:02 +00:00
Greg Ward 7c1a6d4777 Added 'make_tarball()' and 'make_zipfile()' functions in preparation
for the 'bdist_dumb' command.  Adapted, with tweakage, from the 'sdist'
command.
2000-03-29 02:48:40 +00:00
Greg Ward 03d1ae1f01 Moved the guts of 'make_tarball()' and 'make_zipfile()' to distutils.util
in preparation for the 'bdist_dumb' command; these methods remain as
trivial wrappers around the versions in distutils.util.
2000-03-29 02:47:29 +00:00
Greg Ward f00c34da1d Added the "distribution query" methods: 'has_pure_modules()',
'has_ext_modules()', 'has_c_libraries()', 'has_modules()', and 'is_pure()'.
2000-03-29 02:20:45 +00:00
Greg Ward ab9d08ce65 Added 'build_clib'; replaced 'install_py' and 'install_ext' with 'install_lib'. 2000-03-29 02:18:39 +00:00
Greg Ward e5dfba5e0f Be sure to run both 'build_py' and 'build_ext', now that this command
is responsible for installing all Python modules (pure and extensions).
Added 'get_outputs()' in preparation for the 'bdist' command, and
  '_mutate_outputs()' to support 'get_outputs()'.
2000-03-29 02:17:42 +00:00
Greg Ward ee94c57fe9 Changed so the sub-commands we rely on to do the real work is specified
in a class attribute 'sub_commands', rather than hard-coded in 'run()'.
  This should make it easier to subclass 'install', and also makes it
  easier to keep 'run()' and the new 'get_outputs()' consistent.
Added 'get_outputs()' in preparation for the 'bdist' command.
2000-03-29 02:15:57 +00:00
Greg Ward ae45b16157 Use the new 'has_pure_modules()', 'has_ext_modules()', 'has_c_libraries()'
methods of Distribution instead of grovelling directly in self.distribution.
2000-03-29 02:14:21 +00:00
Greg Ward 4d16e0ac20 Added 'get_outputs()' in prepartion for the 'bdist' command.
Changed signature of 'build_extensions()': no longer takes the extension
  list, but uses 'self.extensions' (just like 'get_outputs()' has to)
Moved call to 'check_extensions_list()' from 'run()' to 'build_extensions()',
  again for consistency with 'get_outputs()'.
2000-03-29 02:13:09 +00:00
Greg Ward 8b2e95edd6 Deleted some crufty comments and code.
A host of improvements in preparation for the 'bdist' command:
  - added 'get_outputs()' method (all the other improvements were to support
    this addition)
  - made 'find_package_modules()' and 'find_modules()' return similar
    values (list of (package, module, module_filename) tuples)
  - factored 'find_all_modules()' out of 'get_source_files()' (needed
    by 'get_outputs()')
  - factored 'get_module_outfile()' out of 'build_module()' (also needed
    by 'get_outputs()')
  - various little tweaks, improvements, comment/doc updates
2000-03-29 02:10:51 +00:00
Greg Ward 89489fa15d Beefed up error-handling in 'setup()' a smidge:
handle OSError and DistutilsExecError now.
2000-03-26 21:48:43 +00:00
Greg Ward a3c8bf382e Duh, it helps if '_nt_quote_args()' actually returns the mutated list,
rather than None.
2000-03-26 21:47:00 +00:00
Greg Ward cdb20ba56d Fixed a bunch of screwed-up logic and inconsistent terminology.
Fixed 'build_extensions()' to pay attention to the 'rpath' element of the
  'build_info' dictionary.
2000-03-26 21:45:14 +00:00
Greg Ward 2f557a2ec4 Added 'runtime_library_dirs' parameter to 'link_*()' methods, and warn that
we don't know what to do with it when we see it.
Call '_fix_object_args()' and/or '_fix_lib_args()' as appropriate, rather
  than just '_fix_link_args()'.
2000-03-26 21:42:28 +00:00
Greg Ward e21dabe2e0 Added 'runtime_library_dirs' parameter to 'link_*()' methods, and changed to
use it when linking.
Call '_fix_object_args()' and/or '_fix_lib_args()' as appropriate, rather
  than just '_fix_link_args()'.
2000-03-26 21:40:19 +00:00
Greg Ward f10f95d6bb Added 'runtime_library_dirs' parameter to 'link_*()' methods.
Split '_fix_link_args()' up into '_fix_object_args()' (for use of
  'create_static_lib() and link methods) and '_fix_lib_args()' (for the
  link methods only).
2000-03-26 21:37:09 +00:00
Greg Ward a7540bd043 Import fix. 2000-03-23 04:39:16 +00:00
Greg Ward e2a33079e9 Fixed '_nt_quote_args()': backwards logic reversed, and now it actually
returns a value.
2000-03-23 04:38:36 +00:00
Greg Ward 297dd9fed5 Fixed the class name. 2000-03-23 04:37:11 +00:00
Greg Ward 790c110c48 Revised tons of comments to reflect the current state of affairs better.
Deleted some crufty code.
2000-03-22 00:51:18 +00:00
Greg Ward 048ca7dcaf Run 'install_lib' instead of 'install_py', and ditch 'install_ext'
completely (was already commented-out).
2000-03-22 00:40:16 +00:00
Greg Ward 55753d4a75 Renamed install_py.py to install_lib.py, since it now handles installing all
Python modules, pure and extensions.
2000-03-22 00:37:16 +00:00
Greg Ward 5b001f1569 Obsolete command -- no longer relevant since we now build all modules, pure
Python and extensions, into the same directory.
2000-03-22 00:35:16 +00:00
Greg Ward 1497b61cb0 Dropped the evil and misguided 'set_peer_option()' method -- it's no
longer needed, and can't possibly work anyways.
2000-03-22 00:31:37 +00:00
Greg Ward 066af1074d Dropped any notion of allowing the user to specify the build directories:
these must come from the 'build' command.  This means we no longer need
the misconceived 'set_peer_option()' method in Command and, more importantly,
sweeps away a bunch of potential future complexity to handle this tricky
case.
2000-03-22 00:30:54 +00:00
Greg Ward 1b4ede5f24 Improved an error message in 'mkpath()'.
Tightened up some logic in 'native_path()'.
Added 'subst_vars()' and '_check_environ()'.
2000-03-22 00:22:44 +00:00
Greg Ward 7f6ef6ca26 Renamed 'install_path' to 'extra_path'.
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.
2000-03-22 00:20:46 +00:00
Greg Ward a233d86638 Yet another complete rewrite. Hopefully the *last* complete rewrite of
this command for a while; this implements roughly the plan cooked up by
Guido, Fred, and me.  Seems to strike a nice balance between usability in
the common cases (just set one option), expandability for more types of
files to install in future, and customizability of installation
directories.

This revision isn't completely working: standard and alternate
installations work fine, but there are still some kinks to work out of
customized installations.
2000-03-22 00:15:45 +00:00
Greg Ward 531349f28e Fix how we set 'build_dir' and 'install_dir' options from 'install' options --
irrelevant because this file is about to go away, but oh well.
2000-03-22 00:12:51 +00:00
Greg Ward 4620f306a4 Took out what looks like old debugging code that probably should never
have been checked in: was passing the PLAT environment variable as the
'plat' argument to 'new_compiler()'.
2000-03-22 00:11:21 +00:00
Greg Ward fb4ece7fea Simplified doc string.
Added 'clean' to list of commands.
2000-03-18 17:36:09 +00:00
Greg Ward 89ccb984f0 Oops! Don't call 'ensure_ready()' in 'Distribution.find_command_obj()' --
that broke parsing command-line options.  Instead call it in
'Command.find_peer()', which is why I added it to 'find_command_obj()'
in the first place.
2000-03-18 17:35:12 +00:00
Greg Ward 11fc7e447c Tweaked all over:
* improve help strings
  * warn if user supplies non-existing directories
  * don't try to 'remove_tree()' non-existing directories
  * try to remove the build_base after cleanup (but don't do or say
    anything if it fails -- this is just in case we made it empty)
2000-03-18 17:33:18 +00:00
Greg Ward 2dc139cc91 Patch from Bastian Kleineidam <calvin@cs.uni-sb.de>:
use 'util.remove_tree()' instead of 'nuke_release_tree()'.
2000-03-18 15:43:42 +00:00
Greg Ward b98fe36c46 Patch from Bastian Kleineidam <calvin@cs.uni-sb.de>: added 'remove_tree()'. 2000-03-18 15:42:22 +00:00
Greg Ward 06537a5e89 Contribution from Bastian Kleineidam <calvin@cs.uni-sb.de>:
the Distutils 'clean' command.
2000-03-18 15:37:26 +00:00
Greg Ward dedd5b5ed2 In 'finalize_options()': if 'self.libs' is a string, make it a singleton list. 2000-03-18 15:21:03 +00:00
Greg Ward d03f88a38f Changed to pay attention to the 'runtime_library_dirs' list (= 'rpath'
option in the 'build_ext' command):
  * in ccompiler.py: 'gen_lib_options()' now takes 'runtime_library_dirs'
    parameter
  * in unixccompiler.py and msvccompiler.py: now pass
    'self.runtime_library_dirs' to 'gen_lib_options()', and define
    'runtime_library_dir_option()' (although in msvccompiler.py it
    blows up with a DistutilsPlatformError right now!)
2000-03-18 15:19:51 +00:00
Greg Ward 92f3377078 Catch up with change to CCompiler API: call 'create_static_lib()', not
'link_static_lib()'.
2000-03-10 02:02:44 +00:00
Greg Ward 09fc542b27 Renamed 'link_static_lib() to 'create_static_lib()', and rewrote it create
a static library (using lib.exe as found by '__init__()', hopefully through
registry entries pointing to DevStudio).
2000-03-10 01:49:26 +00:00
Greg Ward 036c805958 Renamed 'link_static_lib() to 'create_static_lib()'. 2000-03-10 01:48:32 +00:00
Fred Drake c1ee39a99e There are a few places which can raise DistutilsPlatformError; make
sure it's imported!  ;)

Re-wrap the docstrings on get_python_inc() and get_python_lib() to be
closer to the "normal" Python style.  See GvR's "style guide" on the
essays page (http://www.python.org/doc/essays/).

There should never be a space between a function name and the '(' that
opens the argument list (see the style guide again).
2000-03-09 15:54:52 +00:00
Greg Ward 7d73b9eb18 Added Joe Van Andel's 'get_python_inc()', adapted by me to supply
the platform-neutral include dir by default and with Mac support.
Added 'get_python_lib()', inspired by 'get_python_inc()'.
Rewrote 'get_config_h_filename()' and 'get_makefile_filename()'
  in terms of 'get_python_inc()' and 'get_python_lib()'.
Changed '_init_nt()' and '_init_mac()' to use 'get_python_inc()' and
  'get_python_lib()' for directory names.
2000-03-09 03:16:05 +00:00
Greg Ward 911d86693b Patch from Corran Webster <cwebster@nevada.edu> (tweaked for style by me):
changed 'copy_file()' to use the native Mac file copy routine.
2000-03-07 03:34:16 +00:00
Greg Ward 0eff87a570 Patch from Corran Webster <cwebster@nevada.edu>: add '_init_mac()'. 2000-03-07 03:30:09 +00:00
Greg Ward 5091929c2c Added 'native_path()' for use on pathnames from the setup script: split on
slashes, and put back together again using the local directory separator.
2000-03-07 03:27:08 +00:00
Greg Ward e2b4452d0c Added '_nt_quote_args()' to deal with whitespace in command-line arguments
in a rather half-assed, but probably effective, way.
2000-03-07 03:25:20 +00:00
Greg Ward 9552665436 Rewrote 'newer_pairwise(): more natural (and incompatible) interface,
simpler implementation.
2000-03-06 03:44:32 +00:00
Greg Ward 32c4a8a0ee Serious overhaul of the C compiler interface and the two classes that
implement it (so far):
  * moved filename generation methods into CCompiler base class,
    driven by data supplied by implementation classes
  * moved a bunch of common code from UnixCCompiler to convenience
    methods in CCompiler
  * overhauled MSVCCompiler's compile/link methods to look and act
    as much as possible like UnixCCompiler's, in order to regularize
    both interface and behaviour (especially by using those new
    convenience methods)
2000-03-06 03:40:29 +00:00
Greg Ward eb3f75e636 Don't pass 'keep_dir' to 'compile()' method of CCompiler -- no longer used. 2000-03-06 03:37:45 +00:00
Greg Ward 4ba5da418c Don't pass 'keep_dir' to 'compile()' method of CCompiler -- no longer used.
Don't assume that the 'libraries' and 'library_dirs' elements of the
  build info dict are always lists.
2000-03-06 03:36:50 +00:00
Greg Ward 56359f591b Typo fix. 2000-03-03 03:00:27 +00:00
Greg Ward 96182d7b68 Fixed 'mkpath()' to accept empty string silently (it's just the current dir).
Fixed all DistutilsFileError messages to wrap file/dir names in quotes.
2000-03-03 03:00:02 +00:00
Greg Ward 76ec0d6d76 Renamed 'build_lib' command to 'build_clib':
* replaced build_lib.py with build_clib.py
  * renamed the class in build_clib.py
  * changed all references to 'build_lib' command in other command classes
2000-03-02 01:57:12 +00:00
Greg Ward 3ce77fd05e Changed '__rcsid__' to '__revision__'. 2000-03-02 01:49:45 +00:00
Greg Ward 60f64330d1 If the "build_lib" command built any C libraries, link with them all
when building extensions (uses build_lib's 'get_library_names()' method).
Ensure that the relative structure of source filenames is preserved in
  the temporary build tree, eg. foo/bar.c compiles to
  build/temp.<plat>/foo/bar.o.
2000-03-02 01:32:21 +00:00
Greg Ward 833dfd52e5 Added command description.
Added 'build_clib' and 'build_temp' options (where to put C libraries
  and where to put temporary compiler by-products, ie. object files).
Moved the call to 'check_library_list()' from 'run()' to 'finalize_options()'
  -- that way, if we're going to crash we do so earlier, and we guarantee
  that the library list is valid before we do anything (not just run).
Disallow directory separators in library names -- the compiled library
  always goes right in 'build_clib'.
Added 'get_library_names()', so the "build_ext" command knows what
  libraries to link every extension with.
2000-03-02 01:27:36 +00:00
Greg Ward 49ffce173e In the 'compile()' method: preserve the directory portion of source
filenames when constructing object filenames, even if output_dir given --
eg. "foo/bar.c" will compile to "foo/bar.o" without an output_dir, and to
"temp/foo/bar.o" if output_dir is "temp".
2000-03-02 01:21:54 +00:00
Greg Ward f1146572dd In compile/link methods: ensure that the directory we expect to be writing to
exists before calling the compiler/linker.
2000-03-01 14:43:49 +00:00
Greg Ward 013f0c8636 Added 'mkpath()' method: convenience wrapper around 'util.mkpath()' that adds
the compiler objects 'verbose' and 'dry_run' flags.
2000-03-01 14:43:12 +00:00
Greg Ward 611850bbb3 Added call to 'ensure_ready()' on the command object in
'Distribution.find_command_obj()'.
2000-03-01 14:42:07 +00:00
Greg Ward 585df89f60 Added 'get_platform()' to construct a string that identifies the current
platform, using 'os.uname()' or 'sys.platform'.
2000-03-01 14:40:15 +00:00
Greg Ward e51d69efb0 Build reorg:
* 'build_dir' -> 'build_lib', which by default takes its value
    straight from 'build_lib' in the 'build' command
  * added 'build_temp' and 'inplace' options
  * change 'build_extensions()' to put object files (compiler turds) in
    'build_temp' dir
  * complicated the name-of-extension-file shenanigans in
    'build_extensions()' to support "in-place" extension building, i.e.
    put the extension right into the source tree (handy for developers)
  * added 'get_ext_fullname()', renamed 'extension_filename()' to
    'get_ext_filename()', and tweaked the latter a bit -- all to support
    the new filename shenanigans
2000-03-01 01:43:28 +00:00