Commit Graph

2651 Commits

Author SHA1 Message Date
Guido van Rossum 7ee801d6af Marc-Andre Lemburg:
Modified .splitlines() tests according to the changes
in unicodeobject.c.
2000-04-11 15:37:02 +00:00
Guido van Rossum 6e277cf7de Christian Tismer: added test to ensure that multiplication commutes.
[The test is in a slightly odd place, in test_division_2; but it
exercises the recent change to long_mult(), and that's all we really
ask for.  --GvR]
2000-04-10 17:41:37 +00:00
Guido van Rossum 2516b39dd3 Implement suggestion from Lawrence Kesteloot in PR#280, to change the
default list of files from () to None, and explicitly test for None
before defaulting to sys.argv[1:].  This means that if you pass in an
explicit empty list, it will read stdin instead of defaulting to
sys.argv[1:].  This fixes a buglet in the test script (when called
with options but without files, it chokes when it tries to interpret
the options as files).

Lawrence adds: "I suspect that this is a safe change, because I can't
imagine someone actively passing in an empty list when they want
sys.argv used."

I agree.
2000-04-10 17:16:12 +00:00
Guido van Rossum b81e70ebdb Fredrik Lundh: new snapshot. Mostly reindented.
This one should work with unicode expressions, and compile
a bit more silently.
2000-04-10 17:10:48 +00:00
Guido van Rossum a25d7ddbf0 Some cleanup -- don't use splitfields/joinfields, standardize
indentation (tabs only), rationalize some code in urljoin...
2000-04-10 17:02:46 +00:00
Guido van Rossum 3bb1edb328 Match the error messages to say "(most recent call last)" like the
built-in messages.
2000-04-10 16:29:29 +00:00
Fred Drake 1a4b593dd6 Use a constant to specify the number of child threads to create.
Instead of assuming that the number process ids of the threads is the
same as the process id of the controlling process, use a copy of the
dictionary and check for changes in the process ids of the threads
from the thread's process ids in the parent process.  This makes the
test make more sense on systems which assign a new pid to each thread
(i.e., Linux).

This doesn't fix the other problems evident with this test on Linux.
2000-04-10 15:36:39 +00:00
Guido van Rossum 9706486b9f Marc-Andre Lemburg:
* '...%s...' % u"abc" now coerces to Unicode just like
  string methods. Care is taken not to reevaluate already formatted
  arguments -- only the first Unicode object appearing in the
  argument mapping is looked up twice. Added test cases for
  this to test_unicode.py.
2000-04-10 13:52:48 +00:00
Guido van Rossum 45ad3c4897 Marc-Andre Lemburg:
* More test cases for test_contains.py.
2000-04-10 13:52:13 +00:00
Guido van Rossum 4b49101f20 Don't be so strict in checking AttributeError -- the error message
recently changed.
2000-04-10 13:37:14 +00:00
Guido van Rossum 547e952017 Output from test_zipfile.py. 2000-04-10 13:24:00 +00:00
Guido van Rossum 368f04ac46 Test for zipfile.py, by Jim Ahlstrom. 2000-04-10 13:23:04 +00:00
Greg Ward d197a3a12c Define 'self.force' in the constructor and remove the hack in '__getattr__()'
to account for it not being defined in the constructor.
2000-04-10 13:11:51 +00:00
Greg Ward 7aff6f34fe Delete some debugging print statements. 2000-04-10 01:31:58 +00:00
Greg Ward e9613ae05f Added a check for the 'force' attribute in '__getattr__()' -- better than
crashing when self.force not defined.
Revise 'copy_file()' and 'copy_tree()' docstrings accordingly.
Remove 'hasattr()' check for 'self.force' from 'make_file()'.
2000-04-10 01:30:44 +00:00
Greg Ward d38e6f7637 Added optional 'prefix' arguments to 'get_python_inc()' and
'get_python_lib()'.
2000-04-10 01:17:49 +00:00
Greg Ward cf6bea3dc7 Better variable names here and there. 2000-04-10 01:15:06 +00:00
Greg Ward c41d6b35a9 Added '--force' option -- very clear what it means for building (ignore
timestamps), so every build_* command has 'self.force', which follows the
'build' command if not set by the user.
2000-04-10 00:19:42 +00:00
Greg Ward 68a0757e23 Removed global '--force' option -- just too vague a concept to be applicable
to all commands in the same way.  Several Command methods now either expect
'self.force' to be defined, or check if it is defined and assume it's
false if not.
2000-04-10 00:18:16 +00:00
Greg Ward 582a8701cb Added __version__ to store the Distutils version number. 2000-04-10 00:02:16 +00:00
Greg Ward 60908f1408 Ditched the unused 'list_only' option.
Added code to include source files from 'build_clib' command to default file
  list -- currently this won't work, since 'build_clib' doesn't have a
  'get_source_files()' method!
2000-04-09 03:51:40 +00:00
Greg Ward b2e2c29295 Catch DistutilsFileError in addition to DistutilsExecError in 'setup()'. 2000-04-09 03:49:20 +00:00
Greg Ward b361233c76 Added (currently) pointless and trivial main body (for future tests). 2000-04-09 03:48:37 +00:00
Greg Ward d759f5f145 This little note is to clarify things for people who go poking around the
Python library hoping to find out more about the Distutils.
2000-04-09 02:31:45 +00:00
Fred Drake 5fa38862bb Fred Gansevles <gansevle@cs.utwente.nl>:
The copytree function doesn't pass the symlinks parameter in recursicve
calls
2000-04-07 14:34:50 +00:00
Greg Ward 7d508fe568 Add missing import of 'usage' string. 2000-04-06 02:07:41 +00:00
Guido van Rossum 9e896b37c7 Marc-Andre's third try at this bulk patch seems to work (except that
his copy of test_contains.py seems to be broken -- the lines he
deleted were already absent).  Checkin messages:


New Unicode support for int(), float(), complex() and long().

- new APIs PyInt_FromUnicode() and PyLong_FromUnicode()
- added support for Unicode to PyFloat_FromString()
- new encoding API PyUnicode_EncodeDecimal() which converts
  Unicode to a decimal char* string (used in the above new
  APIs)
