Commit Graph

2868 Commits

Author SHA1 Message Date
Marc-André Lemburg 990bbe90d5 Marc-Andre Lemburg <mal@lemburg.com>:
Added support to set the default encoding of strings
at startup time to the values defined by the C locale.

The sys.setdefaultencoding() API is deleted after having
set up the encoding, so that user code cannot subsequentely
change the setting. This effectively means that only site.py
may alter the default setting.
2000-06-07 09:12:09 +00:00
Marc-André Lemburg 5431bc3602 Marc-Andre Lemburg <mal@lemburg.com>:
Added a new locale name aliasing engine which also supports
locale encodings, a feature which is used by the new default
encoding support in site.py.
2000-06-07 09:11:40 +00:00
Marc-André Lemburg 54480d300a New codec which always raises an exception when used. This
codec can be used to effectively switch off string coercion
to Unicode.
2000-06-07 09:04:05 +00:00
Greg Ward 9d17a7ad6d Patch from Rene Liebscher: this adds "--help-foo" options to list the
values that "--foo" can take for various commands: eg. what formats for
"sdist" and "bdist", what compilers for "build_ext" and "build_clib".

I have *not* reviewed this patch; I'm checking it in as-is because it also
fixes a paper-bag-over-head bug in bdist.py, and because I won't have
time to review it properly for several days: so someone else can
test it for me, instead!
2000-06-07 03:00:06 +00:00
Greg Ward 1169687692 Always look for the system config file in the Distutils module directory,
and call it "distutils.cfg" instead of "pydistutils.cfg" (personal
config files are still ".pydistutils.cfg" or "pydistutils.cfg", though).
2000-06-07 02:29:03 +00:00
Greg Ward acf3f6a700 Patch from Rene Liebscher:
Look for personal config file in /home/greg on Windows, too: users will have
to set /home/greg to use this, so it's not something that many people will
use.  But if python-dev comes up with the "right way" to divine a
home directory on Windows, we can use that to set /home/greg and poof! --
personal Distutils config files on Windows.
2000-06-07 02:26:19 +00:00
Greg Ward 28a5f44cca First crack at the Distutils "config" command. Unlike other commands, this
one doesn't *do* anything by default; it's just there as a conduit for data
(eg. include dirs, libraries) from the user to the "build" commands.
However, it provides a couple of Autoconf-ish methods ('try_compile()',
'try_link()', 'try_run()') that derived, per-distribution "config" commands
can use to poke around the target system and see what's available.

Initial experimenst with mxDateTime indicate that higher-level methods are
necessary: analogs of Autoconf's AC_CHECK_HEADER, AC_CHECK_LIB will be
needed too (and that's just to probe the C/C++ system: how to probe the
Python system is wide open, and someday we'll have to worry about probing a
Java system too).
2000-06-06 02:57:07 +00:00
Greg Ward 43955c9a02 Fix 'reinitialize_command()' so it resets the 'have_run' flag for the
command being reinitialized to false.
2000-06-06 02:52:36 +00:00
Greg Ward e18dd8dd8f Support for multiple distribution formats in one run. 2000-06-06 02:51:38 +00:00
Greg Ward ec21cc60db 'get_outputs()' now returns an empty list instead of None. 2000-06-06 02:18:13 +00:00
Greg Ward 7ce6d074aa Fixed syntax error.
Half-fixed RPM 2 compatibility:added 'rpm_base' option, which must be set
  (to eg. /usr/src/redhat on a stock Red Hat system) if rpm2_mode is on.
  Still not quite working, though.
2000-06-04 15:30:35 +00:00
Greg Ward 62d5a57b05 Use 'ensure_string_list()' for 'formats' option, so that it can be
spelled sensibly in a config file.
2000-06-04 15:12:51 +00:00
Greg Ward a68c93ac89 Patch from Harry Henry Gebel:
Fills in question marks in help

Reads scripts in from files rather than strings

