Commit Graph

2460 Commits

Author SHA1 Message Date
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