- shortcuts for calls like int(<int object>) and float(<float obj>)
- tests for all of the above

Unicode compares and contains checks:
- comparing Unicode and non-string types now works; TypeErrors
  are masked, all other errors such as ValueError during
  Unicode coercion are passed through (note that PyUnicode_Compare
  does not implement the masking -- PyObject_Compare does this)
- contains now works for non-string types too; TypeErrors are
  masked and 0 returned; all other errors are passed through

Better testing support for the standard codecs.

Misc minor enhancements, such as an alias dbcs for the mbcs codec.

Changes:
- PyLong_FromString() now applies the same error checks as
  does PyInt_FromString(): trailing garbage is reported
  as error and not longer silently ignored. The only characters
  which may be trailing the digits are 'L' and 'l' -- these
  are still silently ignored.
- string.ato?() now directly interface to int(), long() and
  float(). The error strings are now a little different, but
  the type still remains the same. These functions are now
  ready to get declared obsolete ;-)
- PyNumber_Int() now also does a check for embedded NULL chars
  in the input string; PyNumber_Long() already did this (and
  still does)

Followed by:

Looks like I've gone a step too far there... (and test_contains.py
seem to have a bug too).

I've changed back to reporting all errors in PyUnicode_Contains()
and added a few more test cases to test_contains.py (plus corrected
the join() NameError).
2000-04-05 20:11:21 +00:00
Fred Drake 605843f0c0 Mark Hammond:
This patch fixes the mmap module on Windows 9x.