Adds RPM 2 compatibility mode (untested). Use of this mode requires that
--bdist-base be specified because bdist_rpm has no way of detecting where
RPM wants to find spec files and source files. An unmodified RedHat 5.0
system would require '--bdist-base=/usr/src/RedHat'. (You would also have
to be root.) If the rpmrc file has been modified to allow RPMs to be built
by normal users then --build-base would need to be changed accordingly.

Formats the changelog.

GPW: tweaked formatting, added some editorial comments.
2000-06-04 15:00:34 +00:00
Greg Ward 31413a7ba2 Added the 'ensure_*' methods from bdist_rpm; refactored 'ensure_filename()'
and added 'ensure_dirname()'.
2000-06-04 14:21:28 +00:00
Greg Ward 4227dc1b15 Removed the 'ensure_*' methods -- they're just too handy too keep in one
command class, so they're now in the Command base class.
2000-06-04 14:20:57 +00:00
Greg Ward 6f980b5936 Renamed 'modules' option to 'py_modules', for consistency with Distribution
(and in order to generate a more sensible error message cleanly).
2000-06-04 13:42:52 +00:00
Greg Ward c4c06af575 Patch from Harry Henry Gebel: fixes a bit of code that slipped by my
overhaul last night.
2000-06-03 01:03:55 +00:00
Greg Ward 3985151642 Catch DistutilSetupError from the Distribution constructor. 2000-06-03 01:02:06 +00:00
Greg Ward 82d71cacb0 Added a bunch of new globals in '_init_mac()' -- these will be needed to
support the forthcoming Cygwin/Mingw32 GCC-on-Windows patch.
Standardized CVS id line.
2000-06-03 00:44:30 +00:00
Greg Ward 0f216fdda9 Bumped version number to 0.9pre (there will be a couple of code snapshots
before the real release, but I want to make it clear that a major new
release is on the way).
2000-06-02 02:23:42 +00:00
Greg Ward efbd071016 Only print debugging output if DEBUG true. 2000-06-02 02:01:51 +00:00
Greg Ward 2bd3f4250d Only print debugging output if DEBUG true (and deleted some of the more
extraneous debug prints).
2000-06-02 01:59:33 +00:00
Greg Ward f7a5507485 Use Distribution method 'dump_option_dicts()' for debugging output, and only
do so if DEBUG is true.
2000-06-02 01:55:36 +00:00
Greg Ward 673925842e Ditched the obsolete '_get_package_data()' method and its
'_check_*()' helpers.
2000-06-02 01:52:04 +00:00
Greg Ward 1259392b38 Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)

Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
2000-06-02 01:49:58 +00:00
Greg Ward 8ff5a3fd92 Reformatted and updated many docstrings. 2000-06-02 00:44:53 +00:00
Fred Drake 8eded195aa Trent Mick <trentm@activestate.com>:
Fix test of the "math" module so it does not break on platforms that do
not offer rint(); just skip that portion of the test in that case.
2000-06-01 17:59:17 +00:00
Jeremy Hylton b1aa19515f Fredrik Lundh: here's the 96.6% version of SRE 2000-06-01 17:39:12 +00:00
Jeremy Hylton b5fc749c8b patch from Charles Waldman--
define ThreadError (== thread.error); docs should be updated, too
2000-06-01 01:17:17 +00:00
Greg Ward d87eb73f32 Remember the list of archive files created in 'make_distribution()'.
Added 'get_archive_files()' so outsiders can get their hands on that list.
2000-06-01 01:10:56 +00:00
Greg Ward 282c7a0230 Oops, 'reinitialize_command()' forgot to return the command object if didn't
need to be reinitialized -- fixed.
2000-06-01 01:09:47 +00:00
Greg Ward 308acf0bfa Added 'reinitialize_command()' method -- delegated to Distribution instance.
Ensure 'make_archive()' method returns archive filename.
2000-06-01 01:08:52 +00:00
Greg Ward 879096137d Ensure that 'make_archive()' returns the name of the new archive file. 2000-06-01 01:07:55 +00:00
Greg Ward 01a4694dce More tweaking to make this command act like other Distutils commands:
* added "--bdist-base" option to parameterize where we build
    the RPM (comes from "bdist" by default: "build/bdist.<plat>")
  * simplified/cleaned up some code in 'run()' in the process of
    removing (most) hard-coded directory names
  * if "--spec-only", drop spec file in "dist" rather than "redhat"
    (directory name still hard-coded, though)
  * use 'reinitialize_command()' to fetch the "sdist" object to
    tweak before running "sdist" command
  * use 'self.copy_file()' method rather than 'copy_file()' function
  * cosmetic tweaks to comments, error messages
