Commit Graph

2311 Commits

Author SHA1 Message Date
Guido van Rossum a5a24b76f4 Added has_option(); fix bug in get() which botched interpolation if
'%(' was found in first position (found by Fred Drake).
1999-10-04 19:58:22 +00:00
Guido van Rossum 6a8d84b0c1 Urmpfh!
Withdraw the change that Fred just checked in -- it was a poorly
documented feature, not a bug, to ignore I/O errors in read().

The new docstring explains the reason for the feature:
"""
this is designed so that you can specifiy a list of potential
configuration file locations (e.g. current directory, user's home
directory, systemwide directory), and all existing configuration files
in the list will be read.
"""

Also add a lower-level function, readfp(), which takes an open file
object (and optionally a filename).

XXX There are some other problems with this module, but I don't have
time to dig into these; in particular, there are complaints that the
%(name)s substitution from the [DEFAULTS] section doesn't work
correctly.
1999-10-04 18:57:27 +00:00
Fred Drake 2438a485c8 ConfigParser.read(): Don't mask IOError exceptions. 1999-10-04 18:11:56 +00:00
Greg Ward ef93095adb Filter 'glob()' results so we only look at regular files. 1999-10-03 21:09:14 +00:00
Greg Ward 3c6204a87f Pass 'force' flag to 'new_compiler()'. 1999-10-03 21:08:42 +00:00
Greg Ward 455eb61648 Don't import what we don't use. 1999-10-03 21:07:21 +00:00
Greg Ward ef9ad6df01 Tweaked verbosity messages for byte-compilation. 1999-10-03 21:03:26 +00:00
Greg Ward 0c35ac62d8 Added 'force' and 'quiet' (negative alias for 'verbose') to the
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.
1999-10-03 21:02:48 +00:00
Greg Ward f3b997a7f0 Fixed 'mkpath()' to normalize the path right off the bat -- cleans up
the code a bit and should make it work under Windows even with trailing
  backslash.
Fixed a couple of docstrings.
Added comment about 'make_file()' possibly being redundant and unnecessary.
1999-10-03 20:50:41 +00:00
Greg Ward a564cc315b Hacked to support the notion of "negative alias" options, to handle
-q/--quiet reasonably elegantly.
1999-10-03 20:48:53 +00:00
Greg Ward c74138d941 Catch up with changes in 'gen_lib_options()':
- change how we call it
  - added methods 'library_dir_option()', 'library_option()', and
    'find_library_file()' that it calls
Added 'force' flag; it's automatically "respected", because this class
  always rebuilds everything!  (Which it to say, "force=0" is not respected.)
1999-10-03 20:47:52 +00:00
Greg Ward 4fecfce4d0 Fixed order of link options: object files now precede library stuff.
Catch up with changes in 'gen_lib_options()':
  - change how we call it
  - added methods 'library_dir_option()', 'library_option()', and
    'find_library_file()' that it calls
Added 'force' flag and changed compile/link methods to respect it.
1999-10-03 20:45:33 +00:00
Greg Ward 3febd60682 Slight change to the meaning of the 'libraries' list: if a library name
has a directory component, then we only search for the library in
  that one directory, ie. ignore the 'library_dirs' lists for that
  one library.
Changed calling convention to 'gen_lib_options()' again: now, it takes
  a CCompiler instance and calls methods on it instead of taking
  format strings.  Also implemented the new "library name" semantics
  using the 'find_library_file()' method in the CCompiler instance.
Added 'force' flag to CCompiler; added to constructor and 'new_compiler()'.
Added 'warn()' method.
1999-10-03 20:41:02 +00:00
Guido van Rossum 8e7eaa8ac8 Duncan Grisby noted a typo in _DummyThread. 1999-09-29 15:26:52 +00:00
Greg Ward b24afe19db Added 'list_only' option (and modified 'run()' to respect it). 1999-09-29 13:14:27 +00:00
Greg Ward 274ad9dc81 Added all documentation.
Slightly improved the code for dealing with newline on a comment line,
  and for stripping whitespace.
1999-09-29 13:03:32 +00:00
Greg Ward ef4490f501 New command to generate source distribution based on a manifest file. 1999-09-29 12:50:13 +00:00
Greg Ward a6cb8ae7bc Added 'package' option.
Catch up with renamed 'platdir' -> 'build_platlib' option in 'build'.
Don't call 'set_final_options()' in 'run()' anymore -- that's now
  guaranteed to be taken care of for us by the Distribution instance.