Also updates the mmap test to remove the test file.
2000-04-05 14:17:11 +00:00
Guido van Rossum aaa8bb4211 Work the Tcl version number in the path we search for. 2000-04-04 23:32:21 +00:00
Guido van Rossum 13c8c0272a Skip Montanaro submits a simple patch that makes encode() and decode()
recognize the '7bit' and '8bit' encodings, to simplify use.
2000-04-04 20:53:07 +00:00
Guido van Rossum 965fdae40e Patch by Fred Gansevles.
This patch solves 2 problems of the os module.
1) Bug ID #50 (case-mismatch wiht "environ.get(..,..)" and "del environ[..]")
2) os.environ.update (dict) doesn't propagate changes to the 'real'
   environment (i.e doesn't call putenv)

This patches also has minor changes specific for 1.6a
The string module isn't used anymore, instead the strings own methods are
used.
2000-04-04 19:50:04 +00:00
Guido van Rossum 1571a1e34b Since Thomas Wouters kept complaining that he wants access to the the
Unix From lines, change the UnixMailbox class so that _search_start()
positions the file *before* the Unix From line instead of after it;
change _search_end() to skip one line before looking for the next From
line.  The rfc822.Message class automatically recognizes these Unix
From lines and squirrels them away in the 'unixfrom' instance variable.
2000-04-04 03:31:39 +00:00
Greg Ward aebf706b4e Reorganization: ripped util.py to shreds, creating in the process:
- file_util.py: operations on single files
  - dir_util.py: operations on whole directories or directory trees
  - dep_util.py: simple timestamp-based dependency analysis
  - archive_util.py: creation of archive (tar, zip, ...) files
The functions left in util.py are miscellany that don't fit in any of the
new files.
2000-04-04 02:05:59 +00:00
Greg Ward fe6462c1f3 Reorganization: moved the Distribution class from core.py to dist.py, and
the Command class from core.py to cmd.py.  No other code needs changing
though; distutils.core still provides the Command and Distribution classes,
although indirectly now.
2000-04-04 01:40:52 +00:00
Fred Drake a22b576d05 UserString class from Peter Funk <pf@artcom-gmbh.de>. 2000-04-03 03:51:50 +00:00
Andrew M. Kuchling e3ba931aa4 This patch looks large, but it just deletes the ^M characters and
untabifies the files.  No actual code changes were made.
2000-04-02 05:22:30 +00:00
Andrew M. Kuchling e188d52a7e Untabified file to fix problems reported by tabnanny 2000-04-02 05:15:38 +00:00
Fred Drake d9b0f26515 Mark Hammond: Uncomment call to delete test data when done. 2000-04-01 05:25:57 +00:00
Guido van Rossum 431ae486c1 Add a README file so that cvs update -P doesn't obliterate this
directory, and so that people have a clue as to why it exists.
2000-03-31 20:03:56 +00:00
Greg Ward 19ce16665d Fixed my simplification to Thomas' patch: winreg and win32api export the same
functions, but with different names.
2000-03-31 19:04:25 +00:00
Guido van Rossum 32abe6f7d0 Zip file handling module, by Jim Ahlstrom. 2000-03-31 17:30:02 +00:00
Guido van Rossum b95de4f847 Marc-Andre Lemburg: Error reporting in the codec registry and lookup
mechanism is enhanced to be more informative.
2000-03-31 17:25:23 +00:00
Guido van Rossum 68895ed70c Marc-Andre Lemburg: use all lowercase names. 2000-03-31 17:23:18 +00:00
Greg Ward 1027e3fde9 Simplified Thomas Heller's registry patch: just assign all those
HKEY_* and Reg* names once, rather than having near-duplicate code
in the two import attempts.

Also dropped the leading underscore on all the imported symbols,
as it's not appropriate (they're not local to this module).
2000-03-31 16:53:42 +00:00
Greg Ward 7642f5cf38 Patch from Thomas Heller: use the new winreg module if available. 2000-03-31 16:47:40 +00:00
Andrew M. Kuchling d553e99a74 Added test case output for pyexpat module 2000-03-31 15:45:20 +00:00
Andrew M. Kuchling b17664ddf0 Added test case for pyexpat module that tries to exercise all the handlers 2000-03-31 15:44:52 +00:00
Guido van Rossum 7627c0de69 Added Fredrik Lundh's sre module and its supporting cast.
NOTE: THIS IS VERY ROUGH ALPHA CODE!
2000-03-31 14:58:54 +00:00
Greg Ward b4c850c928 Added code to blow away the pseudo-installation tree and a 'keep_tree'
option to disable this (by default, it's false and we clean up).
2000-03-31 05:22:47 +00:00
Greg Ward e5796fecc6 Oops, got a little too enthusiastic deleting code in that last revision:
we still have to *run* the sub-command that creates a built distribution.
2000-03-31 05:21:27 +00:00
Greg Ward 1889de8889 Fixed 'make_archive()' to explicitly turn of compression when format is "tar". 2000-03-31 05:20:27 +00:00
Greg Ward 02296cea39 Rename 'formats' option to 'format', and remove the ability to generate
multiple built distributions in one run -- it seemed a bit dodgy and I'd
rather remove it than try to beat it into submission right now.
2000-03-31 05:08:50 +00:00
Greg Ward 6b213766d8 Import from 'types' module.
Added 'ztar', 'tar' to 'format_command' dictionary.
2000-03-31 04:53:41 +00:00
Greg Ward 6ce00b4440 Tweaked 'get_platform()' to include the first character of the OS release:
eg. sunos5, linux2, irix5.
2000-03-31 04:40:25 +00:00
Greg Ward 7d51034eef Removed some old test code: don't set 'plat' when calling 'new_compiler()'. 2000-03-31 04:37:40 +00:00
Greg Ward 95c0b269de Don't perpetrate the "_d" hack for naming debugging extensions -- that's
now done in the 'build_ext' command.
2000-03-31 03:52:16 +00:00
Greg Ward 842296480e Patch (mostly) from Thomas Heller for building on Windows:
* build to "Debug" or "Release" temp directory
  * put linker turds (.lib and .exp files) in the build temp directory
  * tack on "_d" to extensions built with debugging
  * added 'get_ext_libname()' help in putting linker turds to temp dir
Also, moved the code that simplifies None to empty list for a bunch
  of options to 'finalize_options()' instead of 'run()'.
2000-03-31 03:50:23 +00:00
Greg Ward 6e8ee5d8e9 Don't put Python's library directory into the library search path -- that's
specific to building Python extensions.
2000-03-31 03:34:09 +00:00
Greg Ward 6148c2cfa6 Added 'bdist' and 'bdist_dumb'. 2000-03-31 03:14:51 +00:00
Guido van Rossum 42405a5d7d A version of FixTk.py that works with the way the installer now
installs Tcl/Tk.
2000-03-31 03:11:40 +00:00
Greg Ward 1b64a7e4a5 Added 'get_name()' and 'get_full_name()' methods to Distribution.
Simplified 'Command.get_peer_option()' a tad -- just call 'find_peer()'
  to get the peer command object.
Updated 'Command.copy_file()' to take a 'link' parameter, just like
  'util.copy_file()' does now.
Added 'Command.make_archive()' to wrap 'util.make_archive()'.
2000-03-31 03:05:18 +00:00
Greg Ward 32ce329ce4 Added 'create_tree()'.
Changes to 'copy_file()':
  * added support for making hard links and symlinks
  * noted that it silently clobbers existing files when copying, but
    blows up if destination exists when linking -- hmmm...
  * error message tweak
Added 'base_name' parameter to 'make_tarball()' and 'make_zipfile()'.
Added 'make_archive()' -- wrapper around 'make_tarball()' or
  'make_zipfile()' to take care of the archive "root directory".
2000-03-31 03:02:22 +00:00
Greg Ward 318a9d7aa2 Added DistutilsInternalError. 2000-03-31 02:57:31 +00:00
Greg Ward e1664bdc59 The 'bdist_dumb' command, the first worker bee for use by 'bdist'. This is
the command that actually creates "dumb" binary distributions, ie.
tarballs and zip files that you just unpack under <prefix> or <exec-prefix>.
Very limited, but it's a start.
2000-03-31 02:56:34 +00:00
Greg Ward 0f77f9569c The 'bdist' command, for creating "built" (binary) distributions.
Initial revision is pretty limited; it only knows how to generate "dumb"
binary distributions, i.e. a tarball on Unix and a zip file on Windows.
Also, due to limitations in the installation code, it only knows how to
distribute Python library code.  But hey, it's a start.
2000-03-31 02:55:12 +00:00
Greg Ward 1aab6e9645 Added 'get_inputs()'. 2000-03-31 02:53:07 +00:00
Greg Ward ba38d12063 Fixed 'get_outputs()' so it actually works.
Added 'get_inputs()' (which is strikingly similar to 'get_outputs()' - sigh).
Cosmetic tweaks.
2000-03-31 02:52:02 +00:00
Greg Ward 578c10d9a5 Changed to use the new 'has_pure_modules()' and 'has_ext_modules()' methods
provided by Distribution.
Cosmetic and error message tweaks.
Simplified 'make_release_tree()':
  * extracted 'distutils.util.create_tree()'
  * don't have to do hard-linking ourselves -- it's now handled by
    'distutils.util.copy_file()' (although the detection of
    whether hard linking is available still needs to be factored out)
Removed 'make_tarball()' and 'make_zipfile()' entirely -- their role
  is now amply filled by 'distutils.util.make_archive()'.
Simplified 'make_distribution()':
  * use Distribution's new 'get_full_name()' method
  * use 'make_archive()' instead of if/elif/.../else on the archive format
2000-03-31 02:50:04 +00:00
Guido van Rossum 706dbd03bd Mark Hammond: Ooops - even though Win32 handles the same args, there
was a superfluous check for the platform.
2000-03-31 01:20:33 +00:00
Guido van Rossum 767e775a98 Improved test, by Mark Hammond, for Win32. 2000-03-31 01:09:14 +00:00
Jeremy Hylton 6a973c7118 robustify UserList constructor -- will now accept any sequence
add test cases for non-UserList class, tuple, & string
2000-03-31 00:17:46 +00:00
Jeremy Hylton 074c3e62d1 Two fixes for extended call syntax:
If a non-tuple sequence is passed as the *arg, convert it to a tuple
before checking its length.
If named keyword arguments are used in combination with **kwargs, make
a copy of kwargs before inserting the new keys.
2000-03-30 23:55:31 +00:00
Guido van Rossum 2ab9082a07 Show Tcl/Tk version number in _test() and show Unicode test if possible. 2000-03-30 23:19:44 +00:00
Andrew M. Kuchling a35be2f412 Output for simple test case for mmap on Unix; someone needs to write a
Win32 test case.
2000-03-30 21:15:46 +00:00
Andrew M. Kuchling e81b9cfcfe Added simple test case for mmap on Unix; someone needs to write a
Win32 test case
2000-03-30 21:15:29 +00:00
Greg Ward 71d55835b3 Oops: 'build_extensions()' no longer takes an 'extensions' list. 2000-03-30 19:47:22 +00:00
Guido van Rossum d30dedca27 Michael Hudson: With the (cool!) new call syntax, the longest opcode
name is much longer, which fouls up dis's formatting slightly; this is
a "fix" for that.
2000-03-30 15:02:11 +00:00
Guido van Rossum bf45322b3d Lawrence Kesteloot noted: Lib/user.py has a comment that says that the
script pointed to by PYTHONPATH will be executed on startup.  That
should say PYTHONSTARTUP.
2000-03-30 15:00:33 +00:00
Greg Ward 1d16a9f040 Put the Python "system" include dir last, rather than first. 2000-03-29 04:13:49 +00:00
Greg Ward 41b4dd66c8 Call 'find_exe()', not '_find_exe()'. 2000-03-29 04:13:00 +00:00
Greg Ward ed8a0e0f21 Patch inspired by Bastian Kleineidam <calvin@cs.uni-sb.de>:
use global __debug__ flag to determine if compiled files will be ".pyc"
or ".pyo".  Tweaked compilation output messages too.
2000-03-29 03:29:34 +00:00
Greg Ward 044b7c15c9 Changed 'copy_tree()' so it returns the list of all files that were copied or
might have been copied, regardless of the 'update' flag.
2000-03-29 03:27:45 +00:00
Greg Ward 739d06689d Documented Bastian's patch.
Made handling OSError in 'mkpath()' more standard.
2000-03-29 02:56:34 +00:00
Greg Ward da4d1aef4e Patch from Bastian Kleineidam <calvin@cs.uni-sb.de>:
make 'mkdir()' return list of directories created.
2000-03-29 02:53:02 +00:00
Greg Ward 7c1a6d4777 Added 'make_tarball()' and 'make_zipfile()' functions in preparation
for the 'bdist_dumb' command.  Adapted, with tweakage, from the 'sdist'
command.
2000-03-29 02:48:40 +00:00
Greg Ward 03d1ae1f01 Moved the guts of 'make_tarball()' and 'make_zipfile()' to distutils.util
in preparation for the 'bdist_dumb' command; these methods remain as
trivial wrappers around the versions in distutils.util.
2000-03-29 02:47:29 +00:00
Greg Ward f00c34da1d Added the "distribution query" methods: 'has_pure_modules()',
'has_ext_modules()', 'has_c_libraries()', 'has_modules()', and 'is_pure()'.
2000-03-29 02:20:45 +00:00
Greg Ward ab9d08ce65 Added 'build_clib'; replaced 'install_py' and 'install_ext' with 'install_lib'. 2000-03-29 02:18:39 +00:00
Greg Ward e5dfba5e0f Be sure to run both 'build_py' and 'build_ext', now that this command
is responsible for installing all Python modules (pure and extensions).
Added 'get_outputs()' in preparation for the 'bdist' command, and
  '_mutate_outputs()' to support 'get_outputs()'.
2000-03-29 02:17:42 +00:00
Greg Ward ee94c57fe9 Changed so the sub-commands we rely on to do the real work is specified
in a class attribute 'sub_commands', rather than hard-coded in 'run()'.
  This should make it easier to subclass 'install', and also makes it
  easier to keep 'run()' and the new 'get_outputs()' consistent.
Added 'get_outputs()' in preparation for the 'bdist' command.
2000-03-29 02:15:57 +00:00
Greg Ward ae45b16157 Use the new 'has_pure_modules()', 'has_ext_modules()', 'has_c_libraries()'
methods of Distribution instead of grovelling directly in self.distribution.
2000-03-29 02:14:21 +00:00
Greg Ward 4d16e0ac20 Added 'get_outputs()' in prepartion for the 'bdist' command.
Changed signature of 'build_extensions()': no longer takes the extension
  list, but uses 'self.extensions' (just like 'get_outputs()' has to)
Moved call to 'check_extensions_list()' from 'run()' to 'build_extensions()',
  again for consistency with 'get_outputs()'.
2000-03-29 02:13:09 +00:00
Greg Ward 8b2e95edd6 Deleted some crufty comments and code.
A host of improvements in preparation for the 'bdist' command:
  - added 'get_outputs()' method (all the other improvements were to support
    this addition)
  - made 'find_package_modules()' and 'find_modules()' return similar
    values (list of (package, module, module_filename) tuples)
  - factored 'find_all_modules()' out of 'get_source_files()' (needed
    by 'get_outputs()')
  - factored 'get_module_outfile()' out of 'build_module()' (also needed
    by 'get_outputs()')
  - various little tweaks, improvements, comment/doc updates
2000-03-29 02:10:51 +00:00
Jeremy Hylton 003663d783 fix previous checkin 2000-03-28 23:53:22 +00:00
Jeremy Hylton aed0d8deb0 add test cases for Greg Ewing's extended call syntax patch 2000-03-28 23:51:17 +00:00
Jeremy Hylton 7690151c7e slightly modified version of Greg Ewing's extended call syntax patch
executive summary:
Instead of typing 'apply(f, args, kwargs)' you can type 'f(*arg, **kwargs)'.
Some file-by-file details follow.

Grammar/Grammar:
    simplify varargslist, replacing '*' '*' with '**'
    add * & ** options to arglist

Include/opcode.h & Lib/dis.py:
    define three new opcodes
        CALL_FUNCTION_VAR
        CALL_FUNCTION_KW
        CALL_FUNCTION_VAR_KW

Python/ceval.c:
    extend TypeError "keyword parameter redefined" message to include
        the name of the offending keyword
    reindent CALL_FUNCTION using four spaces
    add handling of sequences and dictionaries using extend calls
    fix function import_from to use PyErr_Format
2000-03-28 23:49:17 +00:00
Guido van Rossum 93a7c0fe6b Fredrik Lundh:
This fixes a bunch of socket.connect(host, post) calls.  Note that I
haven't tested all modules -- I don't have enough servers here...
2000-03-28 21:45:46 +00:00
Guido van Rossum 1916b35f58 Fredrik Lundh:
The new filecmp module has an optional argument called use_statcache
which is documented as a true/false value, but used as an tuple index.

This patches replaces the tuple stuff with a good old if- statement,
and also removes a few other tuple pack/unpack constructs (if not
else, this saves a few bytes in the PYC file, and a few microseconds
when using the module ;-).
2000-03-28 21:42:38 +00:00
Guido van Rossum de59855da6 Mark Hammond: test suite for new winreg module. 2000-03-28 20:36:51 +00:00
Guido van Rossum 24bdb0474f Marc-Andre Lemburg:
The attached patch set includes a workaround to get Python with
Unicode compile on BSDI 4.x (courtesy Thomas Wouters; the cause
is a bug in the BSDI wchar.h header file) and Python interfaces
for the MBCS codec donated by Mark Hammond.

Also included are some minor corrections w/r to the docs of
the new "es" and "es#" parser markers (use PyMem_Free() instead
of free(); thanks to Mark Hammond for finding these).

The unicodedata tests are now in a separate file
(test_unicodedata.py) to avoid problems if the module cannot
be found.
2000-03-28 20:29:59 +00:00
Guido van Rossum 66d4513975 Piers Lauder:
This patch fixes the "search" command in imaplib. The problem
was that a search can take multiple arguments, but as defined,
would only accept one.

I have also made changes to the test code at the end to be less
verbose by default, but to accept a verbosity argument.
2000-03-28 20:20:53 +00:00
Guido van Rossum 1abd82c07d MBCS codecs for Windows. Contributed by Mark Hammond. 2000-03-28 01:58:50 +00:00
Guido van Rossum dc8b7980e0 Skip Montanaro:
The robotparser.py module currently lives in Tools/webchecker.  In
preparation for its migration to Lib, I made the following changes:

    * renamed the test() function _test
    * corrected the URLs in _test() so they refer to actual documents
    * added an "if __name__ == '__main__'" catcher to invoke _test()
      when run as a main program
    * added doc strings for the two main methods, parse and can_fetch
    * replaced usage of regsub and regex with corresponding re code
2000-03-27 19:29:31 +00:00
Greg Ward 89489fa15d Beefed up error-handling in 'setup()' a smidge:
handle OSError and DistutilsExecError now.
2000-03-26 21:48:43 +00:00
Greg Ward a3c8bf382e Duh, it helps if '_nt_quote_args()' actually returns the mutated list,
rather than None.
2000-03-26 21:47:00 +00:00
Greg Ward cdb20ba56d Fixed a bunch of screwed-up logic and inconsistent terminology.
Fixed 'build_extensions()' to pay attention to the 'rpath' element of the
  'build_info' dictionary.
2000-03-26 21:45:14 +00:00
Greg Ward 2f557a2ec4 Added 'runtime_library_dirs' parameter to 'link_*()' methods, and warn that
we don't know what to do with it when we see it.
Call '_fix_object_args()' and/or '_fix_lib_args()' as appropriate, rather
  than just '_fix_link_args()'.
2000-03-26 21:42:28 +00:00
Greg Ward e21dabe2e0 Added 'runtime_library_dirs' parameter to 'link_*()' methods, and changed to
use it when linking.
Call '_fix_object_args()' and/or '_fix_lib_args()' as appropriate, rather
  than just '_fix_link_args()'.
2000-03-26 21:40:19 +00:00
Greg Ward f10f95d6bb Added 'runtime_library_dirs' parameter to 'link_*()' methods.
Split '_fix_link_args()' up into '_fix_object_args()' (for use of
  'create_static_lib() and link methods) and '_fix_lib_args()' (for the
  link methods only).
2000-03-26 21:37:09 +00:00
Guido van Rossum d8855fde88 Marc-Andre Lemburg:
Attached you find the latest update of the Unicode implementation.
The patch is against the current CVS version.

It includes the fix I posted yesterday for the core dump problem
in codecs.c (was introduced by my previous patch set -- sorry),
adds more tests for the codecs and two new parser markers
"es" and "es#".
2000-03-24 22:14:19 +00:00
Guido van Rossum 7e57bc4a5b Fix the test so that connect() and bind() are called with a single
argument: a (host, port) tuple.

Like multi-arg append(), multi-arg connect() and bind() may be ruled out!
2000-03-24 20:54:29 +00:00
Guido van Rossum d8fbcc95d9 Regenerated with test for 'contains'. 2000-03-24 20:42:39 +00:00
Greg Ward a7540bd043 Import fix. 2000-03-23 04:39:16 +00:00
Greg Ward e2a33079e9 Fixed '_nt_quote_args()': backwards logic reversed, and now it actually
returns a value.
2000-03-23 04:38:36 +00:00
Greg Ward 297dd9fed5 Fixed the class name. 2000-03-23 04:37:11 +00:00
Greg Ward 790c110c48 Revised tons of comments to reflect the current state of affairs better.
Deleted some crufty code.
2000-03-22 00:51:18 +00:00
Greg Ward 048ca7dcaf Run 'install_lib' instead of 'install_py', and ditch 'install_ext'
completely (was already commented-out).
2000-03-22 00:40:16 +00:00
Greg Ward 55753d4a75 Renamed install_py.py to install_lib.py, since it now handles installing all
Python modules, pure and extensions.
2000-03-22 00:37:16 +00:00
Greg Ward 5b001f1569 Obsolete command -- no longer relevant since we now build all modules, pure
Python and extensions, into the same directory.
2000-03-22 00:35:16 +00:00
Greg Ward 1497b61cb0 Dropped the evil and misguided 'set_peer_option()' method -- it's no
longer needed, and can't possibly work anyways.
2000-03-22 00:31:37 +00:00
Greg Ward 066af1074d Dropped any notion of allowing the user to specify the build directories:
these must come from the 'build' command.  This means we no longer need
the misconceived 'set_peer_option()' method in Command and, more importantly,
sweeps away a bunch of potential future complexity to handle this tricky
case.
2000-03-22 00:30:54 +00:00
Greg Ward 1b4ede5f24 Improved an error message in 'mkpath()'.
Tightened up some logic in 'native_path()'.
Added 'subst_vars()' and '_check_environ()'.
2000-03-22 00:22:44 +00:00
Greg Ward 7f6ef6ca26 Renamed 'install_path' to 'extra_path'.
Fix 'Command.set_undefined_option()' to call 'ensure_ready()' rather
  than 'finalize_options()' (which is only supposed to be called once,
  which is the whole point of 'ensure_ready()').
Added comment to 'set_peer_option()' to remind myself that this method
  cannot work and is fundamentally wrong-headed.
2000-03-22 00:20:46 +00:00
Greg Ward a233d86638 Yet another complete rewrite. Hopefully the *last* complete rewrite of
this command for a while; this implements roughly the plan cooked up by
Guido, Fred, and me.  Seems to strike a nice balance between usability in
the common cases (just set one option), expandability for more types of
files to install in future, and customizability of installation
directories.

This revision isn't completely working: standard and alternate
installations work fine, but there are still some kinks to work out of
customized installations.
2000-03-22 00:15:45 +00:00
Greg Ward 531349f28e Fix how we set 'build_dir' and 'install_dir' options from 'install' options --
irrelevant because this file is about to go away, but oh well.
2000-03-22 00:12:51 +00:00
Greg Ward 4620f306a4 Took out what looks like old debugging code that probably should never
have been checked in: was passing the PLAT environment variable as the
'plat' argument to 'new_compiler()'.
2000-03-22 00:11:21 +00:00
Barry Warsaw 51ac58039f On 17-Mar-2000, Marc-Andre Lemburg said:
Attached you find an update of the Unicode implementation.

    The patch is against the current CVS version. I would appreciate
    if someone with CVS checkin permissions could check the changes
    in.

    The patch contains all bugs and patches sent this week and also
    fixes a leak in the codecs code and a bug in the free list code
    for Unicode objects (which only shows up when compiling Python
    with Py_DEBUG; thanks to MarkH for spotting this one).
2000-03-20 16:36:48 +00:00
Greg Ward fb4ece7fea Simplified doc string.
Added 'clean' to list of commands.
2000-03-18 17:36:09 +00:00
Greg Ward 89ccb984f0 Oops! Don't call 'ensure_ready()' in 'Distribution.find_command_obj()' --
that broke parsing command-line options.  Instead call it in
'Command.find_peer()', which is why I added it to 'find_command_obj()'
in the first place.
2000-03-18 17:35:12 +00:00
Greg Ward 11fc7e447c Tweaked all over:
* improve help strings
  * warn if user supplies non-existing directories
  * don't try to 'remove_tree()' non-existing directories
  * try to remove the build_base after cleanup (but don't do or say
    anything if it fails -- this is just in case we made it empty)
2000-03-18 17:33:18 +00:00
Greg Ward 2dc139cc91 Patch from Bastian Kleineidam <calvin@cs.uni-sb.de>:
use 'util.remove_tree()' instead of 'nuke_release_tree()'.
2000-03-18 15:43:42 +00:00
Greg Ward b98fe36c46 Patch from Bastian Kleineidam <calvin@cs.uni-sb.de>: added 'remove_tree()'. 2000-03-18 15:42:22 +00:00
Greg Ward 06537a5e89 Contribution from Bastian Kleineidam <calvin@cs.uni-sb.de>:
the Distutils 'clean' command.
2000-03-18 15:37:26 +00:00
Greg Ward dedd5b5ed2 In 'finalize_options()': if 'self.libs' is a string, make it a singleton list. 2000-03-18 15:21:03 +00:00
Greg Ward d03f88a38f Changed to pay attention to the 'runtime_library_dirs' list (= 'rpath'
option in the 'build_ext' command):
  * in ccompiler.py: 'gen_lib_options()' now takes 'runtime_library_dirs'
    parameter
  * in unixccompiler.py and msvccompiler.py: now pass
    'self.runtime_library_dirs' to 'gen_lib_options()', and define
    'runtime_library_dir_option()' (although in msvccompiler.py it
    blows up with a DistutilsPlatformError right now!)
2000-03-18 15:19:51 +00:00
Fred Drake 908670cdaa Oops, another in the same file; I should read the mail fully before
checking in; sorry!

"the the" --> "the" (in docstring); noted by Detlef Lannert
<lannert@lannert.rz.uni-duesseldorf.de>.
2000-03-17 15:42:11 +00:00
Fred Drake 3e74c0d021 "intput" --> "input" (in docstring); noted by Detlef Lannert
<lannert@lannert.rz.uni-duesseldorf.de>.
2000-03-17 15:40:35 +00:00
Jeremy Hylton 36cc6a2197 complete rewrite
code generator uses flowgraph as intermediate representation.  the old
    rep uses a list with explicit "StackRefs" to indicate the target
    of jumps.

pyassem converts flowgraph to bytecode, breaks up individual steps of
    generating bytecode
2000-03-16 20:06:59 +00:00
Jeremy Hylton f635abee3a simplify visitor walker class
- remove postorder
- remove protocol for automatically walking children based on visitor
  method return value; now only walks if there is no method
2000-03-16 20:04:16 +00:00
Jeremy Hylton b631b8ede5 fix list.append problems 2000-03-16 20:03:04 +00:00
Jeremy Hylton e4d6293383 change name of Set method: items -> elements (avoids confusion with
dict)
2000-03-16 20:02:38 +00:00
Guido van Rossum d4d2684240 Marc-Andre Lemburg: Add tests for mixed use of char in string. 2000-03-13 23:21:48 +00:00
Guido van Rossum a831cac7a8 Marc-Andre Lemburg: test script for Unicode implementation. 2000-03-10 23:23:21 +00:00
Guido van Rossum 8f0c5a7742 Marc-Andre Lemburg: the maxsplit argument for split() and replace()
now defaults to -1, not to 0.  Passing an explicit zero doesn't split
or replace at all.
2000-03-10 23:22:10 +00:00
Guido van Rossum 0612d84155 Module codecs -- Python Codec Registry, API and helpers. Written by
Marc-Andre Lemburg.
2000-03-10 23:20:43 +00:00
Guido van Rossum b5f2f1bb6f Marc-Andre Lemburg: support pickling Unicode objects, both in text
mode ('V') and in binary mode ('X').
2000-03-10 23:20:09 +00:00
Guido van Rossum 85eacecaa0 Marc-Andre Lemburg: add UnicodeType. 2000-03-10 23:18:11 +00:00
Guido van Rossum 0229bf6001 Marc-Andre Lemburg: Unicode encodings. 2000-03-10 23:17:24 +00:00
Guido van Rossum 21288edad0 Marc-Andre Lemburg: Add UnicodeError, derived from ValueError. 2000-03-10 23:16:02 +00:00
Greg Ward 92f3377078 Catch up with change to CCompiler API: call 'create_static_lib()', not
'link_static_lib()'.
2000-03-10 02:02:44 +00:00
Greg Ward 09fc542b27 Renamed 'link_static_lib() to 'create_static_lib()', and rewrote it create
a static library (using lib.exe as found by '__init__()', hopefully through
registry entries pointing to DevStudio).
2000-03-10 01:49:26 +00:00
Greg Ward 036c805958 Renamed 'link_static_lib() to 'create_static_lib()'. 2000-03-10 01:48:32 +00:00
Fred Drake c1ee39a99e There are a few places which can raise DistutilsPlatformError; make
sure it's imported!  ;)

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

There should never be a space between a function name and the '(' that
opens the argument list (see the style guide again).
2000-03-09 15:54:52 +00:00
Greg Ward 7d73b9eb18 Added Joe Van Andel's 'get_python_inc()', adapted by me to supply
the platform-neutral include dir by default and with Mac support.
Added 'get_python_lib()', inspired by 'get_python_inc()'.
Rewrote 'get_config_h_filename()' and 'get_makefile_filename()'
  in terms of 'get_python_inc()' and 'get_python_lib()'.
Changed '_init_nt()' and '_init_mac()' to use 'get_python_inc()' and
  'get_python_lib()' for directory names.
2000-03-09 03:16:05 +00:00
Guido van Rossum da2361ac1d Add tests for char in string -- including required exceptions for
non-char in string.
2000-03-07 15:52:01 +00:00
Guido van Rossum 2663c13c5b Sjoerd Mullender:
The (relatively) new chunk module uses seek, not setpos.  One instance
of the call still needed to be fixed.
2000-03-07 15:19:31 +00:00
Greg Ward 911d86693b Patch from Corran Webster <cwebster@nevada.edu> (tweaked for style by me):
changed 'copy_file()' to use the native Mac file copy routine.
2000-03-07 03:34:16 +00:00
Greg Ward 0eff87a570 Patch from Corran Webster <cwebster@nevada.edu>: add '_init_mac()'. 2000-03-07 03:30:09 +00:00
Greg Ward 5091929c2c Added 'native_path()' for use on pathnames from the setup script: split on
slashes, and put back together again using the local directory separator.
2000-03-07 03:27:08 +00:00
Greg Ward e2b4452d0c Added '_nt_quote_args()' to deal with whitespace in command-line arguments
in a rather half-assed, but probably effective, way.
2000-03-07 03:25:20 +00:00
Guido van Rossum 7344741117 test_contains output 2000-03-06 21:08:08 +00:00
Guido van Rossum 24512e6a35 Test cases for __contains__ code, by Moshe Zadka. 2000-03-06 21:00:29 +00:00
Guido van Rossum e85c93f521 Sjoerd Mullender:
When you set a breakpoint on a function with a multi-line argument
list, the breakpoint is actually set on the second line of the
arguments instead of the first line of the body.  This patch fixes
that.
2000-03-06 20:39:59 +00:00
Jeremy Hylton f728f9a13e import compile function form pycodegen 2000-03-06 19:12:33 +00:00
Jeremy Hylton 7fab23e9cb rename compile.py to pycodegen.py
fix imports
remove parse functions and visitor code
track name change: Classdef to Class

add some comments and tweak order of visitXXX methods

get rid of if __name__ == "__main__ section
2000-03-06 19:10:54 +00:00
Jeremy Hylton 8c78341f45 add a doc string
import some useful functions from contained modules
2000-03-06 19:04:14 +00:00
Jeremy Hylton 9812e7bc6a fix import to refer to compiler package 2000-03-06 18:54:30 +00:00
Jeremy Hylton abd7ebf70b revise arguments for addCode method on lnotab. take several numbers
that are internally converted to chars, rather than taking a string.
2000-03-06 18:53:14 +00:00
Jeremy Hylton fa974a9d06 change node Classdef to Class
add doc string to transformer module
add two helper functions:
    parse(buf) -> AST
    parseFile(path) -> AST
2000-03-06 18:50:48 +00:00
Jeremy Hylton ed9586174d factor out the tree walking/visitor code that was in compile.py 2000-03-06 18:49:31 +00:00
Greg Ward 9552665436 Rewrote 'newer_pairwise(): more natural (and incompatible) interface,
simpler implementation.
2000-03-06 03:44:32 +00:00
Greg Ward 32c4a8a0ee Serious overhaul of the C compiler interface and the two classes that
implement it (so far):
  * moved filename generation methods into CCompiler base class,
    driven by data supplied by implementation classes
  * moved a bunch of common code from UnixCCompiler to convenience
    methods in CCompiler
  * overhauled MSVCCompiler's compile/link methods to look and act
    as much as possible like UnixCCompiler's, in order to regularize
    both interface and behaviour (especially by using those new
    convenience methods)
2000-03-06 03:40:29 +00:00
Greg Ward eb3f75e636 Don't pass 'keep_dir' to 'compile()' method of CCompiler -- no longer used. 2000-03-06 03:37:45 +00:00
Greg Ward 4ba5da418c Don't pass 'keep_dir' to 'compile()' method of CCompiler -- no longer used.
Don't assume that the 'libraries' and 'library_dirs' elements of the
  build info dict are always lists.
2000-03-06 03:36:50 +00:00
Jeremy Hylton 820314ea95 allow comments beginning with ; in key: value as well as key = value 2000-03-03 20:43:57 +00:00
Greg Ward 56359f591b Typo fix. 2000-03-03 03:00:27 +00:00
Greg Ward 96182d7b68 Fixed 'mkpath()' to accept empty string silently (it's just the current dir).
Fixed all DistutilsFileError messages to wrap file/dir names in quotes.
2000-03-03 03:00:02 +00:00
Greg Ward 76ec0d6d76 Renamed 'build_lib' command to 'build_clib':
* replaced build_lib.py with build_clib.py
  * renamed the class in build_clib.py
  * changed all references to 'build_lib' command in other command classes
2000-03-02 01:57:12 +00:00
Greg Ward 3ce77fd05e Changed '__rcsid__' to '__revision__'. 2000-03-02 01:49:45 +00:00
Greg Ward 60f64330d1 If the "build_lib" command built any C libraries, link with them all
when building extensions (uses build_lib's 'get_library_names()' method).
Ensure that the relative structure of source filenames is preserved in
  the temporary build tree, eg. foo/bar.c compiles to
  build/temp.<plat>/foo/bar.o.
2000-03-02 01:32:21 +00:00
Greg Ward 833dfd52e5 Added command description.
Added 'build_clib' and 'build_temp' options (where to put C libraries
  and where to put temporary compiler by-products, ie. object files).
Moved the call to 'check_library_list()' from 'run()' to 'finalize_options()'
  -- that way, if we're going to crash we do so earlier, and we guarantee
  that the library list is valid before we do anything (not just run).
Disallow directory separators in library names -- the compiled library
  always goes right in 'build_clib'.
Added 'get_library_names()', so the "build_ext" command knows what
  libraries to link every extension with.
2000-03-02 01:27:36 +00:00
Greg Ward 49ffce173e In the 'compile()' method: preserve the directory portion of source
filenames when constructing object filenames, even if output_dir given --
eg. "foo/bar.c" will compile to "foo/bar.o" without an output_dir, and to
"temp/foo/bar.o" if output_dir is "temp".
2000-03-02 01:21:54 +00:00
Greg Ward f1146572dd In compile/link methods: ensure that the directory we expect to be writing to
exists before calling the compiler/linker.
2000-03-01 14:43:49 +00:00
Greg Ward 013f0c8636 Added 'mkpath()' method: convenience wrapper around 'util.mkpath()' that adds
the compiler objects 'verbose' and 'dry_run' flags.
2000-03-01 14:43:12 +00:00
Greg Ward 611850bbb3 Added call to 'ensure_ready()' on the command object in
'Distribution.find_command_obj()'.
2000-03-01 14:42:07 +00:00
Greg Ward 585df89f60 Added 'get_platform()' to construct a string that identifies the current
platform, using 'os.uname()' or 'sys.platform'.
2000-03-01 14:40:15 +00:00
Greg Ward e51d69efb0 Build reorg:
* 'build_dir' -> 'build_lib', which by default takes its value
    straight from 'build_lib' in the 'build' command
  * added 'build_temp' and 'inplace' options
  * change 'build_extensions()' to put object files (compiler turds) in
    'build_temp' dir
  * complicated the name-of-extension-file shenanigans in
    'build_extensions()' to support "in-place" extension building, i.e.
    put the extension right into the source tree (handy for developers)
  * added 'get_ext_fullname()', renamed 'extension_filename()' to
    'get_ext_filename()', and tweaked the latter a bit -- all to support
    the new filename shenanigans
2000-03-01 01:43:28 +00:00
Greg Ward 42a3bf564a Build reorg:
* 'build_lib' -> 'build_purelib'
  * new 'build_lib' and 'build_temp' options
  * use 'get_platform()' to initialize 'build_platlib' and 'build_temp'
2000-03-01 01:26:45 +00:00
Greg Ward e691651682 Build reorg: change 'build_dir' option to 'build_lib'. 2000-03-01 01:19:37 +00:00
Guido van Rossum a9b2b4be26 Remove some redundant logic from walk() -- there's no need to check
for "." and "..", since listdir() no longer returns those.
2000-02-29 13:31:16 +00:00
Andrew M. Kuchling 39d3bfc4c2 Fix a typo in a comment 2000-02-29 00:10:24 +00:00
Fred Drake 1ab41fc680 Fix comments relating to the specific regexs used to parse section and
option names; errors noted by Greg Stein <gstein@lyra.org>.
2000-02-28 23:23:55 +00:00
Guido van Rossum 619c33787b Patch by Piers Lauder, who writes:
This patch is re: Lucas.Dejonge@awtpl.com.au: [Python-bugs-list] imaplib -
not complying with RFC (PR#218)

Lucas de Jonge reported that the code in imaplib that detects a read-write
to read-only change doesn't comply with RFC 2060.
2000-02-28 22:37:30 +00:00
Fred Drake c517b9b406 (Finally!) Changes related to the ConfigParser/INI-file topics
discussed on c.l.py last January.  Specifically:
  - more characters allowed in section & option names
  - if '=' is used to separate the option & value, the value can be
    followed by a comment of the form '\s;'
2000-02-28 20:59:03 +00:00
Guido van Rossum 98d9fd3e68 Simple changes by Gerrit Holl - move author acknowledgements out of
docstrings into comments.
2000-02-28 15:12:25 +00:00
Guido van Rossum 84a74595f7 Patch by Gerrit Holl to avoid doing two stat() calls in a row in walk(). 2000-02-28 14:27:07 +00:00
Guido van Rossum 0ba33002e1 Fix a typo in Barry's checkin.
Reported both by Gerrit Holl and Mark Favas.
2000-02-27 15:35:47 +00:00
Guido van Rossum d28de23bda Fixed a multi-arg append() call, discovered by Mark Favas.
Also removed some unnecessary backslases (inside parens).
2000-02-27 15:34:29 +00:00
Greg Ward 7a0620c3a5 Try to deal with pre-1.5.2 IOError exception objects. 2000-02-26 00:49:40 +00:00
Greg Ward 4f08e4facb Unfinished, untested implementation of the lovely baroque installation scheme
cooked up by Fred Drake and me.  Only saved for posterity (whoever posterity
is), as it is about to be ditched in favour of GvR's much simpler design.
2000-02-26 00:49:04 +00:00