2000-06-01 00:40:25 +00:00
Greg Ward 69413da749 Regularize options a bit:
* help strings start with lowercase
  * added affirmative version of '--no-clean' and '--no-rpm-opt-flags',
    which are the default (thus the attributes that correspond to
    the options are now 'clean' and 'use_rpm_opt_flags')
2000-05-31 23:56:45 +00:00
Fred Drake 46bd9a6191 Do not expose __builtins__ name as a completion; this is an implementation
detail that confuses too many people.  Based on discussion in python-dev.
2000-05-31 14:31:00 +00:00
Greg Ward d8dfb4c4b8 Renamed 'native_path()' to 'convert_path()'.
Also changed it so it doesn't barf if the path is already in native format
  (ie. contains os.sep).
2000-05-31 02:32:10 +00:00
Greg Ward 65bc20c23e Normalize paths before writing them to a zipfile. 2000-05-31 02:17:19 +00:00
Greg Ward 4b46ef9a4f Fixed 'change_root() to work at all on Windows, and to work correctly on Unix. 2000-05-31 02:14:32 +00:00
Greg Ward a76bbd4566 Import the new Extension class, so setup scripts can
"from distutils.core import" it.
2000-05-31 01:11:20 +00:00
Greg Ward 5322f008c5 Overhauled to expect 'self.extensions' (taken from 'ext_modules' in the
setup script) to be a list of Extension instances, rather than a list of of
(ext_name, build_info) tuples.  This is mostly a simplification, but
'check_extension_list()' got a lot more complicated because of the need to
convert the old-style tuples to Extension instances.

Temporarily dropped support for defining/undefining macros in the
'extensions' list -- I want to change the interface, but haven't yet made
the required changes in CCompiler and friends to support this nicely.

Also neatened up the code that merges 'extra_compile_flags' and the CFLAGS
environment variable.
2000-05-31 01:09:52 +00:00
Greg Ward 3ca54bc846 Provides the Extension class, a nicer way to describe C/C++ extensions than
the old (ext_name, build_info) tuple.
2000-05-31 01:05:35 +00:00
Guido van Rossum 7f91cf9a68 Add 'r' to docstrings to avoid expanded backslash escapes. (Ka-Ping Yee) 2000-05-30 13:25:35 +00:00
Greg Ward 98150114e0 Cosmetic tweak. 2000-05-30 02:04:54 +00:00
Greg Ward 66ac93e6f7 Catch CCompiler exceptions in 'setup()'. 2000-05-30 02:04:29 +00:00
Greg Ward 3add77f611 Import exceptions from errors.py, not ccompiler.py. 2000-05-30 02:02:49 +00:00
Greg Ward 39804cbc60 Removed exceptions -- now in errors.py to avoid expensive import of ccompiler. 2000-05-30 02:02:48 +00:00
Greg Ward c1cb0493f8 Moved the CCompiler exceptions here, to avoid having to import ccompiler.py
just to get a little exception class.
No more string-based exceptions.
2000-05-30 02:02:14 +00:00
Greg Ward d151711e66 Changed to catch compile/link failures and raise CompileError, LibError,
or LinkError (exception classes defined in ccompiler.py).
2000-05-30 01:56:44 +00:00
Greg Ward adda156a13 Added 'dump_options()' for debugging output. 2000-05-28 23:54:00 +00:00
Greg Ward c32d9a6952 Factored '_set_command_options()' out of 'get_command_obj()'.
Added 'reinitialize_command()' -- lets us "push" option values in
  a controlled, safe way; this is a small change to the code, but
  a big change to the Distutils philosophy of passing option values
  around.  The preferred mode is still definitely to "pull" options
  from another command (eg. "install" fetches the base build directory
  from "build"), but it is now feasible to "push" options onto another
  command, when you know what's best for it.  One possible application
  will be a "config" command, which pokes around the system and pushes
  values (eg. include and library directories) onto the "build" command.