If 'include_dirs' is a string, split it on os.pathsep (this is half-
  hearted -- support for setting compile/link options on the command
  line is totally lame and probably won't work at all).
Added 'get_source_files()' for use by 'dist' command.
Added code to 'build_extensions()' to figure out the "def file" to use
  with MSVC++ and add it to the linker command line as an "extra_postarg".
1999-09-29 12:49:35 +00:00
Greg Ward 2a612067e6 Renamed 'dir' option to be consistent with other commands.
Don't call 'set_final_options()' in 'run()' anymore -- that's now
  guaranteed to be taken care of for us by the Distribution instance.
Rearranged to bit to allow outsiders (specifically, the 'dist' command)
  to find out what modules we would build:
  - 'find_modules()' renamed to 'find_package_modules()'
  - most of 'build_modules()' abstracted out to 'find_modules()'
  - added 'get_source_files()' (for the 'dist' command to use)
  - drastically simplified 'build_modules()' -- now just a wrapper around
    'find_modules()' and 'build_module()'
1999-09-29 12:44:57 +00:00
Greg Ward e6ac2fcc12 Renamed many options to be consistent across commands.
Tweaked some help strings to be consistent with documentation.
Don't call 'set_final_options()' in 'run()' anymore -- that's now
  guaranteed to be taken care of for us by the Distribution instance.
1999-09-29 12:38:18 +00:00
Greg Ward df178f97de Catch up with latest changes in CCompiler:
- add 'extra_preargs' and 'extra_postargs' parameters (and use them!)
  - got rid of 'build_info' kludge parameter
  - added 'compiler_type' class attribute
  - respect reordered arguments to 'gen_lib_options()'
Also added 'output_dir' parameter (catching up with older change in
  CCompiler) -- BUT this is presently ignored by all methods!
Deleted some more docstrings redundant with CCompiler.
Dropped generated of "/DEF:" argument --- that's now done by
  the 'build_ext' command.
1999-09-29 12:29:10 +00:00
Greg Ward 0e3530ba28 Catch up with latest changes in CCompiler:
- add 'extra_preargs' and 'extra_postargs' parameters (and use them!)
  - added 'compiler_type' class attribute
  - respect reordered arguments to 'gen_lib_options()'
1999-09-29 12:22:50 +00:00
Greg Ward 802d6b7b4c Added 'extra_preargs' and 'extra_postargs' parameters to most methods,
which allowed us to get rid of the 'build_info' used in some places
  (a temporary kludge to support MSVC++ "def" files).
Deleted big comment whining about that kludge.
Added 'compiler_type' class attribute.
Overhauled 'new_compiler()': now takes 'compiler' argument along with
  'plat' (both optional with sensible defaults), and looks them both up
  in the new 'default_compiler' and 'compiler_class' dictionaries to
  figure out where to get the concrete compiler class from.
Reordered arguments to 'gen_lib_options()' to match the order in
  which the arguments are generated (ie. -L before -l).
1999-09-29 12:20:55 +00:00
Greg Ward cd1486fff1 More tweaks to 'mkpath()':
- deal with empty tail from os.path.split() (eg. from trailing slash,
    or backslash, or whatever)
  - check PATH_CREATED hash inside loop as well
1999-09-29 12:14:16 +00:00
Greg Ward 3868eb97c8 Added 'ready' flag and 'ensure_ready()' method to Command: together
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()'.
1999-09-29 12:12:19 +00:00
Greg Ward da2d352bdb Added docstring and RCS id (apparently some Windows tar extractors
ignore zero-byte files: grr...).
1999-09-22 15:24:04 +00:00
Greg Ward df0d33586d Ditched the whole notion of "alias options": this meant dropping the
'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.
1999-09-21 18:41:36 +00:00
Greg Ward ac1424a9ce Added 'write_file()' function.
Added global cache PATH_CREATED used by 'mkpath()' to ensure it doesn't
  try to create the same path more than once in a session (and, more
  importantly, to ensure that it doesn't print "creating X" more than
  once for each X per session!).
1999-09-21 18:37:51 +00:00
Greg Ward b116e45a29 In 'link_shared_object()', try to be less sensitive to missing input files
in dry-run mode.
1999-09-21 18:36:15 +00:00
Greg Ward fbf8affca1 Typecheck elements of 'macros' parameter in 'gen_preprocess_options(). 1999-09-21 18:35:09 +00:00
Greg Ward d4b8429fc5 Added docstring, brought __all__ up-to-date. 1999-09-21 18:33:09 +00:00
Greg Ward 865de83668 Added 'install_path' option for giving non-packagized module
distributions their own directory (and .pth file).
Overhauled how we determine installation directories in
  'set_final_options()' to separate platform-dependence and take
  'install_path' option into account.
Added 'create_path_file()' to create path config file when 'install_path'
  given.
Only run 'install_py' and 'install_ext' when, respectively, there are
  some pure Python modules and some extension modules in the distribution.
1999-09-21 18:31:14 +00:00
Greg Ward 02e1c56212 Only run build_py if we have pure Python modules, and build_ext if we
have extension modules.
1999-09-21 18:27:55 +00:00
Greg Ward dbb96253ea Some option changes:
- rename 'dir' to 'build_dir'
  - take 'package' from distribution option 'ext_package'
  - take 'extensions' from distribution option 'ext_modules'
  - take 'include_dirs' from distribution
Name keyword args explictly when calling CCompiler methods.
Overhauled how we generate extension filenames (in 'extension_filename()
  and 'build_extension()') to take 'package' option into account.
1999-09-21 18:27:12 +00:00
Greg Ward 17dc6e7ed8 Basically a complete rewrite to support dealing with modules in whole
packages and searching for source files by 'package_dir'.
1999-09-21 18:22:34 +00:00
Guido van Rossum ea7364c7cd Peter Haight discovered that this code uses a mutable default for cnf
and then (under certain circumstances) can clobber the default!
He also submitted this patch as PR#82.
1999-09-20 00:39:47 +00:00
Guido van Rossum f3c5f5c044 After much hemming and hawing, we decided to roll back Fred's change.
It breaks Mailman, it was actually documented in the docstring, so it
was an intentional deviation from the usual del semantics.  Let's
document the original behavior in Doc/lib/librfc822.tex.
1999-09-15 22:15:23 +00:00
Guido van Rossum ba895d892d Typo: the method called is do_SPAM, not handle_SPAM. 1999-09-15 15:28:25 +00:00
Guido van Rossum 0079b288f5 Put Sam Rushing's original RCS ID string back, without dollars around it. 1999-09-14 20:17:50 +00:00
Guido van Rossum c2b6de5b91 Put Sam Rushing's original RCS ID string back, without dollars around it. 1999-09-14 20:16:00 +00:00
Greg Ward fa4eb188f4 Changed selection of installation directories (in 'set_final_options()')
so that pure Python modules are installed to the platform-specific
directory if there are any extension modules in this distribution.
1999-09-13 13:58:34 +00:00
Greg Ward c9c011cd96 Straightened up the selection of installation directories for platform-
specific files; it was somewhat broken, and the comments were dead
  wrong.
Now runs 'install_ext' command after 'install_py'.
1999-09-13 13:57:26 +00:00
Greg Ward 609a5c818d Added support for 'package' option, including where to link the
actual extension module to.
1999-09-13 13:55:34 +00:00
Greg Ward 68bdf3eeb7 Comment addition. 1999-09-13 13:54:06 +00:00
Greg Ward 36e68e21b4 Now run 'build_ext'.
Default platform-specific build directory changed to 'build/platlib'.
1999-09-13 13:52:12 +00:00
Greg Ward 8037cb11f5 Added 'output_dir' parameter to 'compile()' and 'link_shared_object().
Changed those two methods to only compile/link if necessary (according
  to simplistic timestamp checks).
Added 'output_dir' to 'object_filenames()' and 'shared_object_filename()'.
1999-09-13 03:12:53 +00:00
Greg Ward 3b120ab374 New command -- install_ext to install extension modules. 1999-09-13 03:10:25 +00:00
Greg Ward 138ce653cc Added 'newer_pairwise()' and 'newer_group()'.
Terminology change in 'newer()'.
Made 'copy_tree' respect dry_run flag a little better.
Added 'move_file()'.
1999-09-13 03:09:38 +00:00
Greg Ward 9b17cb5819 Added 'output_dir' attribute, and 'output_dir' parameter to several method
signatures, and updated some docstrings to reflect it.
Some comments added.
Added 'announce()' and 'move_file()' methods.
1999-09-13 03:07:24 +00:00
Greg Ward 1ae3246679 Fixed some goofs in 'alias_options'.
Error message tweak in Command.set_option().
Added Command.get_peer_option().
Added Command.move_file() wrapper.
1999-09-13 03:03:01 +00:00
Fred Drake 81ffe75d1c Message.__delitem__(): If the key doesn't exist in the dictionary,
raise KeyError instead of failing silently!
1999-09-10 20:54:53 +00:00
Guido van Rossum 75ae7e7dfa Fix for PR#74 -- use int() instead of eval() to extract the exponent. 1999-09-10 14:34:48 +00:00
Barry Warsaw 148ffbc886 canonic(): This used to be equivalent to str() but that caused too
much breakage (esp. in JPython which holds absolute path names in
co_filename already).  This implementation uses os.path.abspath() as a
slightly better way to canonicalize path names.  It implements a
cache.
1999-09-09 23:24:33 +00:00
Barry Warsaw 2bee8feac6 Pdb.lineinfo(): Don't use os.popen('egrep ...') to find the line in
the file that a function is defined on.  Non-portable to Windows and
JPython.  Instead, new find_function() uses re module on a similar
(simple-minded) pattern.
1999-09-09 16:32:41 +00:00
Guido van Rossum a41c691371 Make the maxsize constructor argument default to 0 (an unlimited queue size). 1999-09-09 14:54:28 +00:00
Greg Ward 71eb8644d7 Changed to reflect the new "command options" regime -- in particular,
we no longer explicitly pull distribution options out of our Distribution
object, but rather let the Distribution put them into the command object.
1999-09-08 02:42:30 +00:00
Greg Ward 42926ddc7e Careful rethink of command options, distribution options, distribution
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()'.
1999-09-08 02:41:09 +00:00
Greg Ward 3d50b908ba Ditched redundant docstrings and comments (overlap with ccompiler.py).
Ditched redundant '_gen_preprocess_options()' and '_gen_lib_options()'
  -- now provided by ccompiler.py.
Fixed some filename extension variables -- added missing period.
Cosmetic tweaks.
1999-09-08 02:36:01 +00:00
Greg Ward c294113f18 Ditched '_gen_preprocess_options()' and '_gen_lib_options()' -- they're
now provided (minus the leading underscore) by the ccompiler module.
Fix 'compile()' to return the list of object files generated.
Cosmetic tweaks/delete cruft.
1999-09-08 02:32:19 +00:00
Greg Ward f7a39ecac1 os.name is "posix" or "nt" or we don't care.
Added big comment about the kludginess of passing 'build_options'
  to the link methods and how to fix it.
Added 'gen_preprocess_options()' and 'gen_lib_options()' convenience
  functions -- the two cases are very similar for Unix C Compilers and
  VC++, so I figured I might as well unify the implementations.
1999-09-08 02:29:08 +00:00
Greg Ward a4d132a868 [from 1999/08/28]
Apparently os.name is "nt" or "posix" or we don't care.
Cosmetic tweaks.
1999-09-08 02:23:28 +00:00
Andrew M. Kuchling 2d813e5140 Fixed 'return EOFError' that should be 'raise EOFError', caught by
Skip Montanaro's return-value patches.
1999-09-06 16:34:51 +00:00
Guido van Rossum a07934e53f Correct typo in AddressList.__getitem__. By Moshe Zadka. 1999-09-03 13:23:49 +00:00
Guido van Rossum 183fd40987 Fix indent error in __format(): del context[objid] at the end should
be executed in all cases, not just when it's not a list, tuple or
dict.  Discovered by Christian Tismer.
1999-09-02 15:09:44 +00:00
Greg Ward 65f4a3b173 Patch from Perry Stoll: caught up with changes in CCompiler necessary (?)
for MSVCCompiler.
1999-08-29 18:23:32 +00:00
Greg Ward 32162e832e Patch from Perry Stoll: tweaks to Windows support. 1999-08-29 18:22:13 +00:00
Greg Ward 69628b0ad1 Patch from Perry Stoll: support for Windows. 1999-08-29 18:20:56 +00:00
Greg Ward 1ea8af2fe0 Patch from Perry Stoll: import types module. 1999-08-29 18:20:32 +00:00
Greg Ward 440e2f51ea Patch from Perry Stoll: typo fix, make sure we only compile .py files. 1999-08-29 18:19:37 +00:00
Greg Ward 5d60fcf02a Patch from Perry Stoll: OK for list of modules to be empty. 1999-08-29 18:19:01 +00:00
Greg Ward 2f1b5bb905 Patch from Perry Stoll: pass 'build_info' to link method. 1999-08-29 18:18:26 +00:00
Greg Ward 26e48ea7df Patch from Perry Stoll:
- fix some broken abstract methods
  - kludge: add 'build_info' parameter to link methods
  - add 'object_name()' and 'shared_library_name()'
  - support for MSVCCompiler class on NT/Win95
1999-08-29 18:17:36 +00:00
Greg Ward dbd1276dcb Added msvccompiler module exactly as supplied by Perry Stoll. 1999-08-29 18:15:07 +00:00
Guido van Rossum b35d6846d9 Sjoerd Mullender writes:
"""
Added some optional arguments to the XMLParser __init__ method to
specify that selected non-standard constructs are to be accepted.
Also removed the documentation for handle_entityrefs since it isn't
used.
"""

The version is incremented to 0.3.
1999-08-26 15:52:33 +00:00
Guido van Rossum 3601e88cb3 Sjoerd Mullender writes:
"""
Extended chunk so that it can also handle formats that are almost
according to EA IFF 85.  In particular, added options to handle
little-endian and to handle formats that include the header size in
the chunk size value.

Fixed a bug where the header size was included in the chunk size, which
it isn't according to EA IFF 85.

Added a new method getsize() to get the size of the chunk (excluding
header).

Fixed chunk documentation (TIFF doesn't look like it uses chunks).
Converted wave to use chunk.  Wave uses EA IFF 85 chunks except that
it uses little-endian encoding of integer data.

Removed __del__ methods from aifc and wave since I got an
AttributeError there upon exit.
"""
1999-08-26 15:50:43 +00:00
Guido van Rossum e61e98d2ae Add calls to self.protocol("WM_DELETE_WINDOW", self.destroy) to the Tk
and Toplevel class constructors.  This means that if the window
manager closes the window, the Python-side Tkinter data structures
will be destroyed correctly.  (Most apps do this anyway, and it's
recommended practice; I see no reason why making it the default
behavior could be bad.)
1999-08-20 18:26:06 +00:00
Barry Warsaw 008edbf973 A nit to make Fred proud. 1999-08-19 21:17:08 +00:00
Greg Ward 1016af9fa6 Oops, call 'os.path.join()'! 1999-08-19 20:02:10 +00:00
Guido van Rossum f8e390b1b5 New version by Mark-Andre Lemburg (generated by a script, parseentities.py). 1999-08-19 15:59:35 +00:00
Guido van Rossum 1ebcf6aabb Patches by Michael Reilly to correctly deal with ftp URLs of the form
ftp://user@host//root/path: the double slash in the pathname means to
go to the root directory even if the initial directory isn't the root.
1999-08-18 21:51:10 +00:00
Guido van Rossum 959fa01dc3 Typo in comment (on Mac, it's the *resource* fork that's not copied,
the data fork *is* copied).
1999-08-18 20:03:17 +00:00
Guido van Rossum 5e006a3cc3 Patches by Michael Reilly to correctly deal with ftp URLs of the form
ftp://user@host//root/path: the double slash in the pathname means to
go to the root directory even if the initial directory isn't the root.
1999-08-18 17:40:33 +00:00
Guido van Rossum 6c395ba316 Add Tim Peters' shuffle() algorithm. 1999-08-18 13:53:28 +00:00
Greg Ward e393ddb2e0 Implements the 'build_ext' command for building C/C++ extension modules. 1999-08-14 23:57:49 +00:00
Greg Ward b4dbfb318c Module to spawn sub-commands in a platform-independent way.
Initial revision only includes support for POSIX-style fork-and-exec.
1999-08-14 23:57:17 +00:00
Greg Ward 5e71744000 Changed to use 'spawn()', now that it exists.
Added 'verbose' and 'dry_run' parameters to constructor.
Changed 'compile()', 'link_*()' to default lists arguments to None
  rather than empty list.
Added implementations of the filename-mangling methods mandated by
  the CCompiler interface.
1999-08-14 23:53:53 +00:00
Greg Ward e1aaaa653c Added 'verbose' and 'dry_run' flags to CCompiler constructor and
'new_compiler()' factory function.
Added 'runtime_library_dirs' list (for -R linker option) and methods
  to manipulate it.
Deleted some obsolete comments.
Added all the filename manglign methods: 'object_filenames()',
  'shared_object_filename()', 'library_filename()',
  'shared_library_filename()'.
Added 'spawn()' method (front end to the "real" spawn).
1999-08-14 23:50:50 +00:00
Greg Ward 7f65c65208 Comment tweak. 1999-08-14 23:47:21 +00:00
Greg Ward 0081cc529c Better detection of bad entries in option table.
Better error messages for bad entries in option table.
1999-08-14 23:44:37 +00:00
Greg Ward 8c66b697c1 Added DistutilsExecError, DistutilsValueError. 1999-08-14 23:43:45 +00:00
Guido van Rossum 2f7df12f33 Patch by Paul Sokolovsky to support the get() method. 1999-08-11 01:54:05 +00:00
Greg Ward abc2f960d4 Allow comment characters (#) to be escaped:
- did away with 'comment_re' option -- it's just not that simple anymore
  - heavily revised the main logic in 'readline()' to accomodate this
Beefed up 'warn()': 'line' can be list or tuple, and 'msg' is
  automatically converted to a string.
1999-08-10 20:09:38 +00:00
Andrew M. Kuchling 916fcc3b18 Added __del__ method to GzipFile class that will flush and close the
object, if required.
1999-08-10 13:19:30 +00:00
Guido van Rossum a74c55662f Mark Hammond writes:
"""
If the filename being complained about contains a space, enclose the
file-name in quotes.

The reason is simply that when I try and parse tabnanny's output, filenames
with spaces make it very difficult to determine where the filename stops
and the linenumber begins!
"""

Tim approves.

I slightly changed the patch (use 'in' instead of string.find()) and
arbitrarily bumped the __version__ variable up to 6.
1999-07-30 17:48:20 +00:00
Guido van Rossum 42b334d93d Remove some redundant code from Canvas.tag_bind(), which added all
bindings to a dictionary _tagcommands which was otherwise unused.
(This was checked in accidentally with rev. 1.125 and not deleted with
rev. 1.127 when the other half of this code was removed -- although
even as originally checked in the _tagcommands variable was never
used.)

(PR#40, reported by Peter Stoehr)
1999-07-30 12:22:12 +00:00
Guido van Rossum 2ab455a8fa Another patch from Andy Dustman:
"""
Here's a patch for the ForkingMixIn which will prevent the server from
forking itself into the ground. Note: I've tested a very similar patch
(subclassed ForkingMixIn) but not actually tested this one. As you might
surmise, this was done out of necessity...

If the maximum number of children are already running, block while waiting
for a child to exit.
"""

(I added that last sentence as a comment to the code --GvR.)
1999-07-28 21:39:28 +00:00
Fred Drake 69f87c580d getsize(), getatime(), getmtime():
Constants from stat module were imported using "import *";
	don't access them via stat.ST_*!

	Reported by that other vR.  ;-)
1999-07-23 15:04:05 +00:00
Guido van Rossum ba508a21e0 Add test case for bug just fixed by Stephen Turner. 1999-07-13 15:23:42 +00:00
Barry Warsaw 7c5b9d1fa9 added a test for "To: :" patch 1999-07-12 18:47:00 +00:00
Barry Warsaw 96e9bf45e8 AddrlistClass.getaddress(): when parsing `:'s, in the loop, watch out
for gotonext() pushing self.pos past the end of the string.  This can
happen if the message has a To field like "To: :" and you call
msg.getaddrlist('to').
1999-07-12 18:37:02 +00:00
Greg Ward 170bdc08e1 The first concrete subclass of CCompiler: defines a barebones Unix C compiler. 1999-07-10 02:04:22 +00:00
Greg Ward 3f81cf7936 The abstract base class that defines the C/C++ compiler abstraction model. 1999-07-10 02:03:53 +00:00
Greg Ward ba3f108ec0 Added a self-berating command relating to installation directories for
module distributions that contain platform-specific files.
1999-07-10 02:02:31 +00:00
Greg Ward ccbb3f0ed4 Don't pollute importer's namespace with type objects from types modules.
Added DistutilsPlatformError.
1999-07-10 02:01:44 +00:00
Guido van Rossum 6ebb387a08 Patch by Jeffrey Chang to add docstrings everywhere.
The text is condensed from the library manual.
1999-07-09 21:15:32 +00:00
Fred Drake d5f173bf1f FTP.dir(): Fix typo in docstring. 1999-07-07 13:36:59 +00:00
Guido van Rossum 3427c1f71b Sjoerd Mullender:
In splithost, accept empty host part in URLs.  This is required for
file URLs that can have an empty host part.  For such URLs, we should
not return the initial 2 slashes as part of the file name.
1999-07-01 23:20:56 +00:00
Fred Drake b5879ca2e9 Relocating file to Lib/lib-old. 1999-07-01 16:59:29 +00:00
Fred Drake b8690fbc95 Define NotANumber as a subclass of ValueError when using class-based
exceptions.

When raising NotANumber, pass the string that failed as the exception
value.
1999-06-29 15:49:35 +00:00
Fred Drake 5c4012adc0 While we're at it, convert to docstrings and set the indentation level
to 4.
1999-06-25 18:53:23 +00:00
Guido van Rossum 7ea8f8404c Break some cycles when the widget is destroyed. 1999-06-25 15:53:54 +00:00
Fred Drake 624a191512 Patch from Sjoerd Mullender:
Make argument names equal to what is used in the documentation of the
file object, since chunks are supposedly file-like.
1999-06-25 14:58:44 +00:00
Guido van Rossum 59834f11e3 Mikael Lyngvig writes:
I just noticed that the changes below also apply to cmpcache.py, which
is virtually identical to cmp.py.
1999-06-25 14:21:44 +00:00
Guido van Rossum 3aa9ca147b Patch by Mikael Lyngvig:
1. Fix incorrect file open mode on Win32 platforms (use "rb" instead
of "r").

2. Add shallow parameter to cmp.cmp().  If false, deep file
comparisons are made.

The module should be 100 percent backwards compatible.
1999-06-25 14:12:50 +00:00
Guido van Rossum 336a201d4f Sjoerd Mullender writes:
Urllib makes the URL of the opened file available through the geturl
method of the returned object.  For local files, this consists of
file: plus the name of the file.  This results in an invalid URL if
the file name was relative.  This patch fixes this so that the
returned URL is just a relative URL in that case.  When the file name
is absolute, the URL returned is of the form file:///absolute/path.

[I guess that a URL of the form "file:foo.html" is illegal...  GvR]
1999-06-24 15:27:36 +00:00
Guido van Rossum ff3a278d3b Small patch by Tim Peters - it was using self.maxlist when it should
be using self.maxdict.
1999-06-23 23:27:05 +00:00
Fred Drake 4316135a44 Make the mode parameter to open() default in the same way as for wave.open(). 1999-06-22 21:23:23 +00:00
Guido van Rossum 8746082175 Patch by Tim Peters:
Introduce a new builtin exception, UnboundLocalError, raised when ceval.c
tries to retrieve or delete a local name that isn't bound to a value.
Currently raises NameError, which makes this behavior a FAQ since the same
error is raised for "missing" global names too:  when the user has a global
of the same name as the unbound local, NameError makes no sense to them.
Even in the absence of shadowing, knowing whether a bogus name is local or
global is a real aid to quick understanding.

Example:

D:\src\PCbuild>type local.py
x = 42

def f():
    print x
    x = 13
    return x

f()

D:\src\PCbuild>python local.py
Traceback (innermost last):
  File "local.py", line 8, in ?
    f()
  File "local.py", line 4, in f
    print x
UnboundLocalError: x

D:\src\PCbuild>

Note that UnboundLocalError is a subclass of NameError, for compatibility
with existing class-exception code that may be trying to catch this as a
NameError.  Unfortunately, I see no way to make this wholly compatible
with -X (see comments in bltinmodule.c):  under -X, [UnboundLocalError
is an alias for NameError --GvR].

[The ceval.c patch differs slightly from the second version that Tim
submitted; I decided not to raise UnboundLocalError for DELETE_NAME,
only for DELETE_LOCAL.  DELETE_NAME is only generated at the module
level, and since at that level a NameError is raised for referencing
an undefined name, it should also be raised for deleting one.]
1999-06-22 14:47:32 +00:00
Guido van Rossum 1a03cf56e0 Greg McFarlane submitted two missing Text methods: mark_next() and
mark_previous().
1999-06-21 14:13:30 +00:00
Fred Drake 4f298695be Relocating file to Lib/lib-old. 1999-06-18 17:12:36 +00:00
Guido van Rossum 9e480adf9b Patch suggested (and partially provided) by Lars Damerow: instead of
always lowercasing the option name, call a method optionxform() which
can be overridden.  Also make the regexps SECTRE and OPTRE non-private
variables so they can also be overridden.
1999-06-17 18:41:42 +00:00
Guido van Rossum bfadac00ef In collect_children(), put a try-except around os.waitpid() because it
may raise an exception (when there are no children).  Reported by
Andy Dustman.
1999-06-17 15:41:33 +00:00
Fred Drake f9607821ad open(): Make the mode parameter optional; if omitted or None, use the
mode attribute of the file object (if it has one), otherwise
	 use 'rb'.

	 The documentation should still show this as required until
	 there's a new release.
1999-06-17 15:18:47 +00:00
Guido van Rossum 9f612f9c5a Suppress warning print statements about modules not found, they are
confusing to end users of IDEs.
1999-06-16 12:28:12 +00:00
Guido van Rossum 7bb11d68bf Sjoerd Mullender:
Added support for unseekable files.

(I use unqualified excepts since we don't know why the seek/tell might
fail.  In my case it was because of an AttributeError.)
1999-06-16 12:25:34 +00:00
Guido van Rossum f2f0594587 Laurence Tratt notes that the accept() call in get_request() can fail,
and suggests putting a try/except around the get_request() call in
handle_request().  (All in class TCPServer.)
1999-06-15 22:25:32 +00:00
Guido van Rossum 47ac4e6b41 Add the test case provided by Barry Scott for his patch. 1999-06-15 18:56:46 +00:00
Guido van Rossum b184487055 Barry Scott writes:
Problem: rfc822.py in 1.5.2 final loses the quotes around
quoted local-part names.

The fix is to preserve the quotes around a local-part
name in an address.

Test:

	import rfc822
	a = rfc822.AddrlistClass('(Comment stuff) "Quoted
name"@somewhere.com')
	a.getaddrlist()

The correct result is:

	[('Comment stuff', '"Quoted name"@somewhere.com')]
1999-06-15 18:06:20 +00:00
Barry Warsaw 6e1d78a181 Added a couple of endswith test cases for bugs reported by Timbot.
Also added a short circuit for the regression test suite since CVS
insisted on putting this file in the main branch. :(
1999-06-15 16:49:11 +00:00
Barry Warsaw d5258681e7 Added more tests of join 1999-06-14 18:38:42 +00:00
Fred Drake cbfa5cbcc8 Message.getheaders(): If there are no matching headers, return an
empty list instead of None.  (Guido's request.)
1999-06-14 15:40:23 +00:00
Guido van Rossum 60a3bd8130 After more discussion with Jim, change the behavior so that only a
*missing* content-type at the outer level of a POST defaults to
urlencoded.  In all other circumstances, the default is read_singe().
1999-06-11 18:26:09 +00:00
Barry Warsaw 122473fc70 Two extra startswith tests 1999-06-11 17:51:13 +00:00
Barry Warsaw 8a9514a660 Harness can now test object methods directly, if they aren't available
in the string module.

Add a bunch of new tests for extended startswith/endswith arguments.
1999-06-11 17:48:07 +00:00
Guido van Rossum 18df5d479c Mark Hammond: patch for Windows/CE. 1999-06-11 01:37:27 +00:00
Barry Warsaw 4afdb0a89a Output for the regression test of the new string methods. 1999-06-10 22:53:23 +00:00
Barry Warsaw 50f0e16d1b Regression test for the new string methods. 1999-06-10 22:53:10 +00:00
Fred Drake 2b755b88c0 Relocating file to Lib/lib-old. 1999-06-10 21:18:02 +00:00
Guido van Rossum b269302695 Added a few more bugs to the doc string; reformatted existing bugs. 1999-06-10 19:05:54 +00:00
Guido van Rossum a3b4a33f3b Co-production with Tim Peters, implementing a suggestion by Mark
Hammond: record top-level functions (as Function instances, a simple
subclass of Class).  You must use the new interface readmodule_ex() to
get these, though.
1999-06-10 14:39:39 +00:00
Guido van Rossum 3d548717f5 Fix by Sjoerd for a package related bug: If you have a non-empy
__init__.py it isn't read.  (Sjoerd just came up with this, so it's
not heavily tested.)

Other (yet unsolved) package problems noted by Sjoerd:

- If you have a package and a module inside that or another package
  with the same name, module caching doesn't work properly since the
  key is the base name of the module/package.
- The only entry that is returned when you readmodule a package is a
  __path__ whose value is a list which confuses certain class browsers
  that I wrote.  (Hm, this could be construed as a feature.)
1999-06-09 15:49:09 +00:00
Guido van Rossum 0dee4ee0f8 Updated lagging version#. Also added some comments about how quote()
and quote_plus() can be optimized tenfold.
1999-06-09 15:14:50 +00:00
Guido van Rossum db23d3dbf7 Patch by Per Cederqvist:
I've found two places where smtplib.py sends an extra trailing space
on command lines to the SMTP server.  I don't know if this ever causes
any problems, but I'd prefer to be on the safe side.  The enclosed
patch removes the extra space.
1999-06-09 15:13:10 +00:00
Guido van Rossum b39aff87f7 Add unrelated but handy function: timegm(), to calculate Unix
timestamp from GMT tuple.
1999-06-09 15:07:38 +00:00
Guido van Rossum 145a5f73f0 Don't just die if gethostbyaddr() fails -- as it can when DNS is
unreachable -- but fall back to using whatever hostname we have.
1999-06-09 15:05:47 +00:00
Guido van Rossum 56b20595e6 Oops, Sjoerd was in a hurry. This patch from him fixes some length
math in the Chunk class.
1999-06-09 13:41:18 +00:00
Guido van Rossum 8ea7bb8e78 Patch/new code by Sjoerd Mullender:
Separate the Chunk class out of the aifc module into a new "chunk" module.
1999-06-09 13:32:28 +00:00
Guido van Rossum 1f2e09bc45 Fix (sanctioned by Sjoerd) for a problem reported by Andreas Faerber:
all processing instruction target names containing 'xml' were
rejected, instead (as the standard rejects) only the name 'xml' itself
(or case variants thereof).
1999-06-08 21:23:26 +00:00
Greg Ward 5116f90ece On David Ascher's recommendation: reversed order of 'utime()' and
'chmod()' in 'copy_file()'.
1999-06-08 17:05:21 +00:00
Guido van Rossum a8d0f4fd2d Sam's latest versions 1999-06-08 13:20:05 +00:00
Guido van Rossum cf09a3924f Skip Montanaro:
I guess in 1.5.2 a new module, whichdb, was added that attempts to
divine the nature of a database file.  This module doesn't know anything
about Berkeley DB v2 files.  In v2, Sleepycat added a 12-byte null pad
in front of the old magic numbers (at least for hash and btree files).
I've been using v2 for awhile and upgrading to 1.5.2 broke all my
anydbm.open calls. I believe the following patch corrects the problem.
1999-06-08 13:13:16 +00:00
Guido van Rossum df9f7a3e52 Tim Peters: Taught it more "real Python" rules without slowing it
appreciably.  Triple-quoted strings no longer confuse it, nor nested
classes or defs, nor comments starting in column 1.  Chews thru
Tkinter.py in < 3 seconds for me; doctest.py no longer confuses it; no
longer missing methods in PyShell.py; etc.  Also captures defs
starting in column 1 now, but ignores them; an interface should be
added so that IDLE's class browser can show the top-level functions
too.
1999-06-08 12:53:21 +00:00
Greg Ward 9a33707be7 Hacked 'set_final_options()' to set (hopefully) appropriate values for
'install_site_lib' and install_site_platlib' on non-POSIX platforms.
Should at least work for NT, as this is adopted from Amos Latteier's NT
patches.  Also added extensive comments bitching about the inadequacy of
the current model, both under POSIX and NT (and probably other) systems.
1999-06-08 02:04:36 +00:00
Greg Ward c997334977 Added the 'have_run' dictionary to Distribution, and changed
'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.
1999-06-08 02:02:00 +00:00
Greg Ward 4d74d73b07 Now handles NT, through '_init_nt()' function (courtesy of
Amos Latteier <amos@aracnet.com>).
1999-06-08 01:58:36 +00:00
Guido van Rossum ad380551f6 Experimental speedup patch by Tim Peters (please test!):
It wasn't hard to speed pyclbr by a factor of 3, and I'll attach an
experimental patch for that (experimental because barely tested).  Uncomment
the new "String" stuff and it will deal with strings correctly (pyclbr
currently ignores the possibility), but that slows it down a lot.  Still
faster in the end than current pyclbr, but-- frankly --I'd rather have the
dramatic speedup!
1999-06-07 15:25:18 +00:00
Guido van Rossum 1946f0d6f2 Patch by Jim Fulton: new function parse_qsl(), which is like
parse_qs() but returns a list of (name, value) pairs -- which is
actually more correct.  Use this where it makes sense.
1999-06-04 17:54:39 +00:00
Guido van Rossum ce900defc5 At Jim Fulton's request (actually, as a compromise :-), default the
content-type to application/x-www-form-urlencoded only when the method
is POST.  Ditto for when the content-type is unrecognized -- only
fall back to urlencoded with POST.
1999-06-02 18:44:22 +00:00
Guido van Rossum 198e7cac5a Andy Dustman notes that I patched the close() call in the wrong place.
Here's the correct patch!
1999-06-01 18:58:34 +00:00
Guido van Rossum 6b708d569c In class TemporaryFileWrapper, don't cache attributes of tpye int --
these happen to be 'closed' and 'softspace', which may change!

Noted by Dave Ascher (with slightly different solution).
1999-06-01 18:55:36 +00:00
Guido van Rossum 116b31bed7 Jack Jansen's patch to support file:///path/file/name URL syntax. 1999-06-01 14:36:56 +00:00
Guido van Rossum fa8c3eab79 Greg McFarlane writes: Tkinter.Text.tag_add should take multiple
arguments.  [Slightly changed from submitted patch.]
1999-06-01 13:57:15 +00:00
Guido van Rossum 18659608dc Andy Dustman writes:
I noticed while watching (with lsof) my forking SocketServer app running
that I would get multiple processes listening to the socket. For the most
part, this doesn't hurt things, but if you terminate the server, this can
prevent it from restarting because it cannot bind to the port due to any
running children which also have the socket open. The following one-liner
fixes this.
1999-05-21 16:12:30 +00:00
Fred Drake c40c54782c Map .js to application/x-javascript. 1999-05-20 12:52:04 +00:00
Fred Drake 361c048b8f POP3.uidl(): Update docstring based on comments from Piers Lauder
<piers@cs.su.oz.au>.
1999-05-13 18:47:25 +00:00
Guido van Rossum 8e40759d5a Nathan Paul Simons noticed that the grid_remove() method was missing.
(The difference between grid_remove() and grid_forget() is that the
former remembers the options for the slave.)
1999-05-05 23:03:48 +00:00
Guido van Rossum 3ed1be9fbd Regression test for date format code, by Mike Meyer.
(I tweaked it slightly so examples are allowed to have no date too.)
1999-05-03 19:57:01 +00:00
Guido van Rossum 4f13669cf0 No need to import find(). (Andrew Dalke & kjpylint) 1999-05-03 18:16:23 +00:00
Guido van Rossum 73898c7b15 No need to import os or string. (Andrew Dalke & kjpylint) 1999-05-03 18:14:16 +00:00
Guido van Rossum 96d80f984a No need to import sys. (Andrew Dalke & kjpylint) 1999-05-03 18:13:51 +00:00
Guido van Rossum 138bdafa8d Typo. (Andrew Dalke, without kjpylint) 1999-05-03 18:13:29 +00:00
Guido van Rossum 6952f17f31 No need to import string. (Andrew Dalke & kjpylint) 1999-05-03 18:13:00 +00:00
Guido van Rossum ff3932abcd No need to import os in test(). (Andrew Dalke & kjpylint) 1999-05-03 18:12:36 +00:00
Guido van Rossum 699f3bbba3 Get rid of confusing 'global' statement in global code.
(Andrew Dalke & kjpylint)
1999-05-03 18:12:08 +00:00
Guido van Rossum 1e1cfa3a1c No need to import sys or string. (Andrew Dalke & kjpylint) 1999-05-03 18:10:37 +00:00
Guido van Rossum 1cc2b9de35 Clarify why we define disco. Suggested by Andrew Dalke. 1999-05-03 18:09:53 +00:00
Guido van Rossum 287b3996d5 Clarify why we define error. Suggested by Andrew Dalke. 1999-05-03 18:09:26 +00:00
Guido van Rossum db6d12c498 No need to import sys or linecache. (Andrew Dalke & kjpylint) 1999-05-03 18:08:16 +00:00
Guido van Rossum 00245cfbaa No need to import gmtime, ctime, asctime.
Make error an alias for ValueError.
(Andrew Dalke & kjpylint)
1999-05-03 18:07:40 +00:00
Guido van Rossum 92b44517cb Clarify why there are dynamic imports in AudioDev().
This will enlighten Andrew Dalke; I don't know about kjpylint. :-)
1999-05-03 18:04:07 +00:00
Guido van Rossum 5c071fab8f The _comp_data() function never worked, it contained a reference to
undefined 'nframes'.  Should be self._nframes.  (Andrew Dalke & kjpylint)
1999-05-03 18:02:44 +00:00
Guido van Rossum f8fd11d039 No need to import sys, time, socket or SocketServer. (Andrew Dalke & kjpylint) 1999-05-03 18:01:31 +00:00
Guido van Rossum 3a64e058eb No need to import sys, time, or socket. (Andrew Dalke & kjpylint) 1999-05-03 18:00:48 +00:00
Guido van Rossum e6e8818c03 No need to import rfc822. (Andrew Dalke & kjpylint) 1999-05-03 18:00:20 +00:00
Guido van Rossum b46413f274 The case-insensitive _Environ class was lacking a case-insensitive has_key(). 1999-05-03 15:23:24 +00:00
Greg Ward 884df454b2 The 'copy_file()' and 'copy_tree()' functions in util.py now have
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.
1999-05-02 21:42:05 +00:00
Greg Ward 0f72695da3 Rearranged things so that compilation of .py files is the responsibility
of the 'install_py' command rather than 'build_py'.  Obviously, this
meant that the 'build_py' and 'install_py' modules had to change; less
obviously, so did 'install' and 'build', since these higher-level
commands must make options available to control the lower-level
commands, and some compilation-related options had to migrate with the
code.
1999-05-02 21:39:13 +00:00
Guido van Rossum b08f51b93a Mike Meyer reports a bug in his patch (several months ago) that
accepts long month names.  One essential line was missing.  Fixed now.
1999-04-29 12:50:36 +00:00
Fred Drake ddf22c4243 Message.getheader(): Fixed grammatical error in docstring.
Message.getheaders():  Method to get list of all values for each
		       instance of a named header.  See docstring for more.
1999-04-28 21:17:38 +00:00
Fred Drake 5712fa9250 Added test case that includes a comma in the full name. This tests
for an old bug that's been gone a while, but was still documented
until a few minutes from now.
1999-04-28 17:38:31 +00:00
Guido van Rossum 630b811676 Two changes suggested by Jan Pieter Riegel:
(1) Fix reference to pwd.error to be KeyError -- there is no pwd.error
and pwd.getpwnam() raises KeyError on failure.

(2) Add cookie support, by placing the 'Cookie:' header, if present,
in the HTTP_COOKIE environment variable.
1999-04-28 12:21:47 +00:00
Guido van Rossum 3f36a085fe Cast f.tell() result to int() in _addval(), so it works even on
platforms where tell() returns a long.  (Perhaps tell() should be
fixed too?)  Reported by Greg Humphreys.
1999-04-27 12:21:17 +00:00
Guido van Rossum 20c92283ab Patch by Per Cederqvist, seemingly approved by The Dragon:
Two problems: The SMTPRecipientsRefused class should not inherit
SMTPResponseException, since it doesn't provide the smtp_code and
smtp_error attributes.  My patch for not adding an extra CRLF was
apparently forgotten.  The enclosed patch fixes these two problems.
1999-04-21 16:52:20 +00:00
Guido van Rossum 068d5724d8 Calling _cleanup() does not guarantee that all processes have
terminated; this makes the final assert in the self-test code fail if
the parent runs faster than the children.  Fix this by calling wait()
on the remaining children instead.
1999-04-20 12:27:31 +00:00
Guido van Rossum 247a78a10d Utility function that yields a properly formatted time string.
(Idea by Jeff Bauer, code by Jeremy, renamed and "Date:" constant
stripped from return value by GvR.)
1999-04-19 18:04:38 +00:00
Fred Drake f340114d72 Relocating file to Lib/lib-tk. 1999-04-19 18:03:57 +00:00
Guido van Rossum 0cf46bc0f4 Daniel Neri: OpenBSD is just as BSD'ish as the other BSD's ;-) 1999-04-19 17:22:12 +00:00
Greg Ward 4e5a7c7056 'warn()' method now takes an optional line number. 1999-04-15 17:50:19 +00:00
Guido van Rossum dabcd0040c Fix mysterious references to jprofile that were in the source since
its creation.  I'm assuming these were once valid references to "Jim
Roskind's profile"...
1999-04-13 04:24:22 +00:00
Guido van Rossum ba3ed56a22 Removed; since long subsumed in Doc/lib/libthreading.tex 1999-04-13 04:20:48 +00:00
Guido van Rossum 0fe110548d Forgot to add this file. CDROM device parameters. 1999-04-12 14:35:08 +00:00
Guido van Rossum 95bdd0b604 Two different changes.
1. Jack Jansen reports that on the Mac, the time may be negative, and
solves this by adding a write32u() function that writes an unsigned
long.

2. On 64-bit platforms the CRC comparison fails; I've fixed this by
casting both values to be compared to "unsigned long" i.e. modulo
0x100000000L.
1999-04-12 14:34:16 +00:00
Guido van Rossum 6a86f66ad7 Get rid of #! line 1999-04-09 14:49:04 +00:00
Guido van Rossum 9a744a9dd7 The usual 1999-04-08 20:27:54 +00:00
Guido van Rossum 0b7dd08d50 # Bah. The same problem occurred a second time. 1999-04-08 20:22:46 +00:00
Guido van Rossum 9b112799bc On Windows, we suddenly find, strftime() may return "" for an
unsupported format string.  (I guess this is because the logic for
deciding whether to reallocate the buffer or not has been improved.)
This caused the test code to crash on result[0].  Fix this by assuming
an empty result also means the format is not supported.
1999-04-08 17:23:11 +00:00
Guido van Rossum 6e9dadc1da Delete an accidentally checked-in feature that actually broke more
than was worth it: when deleting a canvas item, it would try to
automatically delete the bindings for that item.  Since there's
nothing that says you can't reuse the tag and still have the bindings,
this is not correct.  Also, it broke at least one demo
(Demo/tkinter/matt/rubber-band-box-demo-1.py).
1999-04-08 14:46:06 +00:00
Guido van Rossum 052364b20b Use binary mode for all gzip files we open. 1999-04-07 19:00:58 +00:00
Guido van Rossum 0d8d3dd5b0 lower, tkraise/lift hide Misc.lower, Misc.tkraise/lift,
so the preferred name for them is tag_lower, tag_raise
(similar to tag_bind, and similar to the Text widget);
unfortunately can't delete the old ones yet (maybe in 1.6)
1999-04-07 16:25:54 +00:00
Guido van Rossum 296e14301a Changes by Per Cederquist and The Dragon.
Per writes:

"""
The application where Signum Support uses smtplib needs to be able to
report good error messages to the user when sending email fails.  To
help in diagnosing problems it is useful to be able to report the
entire message sent by the server, not only the SMTP error code of the
offending command.

A lot of the functions in sendmail.py unfortunately discards the
message, leaving only the code.  The enclosed patch fixes that
problem.

The enclosed patch also introduces a base class for exceptions that
include an SMTP error code and error message, and make the code and
message available on separate attributes, so that surrounding code can
deal with them in whatever way it sees fit.  I've also added some
documentation to the exception classes.

The constructor will now raise an exception if it cannot connect to
the SMTP server.

The data() method will raise an SMTPDataError if it doesn't receive
the expected 354 code in the middle of the exchange.

According to section 5.2.10 of RFC 1123 a smtp client must accept "any
text, including no text at all" after the error code.  If the response
of a HELO command contains no text self.helo_resp will be set to the
empty string ("").  The patch fixes the test in the sendmail() method
so that helo_resp is tested against None; if it has the empty string
as value the sendmail() method would invoke the helo() method again.

The code no longer accepts a -1 reply from the ehlo() method in
sendmail().

[Text about removing SMTPRecipientsRefused deleted --GvR]
"""

and also:

"""
smtplib.py appends an extra blank line to the outgoing mail if the
`msg' argument to the sendmail method already contains a trailing
newline.  This patch should fix the problem.
"""

The Dragon writes:

"""
	Mostly I just re-added the SMTPRecipientsRefused exception
(the exeption object now has the appropriate info in it ) [Per had
removed this in his patch --GvR] and tweaked the behavior of the
sendmail method whence it throws the newly added SMTPHeloException (it
was closing the connection, which it shouldn't.  whatever catches the
exception should do that. )

	I pondered the change of the return values to tuples all around,
and after some thinking I decided that regularizing the return values was
too much of the Right Thing (tm) to not do.

	My one concern is that code expecting an integer & getting a tuple
may fail silently.

(i.e. if it's doing :

      x.somemethod() >= 400:
expecting an integer, the expression will always be true if it gets a
tuple instead. )

	However, most smtplib code I've seen only really uses the
sendmail() method, so this wouldn't bother it.  Usually code I've seen
that calls the other methods usually only calls helo() and ehlo() for
doing ESMTP, a feature which was not in the smtplib included with 1.5.1,
and thus I would think not much code uses it yet.
"""
1999-04-07 15:03:39 +00:00
Guido van Rossum 630a9a6894 Fix the tests now that splitdrive() no longer treats UNC paths special.
(Some tests converted to splitunc() tests.)
1999-04-06 19:38:18 +00:00
Guido van Rossum f3c695c467 Withdraw the UNC support from splitdrive(). Instead, a new function
splitunc() parses UNC paths.  The contributor of the UNC parsing in
splitdrive() doesn't like it, but I haven't heard a good reason to
keep it, and it causes some problems.  (I think there's a
philosophical problem -- to me, the split*() functions are purely
syntactical, and the fact that \\foo is not a valid path doesn't mean
that it shouldn't be considered an absolute path.)

Also (quite separately, but strangely related to the philosophical
issue above) fix abspath() so that if win32api exists, it doesn't fail
when the path doesn't actually exist -- if GetFullPathName() fails,
fall back on the old strategy (join with getcwd() if neccessary, and
then use normpath()).
1999-04-06 19:32:19 +00:00
Fred Drake fa1591c129 Oops, missed mode parameter to open(). 1999-04-05 18:37:59 +00:00
Fred Drake 9bb76d1b73 Made the default mode 'rb' instead of 'r', for better cross-platform
support.  (Based on comment on the documentation by Bernhard Reiter
<bernhard@csd.uwm.edu>).
1999-04-05 18:33:40 +00:00
Greg Ward 06ca948029 Added all the "external action" methods (to make handling the verbose
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).
1999-04-04 02:58:07 +00:00
Greg Ward e765a3bb61 Added 'dry_run' flag to most functions (to support the "shadow methods"
that wrap them in the Command class).
Fixed 'copy_file()' to use '_copy_file_contents()', not 'copyfile()'
  from shutil module -- no reference to shutil anymore.
Added "not copying" announcement in 'copy_file()'.
Wee comment fix.
1999-04-04 02:54:20 +00:00
Greg Ward 4070f50537 Changed to use the method versions of 'copy_file()', 'copy_tree()',
and 'make_file()'-- that way, the verbose and dry-run flags are
handled for free.
1999-04-04 02:46:29 +00:00
Guido van Rossum 8ff764f113 Jonathan Giddy write:
In test_cpickle.py, the module os got imported, but the line to remove
the temp file has gone missing.
1999-04-01 15:32:30 +00:00
Guido van Rossum 60e7330fee Per Cederqvist writes:
If you send something like "PUT / HTTP/1.0" to something derived from
BaseHTTPServer that doesn't define do_PUT, you will get a response
that begins like this:

	HTTP/1.0 501 Unsupported method ('do_PUT')
	Server: SimpleHTTP/0.3 Python/1.5
	Date: Tue, 30 Mar 1999 18:53:53 GMT

The server should complain about 'PUT' instead of 'do_PUT'.  This
patch should fix the problem.
1999-03-30 20:17:31 +00:00
Guido van Rossum f123f84f66 Patch by Per Cederqvist, who writes:
"""
 - It needlessly used the makefile() method for each response that is
   read from the SMTP server.

 - If the remote SMTP server closes the connection unexpectedly the
   code raised an IndexError.  It now raises an SMTPServerDisconnected
   exception instead.

 - The code now checks that all lines in a multiline response actually
   contains an error code.
"""

The Dragon approves.
1999-03-29 20:33:21 +00:00
Fred Drake 9065ea36de When run as a script, report failures in the exit code as well.
Patch largely based on changes by Andrew Dalke, as discussed in the
distutils-sig.
1999-03-29 20:25:40 +00:00
Guido van Rossum 3527f59457 Hack so that if a 302 or 301 redirect contains a relative URL, the
right thing "just happens" (basejoin() with old URL).
1999-03-29 20:23:41 +00:00
Guido van Rossum 89ae2b9f07 Test protection against picling to/from closed (real) file. 1999-03-29 19:59:32 +00:00
Greg Ward 91c488c1fc Replaced the last attempt at an "unreadline" with one that actually
works on non-seekable file-like objects, such as URLs.  (Oops.)
1999-03-29 18:01:49 +00:00
Guido van Rossum 8e702d4e8e Jonathan Giddy discovered this file was missing. 1999-03-29 15:28:54 +00:00
Greg Ward 787451b65f Added 'linestart' array and 'unreadline()' method (makes parsing a lot easier). 1999-03-26 21:48:59 +00:00
Guido van Rossum 447b4a0652 Test suite for UserList. 1999-03-26 16:20:45 +00:00
Guido van Rossum 2a340b3889 Use isinstance() where appropriate.
Reformatted with 4-space indent.
1999-03-26 16:20:18 +00:00
Guido van Rossum 3eccc48b5b Test suite for UserDict 1999-03-26 15:32:05 +00:00
Guido van Rossum 1697b9cdf6 Improved a bunch of things.
The constructor now takes an optional dictionary.
Use isinstance() where appropriate.
1999-03-26 15:31:12 +00:00
Guido van Rossum aa3828aa35 Basic regr tests for pickle/cPickle 1999-03-25 22:38:49 +00:00
Guido van Rossum 397032aa46 Don't use "exec" in find_class(). It's slow, unnecessary, and (as AMK
points out) it doesn't work in JPython Applets.
1999-03-25 21:58:59 +00:00
Andrew M. Kuchling 605ebddbea Added a simple test suite for gzip. It simply opens a temp file,
writes a chunk of compressed data, closes it, writes another chunk, and
reads the contents back to verify that they are the same.
1999-03-25 21:50:27 +00:00
Andrew M. Kuchling f4f119c055 Based on a suggestion from bruce@hams.com, make a trivial change to
allow using the 'a' flag as a mode for opening a GzipFile.  gzip
files, surprisingly enough, can be concatenated and then decompressed;
the effect is to concatenate the two chunks of data.

If we support it on writing, it should also be supported on reading.
This *wasn't* trivial, and required rearranging the code in the
reading path, particularly the _read() method.

Raise IOError instead of RuntimeError in two cases, 'Not a gzipped file'
and 'Unknown compression method'
1999-03-25 21:49:14 +00:00
Guido van Rossum 52a0d7d802 Add tests for float() and complex() with string args (Nick/Stephanie
Lockwood).
1999-03-25 21:25:01 +00:00
Guido van Rossum a6386ce1eb Added Jeremy's test code for the sha module. 1999-03-24 19:04:32 +00:00
Guido van Rossum 4ec2698725 Remove the temp file when we're done. 1999-03-24 19:03:01 +00:00
Guido van Rossum e256a0feed Add readlines() to _Subfile class. Not clear who would need it, but
Chris Lawrence sent me a broken version; this one is a tad simpler and
more conforming to the standard.
1999-03-24 16:20:45 +00:00
Jeremy Hylton c19f9972a1 use struct instead of bit-manipulate in Python 1999-03-23 23:05:34 +00:00
Greg Ward 782cdfe9f3 Changes to allow passing an open file to the constructor (to support
ProcessHierarchy's changes to support reading from a remote URL in
ProcessDatabase).
1999-03-23 14:00:06 +00:00
Andrew M. Kuchling dca7e00fd5 Added simple test for the flush() method of compression objects, trying the
different flush values Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FULL_FLUSH.
1999-03-22 19:23:17 +00:00
Guido van Rossum f247d75507 Bug reported by Tobias Thelen: missing "self." in assignment target. 1999-03-22 15:28:08 +00:00
Greg Ward 13ae1c8ff8 First checkin of real Distutils command modules. 1999-03-22 14:55:25 +00:00
Greg Ward 03f8c3cdd0 Obsolete source file -- command options are actually implemented in
a much less formalistic way.  Just keeping this around for possible
future reference.
1999-03-22 14:54:09 +00:00
Greg Ward 2689e3ddce First checkin of real Distutils code. 1999-03-22 14:52:19 +00:00
Guido van Rossum 8f0fa9e47f New code for split() by Tim Peters, behaves more like posixpath.split(). 1999-03-19 21:05:12 +00:00
Guido van Rossum 36561c5de4 Added BufferType, the type returned by the new builtin buffer(). Greg Stein. 1999-03-19 19:08:03 +00:00
Guido van Rossum f3963b1269 Sjoerd Mullender writes:
If a filename on Windows starts with \\, it is converted to a URL
which starts with ////.  If this URL is passed to urlparse.urlparse
you get a path that starts with // (and an empty netloc).  If you pass
the result back to urlparse.urlunparse, you get a URL that starts with
//, which is parsed differently by urlparse.urlparse.  The fix is to
add the (empty) netloc with accompanying slashes if the path in
urlunparse starts with //.  Do this for all schemes that use a netloc.
1999-03-18 15:10:44 +00:00
Guido van Rossum a0fec1637b Sjoerd Mullender writes:
Pathnames of files on other hosts in the same domain
(\\host\path\to\file) are not translated correctly to URLs and back.
The URL should be something like file:////host/path/to/file.
Note that a combination of drive letter and remote host is not
possible.
1999-03-18 14:21:41 +00:00
Guido van Rossum a2e18051b7 Delete non-standard-conforming code in urljoin() that would use the
netloc from the base url as the default netloc for the resulting url
even if the schemes differ.

Once upon a time, when the web was wild, this was a valuable hack
because some people had a URL referencing an ftp server colocated with
an http server without having the host in the ftp URL (so they could
replicate it or change the hostname easily).

More recently, after the file: scheme got added back to the list of
schemes that accept a netloc, it turns out that this caused weirdness
when joining an http: URL with a file: URL -- the resulting file: URL
would always inherit the host from the http: URL because the file:
scheme supports a netloc but in practice never has one.

There are two reasons to get rid of the old, once-valuable hack,
instead of removing the file: scheme from the uses_netloc list.  One,
the RFC says that file: uses the netloc syntax, and does not endorse
the old hack.  Two, neither netscape 4.5 nor IE 4.0 support the old
hack.
1999-03-17 22:30:10 +00:00