Added 'dump_option_dicts()' method (for debugging output).
2000-05-28 23:53:06 +00:00
Greg Ward 2129032bc6 Changed order so 'clean' is right after the 'build' commands. 2000-05-28 23:49:03 +00:00
Greg Ward fbb04c448c Only print debugging output if DEBUG (imported from distutils.core) is true. 2000-05-28 23:47:31 +00:00
Greg Ward 0eeebfda98 Moved warnings out of 'finalize_options()' into 'run()'.
Added a warning for 'bdist_base' directory.
2000-05-28 23:47:00 +00:00
Greg Ward 4fb29e55f8 Some far-reaching naming changes:
* Command method 'find_peer()' -> 'get_finalized_command()'
  * Command method 'run_peer()' -> 'run_command()'
Also deleted the 'get_command_option()' method from Command, and
  fixed the one place where it was used (in "bdist_dumb").
2000-05-27 17:27:23 +00:00
Greg Ward e5b267ccb6 Patch from Andrew Kuchling: prune out the build and source distribution
directories after all is said and done, so we don't accidentally include
those files in the source distribution.

(This is the quick and easy way to fix this; Andrew says: "Changing
findall() looked like it was going to be messy, so I tried this instead.
The only problem is that redundant directory traversals are being done,
walking through build/ only to throw out all the files found at the end.").
2000-05-27 03:03:23 +00:00
Greg Ward 51def7d667 Support for the "install_headers" command: distribution option 'headers'
and method 'has_headers()'.
2000-05-27 01:36:14 +00:00
Greg Ward 2d238c56a6 'mkpath()' now detects non-string 'name' arguments -- this is a fairly common
bug when adding new code, so I thought I'd make it blow up earlier
than deep in posix.py.
2000-05-27 01:35:27 +00:00
Greg Ward 46380906d1 Tweaked description, help text. 2000-05-27 01:33:49 +00:00
Greg Ward cae5a1f444 Support for the "install_headers" command:
* 'headers' entry added to all the install schemes
  * '--install-headers' option added
  * 'install_headers' added to 'sub_commands'
  * added 'dist_name' to configuration variables (along with a few
    others that seem handy: 'dist_version', 'dist_fullname', and
    'py_version'
  * in 'finalize_unix()', make sure 'install_headers' defined if
    user specified 'install_base' and/or 'install_platbase'
  * added 'has_headers()'
  * a few other small changes
2000-05-27 01:33:12 +00:00
Greg Ward aa0e77115f Added 'install_headers' command to install C/C++ header files. 2000-05-27 01:25:16 +00:00
Barry Warsaw 262e83cb1a This module is obsolete now that the standard exceptions are built-in. 2000-05-26 19:06:13 +00:00
Greg Ward 521340034e Rene Liebscher: check if the extension file (.so or .pyd) is
up-to-date with respect to the source files; that way, we
don't needlessly rebuild just because object files go away.
2000-05-26 01:31:53 +00:00
Greg Ward 0e48cfd2c5 Factored out code for extracting-or-creating one of the option
dictionaries in 'self.command_options' to 'get_option_dict()'.
Simplified code in 'parse_config_files()' and 'parse_command_line()'
  accordingly.
Fixed code in constructor that processes the 'options' dictionary
  from the setup script so it actually works: uses the new
  'self.command_options' dictionary rather than creating command
  objects and calling 'set_option()' on them.
2000-05-26 01:00:15 +00:00
Greg Ward 37af1c3807 Added the DEBUG global (set from the DISTUTILS_DEBUG environment variable).
Changed the exception-handling code in 'setup()' to re-raise exceptions
  if DEBUG is true.
2000-05-26 00:54:52 +00:00
Greg Ward 8bbba17d38 Fixed a couple of long-hidden bugs (amazing what you find when you
attempt to verify the bold assertions in the documentation):
  * entries for the "root package" in 'package_dir' didn't work --
    fixed by improving the fall-through code in 'get_package_dir()'
  * __init__.py files weren't installed when modules-in-packages
    were listed individually (ie. in 'py_modules' in the setup script);
    fixed by making 'check_package()' return the name of the __init__
    file if it exists, and making 'find_modules()' add an entry to
    the module list for __init__ if applicable
2000-05-26 00:44:06 +00:00
Barry Warsaw 992cb8ab53 Added a test to catch the base class. 2000-05-25 23:16:54 +00:00
Barry Warsaw 9357854187 For backwards compatibility, simply import everything from the
_exceptions module, including __doc__.
2000-05-25 23:15:52 +00:00
Greg Ward fe55e86a0a Take the basename of the script before concatenating it with the build dir. 2000-05-25 20:05:52 +00:00
Fred Drake fd267d998d Piers Lauder <piers@cs.su.oz.au>:
This patch adds a comment about quoting to the doc string,
and also checks that the 'flags' argument to the STORE command
is appropriately enclosed inside parentheses to avoid quoting.
2000-05-25 03:25:26 +00:00
Greg Ward 101de37907 Fix to use 'change_root()' rather than directly mangling path. 2000-05-25 02:14:26 +00:00
Greg Ward 80fa55e71f Improvements to Bastian's build_scripts command:
* 'first_line_re' loosened up
  * command description improved
  * replaced '_copy_files()' and '_adjust_files()' with one method
    that does everything, 'copy_scripts()' -- this should be more
    efficient than Bastian's version, should behave better in
    dry-run mode, and does timestamp dependency-checking
2000-05-25 02:03:56 +00:00
Greg Ward 029e302786 Added comment to remind us of the (temporary?) obsolescense of the
'install_misc' class.
2000-05-25 01:26:23 +00:00
Greg Ward e3d17526b2 Use Distribution's 'has_scripts()' method instead of directly accessing
its 'scripts' attribute.
2000-05-25 01:21:54 +00:00
Greg Ward a4efe65b43 Bastian Kleineidam: the "build_scripts" command. 2000-05-25 01:20:15 +00:00
Greg Ward 8d5881a2ba Bastian Kleineidam: the "build_scripts" command and changes
necessary to support it.

Details:
  - build command additionally calls build_scripts
  - build_scripts builds your scripts in 'build/scripts' and adjusts the
    first line if it begins with "#!" and ends with "python", optionally
    ending with commandline options (like -O, -t ...).  Adjusting means we
    write the current path to the Python interpreter in the first line.
  - install_scripts copies the scripts to the install_scripts dir
  - install_data copies your data_files in install_data. You can
    supply individual directories for your data_files:

    data_files = ['doc/info.txt', # copy this file in install_scripts dir
      ('testdata', ['a.dat', 'b.dat']), # copy these files in
                                        # install_scripts/testdata
      ('/etc', ['packagerc']),    # copy this in /etc. When --root is
                                  # given, copy this in rootdir/etc
    ]

    So you can use the --root option with absolute data paths.
2000-05-25 01:19:18 +00:00
Greg Ward fcd974efbb Normalized all the end-of-class lines. 2000-05-25 01:10:04 +00:00
Guido van Rossum c580dae6da Fix a problem reported by Oleg Broytmann, who complains that very
often, ftp URLs hang in the final close.  Further analysis suggests
that this is because the close hook in addclosehook() calls the hook
before acually closing the connection.  The hook, in this case, waits
for the '226 Transfer complete' status from the server on the command
socket.  However, more and more ftp servers only send this status when
the data socket has actually been closed -- causing a deadlock.

The fix is simple: in addclosehook.close(), call addbase.close()
*before* calling the closehook.
2000-05-24 13:21:46 +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
Guido van Rossum 1d10f3eac2 Changed list_directory() somewhat. It is now only called when there
is no index.htm[l] file, and when it is called, it also spits out the
headers.  When an index.htm[l] file is present, the regular (file
access) path is followed.  Also, when the guessed content-type matches
text/*, open the file in text mode; otherwise in binary mode.
2000-05-21 16:25:29 +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
Guido van Rossum 974f70d97b Add call to putheader('Host', 'www.python.org') to the example. 2000-05-19 23:06:45 +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
Guido van Rossum 71260b846e Added math.rint() -- round according to current IEEE754 mode 2000-05-11 18:19:42 +00:00
Fred Drake 774c931c12 M.-A. Lemburg <mal@lemburg.com>:
Added another test for string formatting (the one that
produced the core dump now fixed in unicodeobject.c).
2000-05-09 19:57:46 +00:00
Guido van Rossum 57af072e5c Add a simple directory listing function. 2000-05-09 14:57:09 +00:00
Guido van Rossum 18865de7bd Set HTTPServer class variable allow_reuse_address to 1, so restarting
the server after it died doesn't require a wait period.
2000-05-09 14:54:13 +00:00
Guido van Rossum e3c7a5fbf5 Add class variable allow_reuse_address in TCPServer -- if nonzero, the
server_bind() method calls setsockopt(SOL_SOCKET, SO_REUSEADDR, 1).
2000-05-09 14:53:29 +00:00
Fred Drake fd4114e7b8 ConfigParser.read():
Instead of wrapping 'filenames' value in a list if it's a
        string, wrap it if it's a string or unicode string.
2000-05-09 14:46:40 +00:00
Guido van Rossum 2a91cd463a Caolan McNamara: properly undo the byte-stuffing of lines starting
with a dot.  [GvR change: only unstuff when line starts with two dots.]
2000-05-09 10:56:00 +00:00
Greg Ward 1500374667 Added comment about the MSVC-specific kludge. 2000-05-09 01:50:41 +00:00
Guido van Rossum 5879a533f1 Deleted some modules that are no longer supported. 2000-05-08 17:42:17 +00:00
Guido van Rossum aad6761cce The usual... 2000-05-08 17:31:04 +00:00
Guido van Rossum 0b095bc092 Deleted the stdwin-based test() function. 2000-05-08 17:29:50 +00:00
Guido van Rossum 813008e506 Deleting all stdwin library modules. 2000-05-08 17:25:17 +00:00
Jeremy Hylton e298c3018c if the GzipFile constructor fails, the __del__ method is still
called.  catch the resulting AttributeError and exit cleanly.
2000-05-08 16:59:59 +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
Guido van Rossum 5193114442 Alas, Vladimir's patch was too aggressive, and started causing really
weird errors.  (E.g. see thread "weird bug in test_winreg" in python-dev.)

Since it's actually useful to be able to re-run an individual test
after running test.autotest, we keep the unloading code, but only for
modules whose full name starts with "test.".
2000-05-05 14:27:39 +00:00
Guido van Rossum 4951782178 Raise ImportError when os.fork does not exist. 2000-05-04 00:36:42 +00:00
Jeremy Hylton be317e615e patches from Mark Hammond
Attached is a set of diffs for the .py compiler that adds support
for the new extended call syntax.

compiler/ast.py:
CallFunc node gets 2 new children to support extended call syntax -
"star_args" (for "*args") and "dstar_args" (for "**args")

compiler/pyassem.py
It appear that self.lnotab is supposed to be responsible for
tracking line numbers, but self.firstlineno was still hanging
around.  Removed self.firstlineno completely.  NOTE - I didnt
actually test that the generated code has the correct line numbers!!

Stack depth tracking appeared a little broken - the checks never
made it beyond the "self.patterns" check - thus, the custom methods
were never called!  Fixed this.

(XXX Jeremy notes: I think this code is still broken because it
doesn't track stack effects across block bounaries.)

Added support for the new extended call syntax opcodes for depth
calculations.

compiler/pycodegen.py

Added support for the new extended call syntax opcodes.

compiler/transformer.py

Added support for the new extended call syntax.
2000-05-02 22:32:59 +00:00
Guido van Rossum 1b6aecb08c I know this is only a temporary stop-gap measure, but the match() and
search() functions didn't even work because _fixflags() isn't
idempotent.  I'm adding another stop-gap measure so that you can at
least use sre.search() and sre.match() with a zero flags arg.
2000-05-02 15:52:33 +00:00
Guido van Rossum 823eb4ba81 Caolan McNamara:
telnetlib is unable to connect to a few telnet daemons because of
improper IAC handling, heres an attached oneliner to reject WILL
messages which will allow many more telnet daemons to work with it,
namely FreeBSD.
2000-05-02 14:32:11 +00:00
Guido van Rossum 4b83ecbbaa Eric Raymond:
Add a convenience function to generate C-compiler style error leaders.
2000-05-01 20:14:12 +00:00
Guido van Rossum eb4e11ae44 Eric Raymond:
Added and documented the capability for shlex to handle lexical-level
inclusion and a stack of input sources.  Also, the input stream member
is now documented, and the constructor takes an optional source-filename.
The class provides facilities to generate error messages that track
file and line number.

[GvR: I changed the __main__ code so that it actually stops at EOF, as
Eric surely intended -- however it returned '' instead of the None he
was testing for.]
2000-05-01 20:08:46 +00:00
Guido van Rossum d58c26fec6 Marc-Andre Lemburg:
The two methods .readline() and .readlines() in StreamReaderWriter
didn't define the self argument. Found by Tom Emerson.
2000-05-01 16:17:32 +00:00
Guido van Rossum 6650320349 Get rid of memory leak caused by assingning sys.exc_info() to a local.
Store sys.exc_info()[:2] instead.
2000-04-28 20:39:58 +00:00
Jeremy Hylton 7c4f96f442 Deviant1 didn't work as advertised 2000-04-27 21:42:48 +00:00
Jeremy Hylton 035a07e263 add some more contains tests on the builtin types 2000-04-27 21:40:08 +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
Guido van Rossum 868b50af17 Michael Hudson fixes a case where execv() is called (for a test) with
an empty argument list -- another patch he's checking in will make
this illegal (the first argument should always be the program name).
2000-04-26 20:32:08 +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
Guido van Rossum 7da3cc5dfb Michael Hudson:
I think that after this patch, all objects in the os module (with names
that don't start with "_") that can have docstrings, do, on Linux at
least.

Also fix a nit in one of my spawn* docstrings.
2000-04-25 10:53:22 +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
Andrew M. Kuchling 43c5af026f Fix to previous patch: send the request data when it's provided 2000-04-24 14:17:06 +00:00
Guido van Rossum c1488413e4 Added a provision to stop all threads before exiting from the test:
the change to regrtest.py to unload all newly imported modules did
something bad to the threads -- and I realized that they would never
stop!
2000-04-24 14:07:03 +00:00
Guido van Rossum 2512d6d83a Fix spelling error and remove Windows line endings. 2000-04-24 14:01:51 +00:00
Guido van Rossum 00f09b3821 Security patch for Unix by Chris McDonough.
This uses the same precautions when trying to find a temporary
directory as when the actual tempfile is created (using O_CREAT and
O_EXCL).  On non-posix platforms, nothing is changed.
2000-04-24 13:28:02 +00:00
Andrew M. Kuchling 141e9894b7 Fixed bug reported by JP Calderone: https:// URL's didn't work.
The fix also adds support for POSTing to an https URL
2000-04-23 02:53: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
Guido van Rossum 5796d26794 Patch by Vladimir Marangozov to unload additionally imported modules
after each test has been run.  This avoids excessive memory growth
during the tests.
2000-04-21 21:35:06 +00:00
Guido van Rossum cdd092fe48 Added test_winsound by Mark Hammond. 2000-04-21 21:28:47 +00:00
Guido van Rossum 84219682fb Charles Waldman writes:
"""
In the course of debugging this I also saw that cPickle is
inconsistent with pickle - if you attempt a pickle.load or pickle.dump
on a closed file, you get a ValueError, whereas the corresponding
cPickle operations give an IOError.  Since cPickle is advertised as
being compatible with pickle, I changed these exceptions to match.
"""
2000-04-21 20:49:58 +00:00
Guido van Rossum e0cd291b81 Doc strings for the spawn* functions, by Michael Hudson. 2000-04-21 18:35:36 +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