Commit Graph

2347 Commits

Author SHA1 Message Date
Greg Ward 699880931e Latest patch from Thomas Heller/Robin Becker:
* tweak my docstrings
  * fix None returns to empty list
  * reshuffle responsibilities between '_find_exe()', '_find_SET()', and
    the MSVCCompiler constructor -- now the constructor worries about
    fetching the version list and determining the most recent one
  * added "/W3" compile option
Also, I added/tweaked some docstrings.
2000-02-11 02:47:15 +00:00
Jeremy Hylton 4eb504c2af add loop handling via
Loop object to handle StackRegs
loops stack attr on CodeGenreeator to hold the current loop object

add support for nodes While, Break, Continue
2000-02-10 20:55:50 +00:00
Jeremy Hylton 95b8614353 add an __len__ to Set and Stack 2000-02-10 20:54:27 +00:00
Barry Warsaw 9dd7872945 Added new exception classes:
NNTPError - derived from Exception, it's the base class for all
    other exceptions in this module

    NNTPReplyError - what used to be error_reply

    NNTPTemporaryError - what used to be error_temp

    NNTPPermanentError - what used to be error_perm

    NNTPProtocolError - what used to be error_proto

    NNTPDataError - what used to be error_data

All the old names are retained for backwards compatibility; they point
to the class that replaces them.  Also, any code in this module that
raises an exception, now does so with the exception class.

NNTP.__init__(): Added a new optional argument `readermode', which is
a flag that defaults to false.  When set to true, the "mode reader"
command is sent to the NNTP server before user authentication.  Reader
mode is sometimes necessary if you are connecting to an NNTP server on
the local machine and intend to call reader-specific comamnds, such as
`group'.  If you get unexpected NNTPPermanentErrors, you might need to
set readermode.  Patch provided by Thomas Wouters (who include the
standard disclaimer on is patches@python.org submission), and inspired
by Jim Tittsler.
2000-02-10 20:25:53 +00:00
Jeremy Hylton 3e0910c10c add namespace attr to CodeGenerator, can be either MODULE_NAMESPACE or
FUNCTION_NAMESPACE.  initialize in __init__ and reset in
generateFunctionCode.

replace direct issue of STORE_FAST, STORE_GLOBAL, etc. with call to
storeName; same for loadName and deleteName

the new {store,load,delete}Name methods use the namespace attr and the
local variable stack to determine the correct bytecode to issue
2000-02-10 17:20:39 +00:00
Fred Drake 13a2c279c5 Untabify to pass the -tt test. 2000-02-10 17:17:14 +00:00
Fred Drake 857c4c36b9 Detabify.
I ran "expand" instead of using Skip's patch, but it's all the same.
2000-02-10 16:21:11 +00:00
Fred Drake ad892dc80d Make this pass the -tt test. 2000-02-10 15:31:07 +00:00
Greg Ward 62e3393e4d Stylistic changes to the registry-grovelling code: code formatting, changed
function names, dbetter (hopefully) ocstrings, and comments.
2000-02-10 02:52:42 +00:00
Greg Ward 10ca82b57c Typecheck 'output_dir' argument to compile/link methods. 2000-02-10 02:51:32 +00:00
Greg Ward 968d883be5 Path from Thomas Heller: resurrect the .def file kludge while preserving the
/export option mini-kludge.
2000-02-10 02:17:06 +00:00
Greg Ward 4ba9b2e3b6 Patch from Thomas heller:
* don't need to mention python<ver>.lib -- it's done by a pragma
  * add debug flags for compile and link, and use them
  * fix 'link_shared_library()' to pass everything to 'link_shared_object()'
  * change filename when shared object with debug info (ugh)
2000-02-10 02:15:52 +00:00
Jeremy Hylton 5e0ce53e0e add ExampleASTVisitor:
* prints out examples of nodes that are handled by visitor.  simply a
  development convenience

remove NestedCodeGenerator -- it was bogus after all
replace with generateFunctionCode, a method to call to generate code
  for a function instead of a top-level module

fix impl of visitDiscard (most pop stack)
emit lineno for pass

handle the following new node types: Import, From, Getattr, Subscript,
Slice, AssAttr, AssTuple, Mod, Not, And, Or, List

LocalNameFinder: remove names declared as globals for locals

PythonVMCode: pass arg names to constructor, force varnames to contain
them all (even if they aren't referenced)

add -q option on command line to disable stdout
2000-02-10 00:47:08 +00:00
Jeremy Hylton 69926eaee0 add remove method to set 2000-02-10 00:43:22 +00:00
Greg Ward e8c6ce4684 Added 'debug' option, and changed compile/link calls to use it. 2000-02-09 02:20:14 +00:00
Greg Ward 324620015d Added 'debug' option (just there for 'build_ext' and 'build_lib' commands
to fallback to if the user doesn't set it for those commands.
2000-02-09 02:19:49 +00:00
Greg Ward 386b84439f Added 'debug' flags to compile and link methods, and added dummy code for
someone who knows Windows/MSVC++ to come along and add the right flags.
Comment noting that 'link_static_lib()' signature is inconsistent with
  the other compiler classes (uh-oh!)
2000-02-09 02:18:39 +00:00
Greg Ward ba233fbe92 Added 'debug' flags to compile and link methods, and modified code to add
'-g' flag to compiler/linker command lines when it's true.
2000-02-09 02:17:00 +00:00
Greg Ward 3c045a5766 Added 'debug' flag to compile and link method signatures.
Doc fix: several paragraphs under 'link_static_lib()' moved to
  'link_shared_lib()', where they belong.
2000-02-09 02:16:14 +00:00
Jeremy Hylton 402456020b add optional verbose arg to walk function. it overrides the global
VERBOSE setting for the ASTVisitor

add getopt handling for one or more -v args

rename ForwardRef to StackRef, because it isn't necessarily directional

CodeGenerator:
* add assertStackEmpty method.  prints warning if stack is not empty
  when it should be
* define methods for AssName, UNARY_*, For

PythonVMCode:
* fix mix up between hasjrel and hasjabs for address calculation
2000-02-08 21:15:48 +00:00
Jeremy Hylton 156a975476 make all unary operators have a single child node called expr 2000-02-08 21:06:19 +00:00
Jeremy Hylton 1851901a05 add spaces to comparison names is not and not in to match dis 2000-02-08 19:58:33 +00:00
Jeremy Hylton 53187f32eb now produces valid pyc files for a least a trivial subset of the
language.

CodeGenerator:
* modify to track stack depth
* add emit method that call's PythonVMCode's makeCodeObject
* thread filenames through in hackish way
* set flags for code objects for modules and functions
  XXX the docs for the flags seem out of date and/or incomplete

PythonVMCode:
* add doc string describing the elements of a real code object

LineAddrTable:
* creates an lnotab (no quite correctly though)
2000-02-08 19:01:29 +00:00
Jeremy Hylton aa9d2d6123 constants from transformer 2000-02-08 18:57:51 +00:00
Jeremy Hylton 9605c11c4c move constants out of transformer so that they can be shared with ast
add varargs and kwargs attributes to Function nodes
2000-02-08 18:57:32 +00:00
Fred Drake 69e2c6efbb get_config_h_filename(): Support NT as well as Posix systems.
_init_nt():  Use get_config_h_filename() instead of figuring out the
             name directly.

             g['SO'] should be set to '.pyd'.

             Adjust some minor coding nits.
2000-02-08 15:55:42 +00:00
Greg Ward 1b9c6f7788 Revised version (thank to Thomas Heller and Robin Becker) that tries a lot
harder to find the MSVC compiler (mainly by using the registry).
2000-02-08 02:39:44 +00:00
Greg Ward f0219ba290 Ditch .def file kludge for (much smaller) /export option kludge. 2000-02-08 02:37:15 +00:00
Fred Drake a710d6e20c Added test case for accessing gsbm database by key after it's closed;
it should raise gdbm.error.
2000-02-07 17:15:48 +00:00
Greg Ward 1bea7ab7bd Added 'libraries' option for use by the 'build_lib' command.
Typo fix.
2000-02-05 02:24:52 +00:00
Greg Ward 5f7c18e816 Run the 'build_lib' command before building extensions, if necessary. 2000-02-05 02:24:16 +00:00
Greg Ward aaf27ee07b New command to build C (and C++, hopefully) libraries needed by extensions
in the current distribution: motivated by PIL's libImaging.
2000-02-05 02:23:59 +00:00
Greg Ward c1854673e2 Tweaked various comments, docstrings, and error messages. 2000-02-05 02:23:16 +00:00
Jeremy Hylton 0fdffcf916 rapid evolution towards producing real .pyc files (even though I don't
handle most of the language syntax yet)

create NestedCodeGenerator used to generator the separate code object
that needs to be passed as an argument to MAKE_FUNCTION when a def
stmt is found (probably useful for class too)

change CodeGenerator.visitFunction to use the NestedCG

add CompiledModule class to handle creation of .pyc (pretty minimal
for now)

add makeCodeObject method to PythonVMCode that replaces symbolic names
with indexes into slots of the code code.  the design of this
class will probably need to be revised.
2000-02-04 19:37:35 +00:00
Guido van Rossum 1fdae12c93 Added a simple test program to disassemble a file, invoked as __main__. 2000-02-04 17:47:55 +00:00
Guido van Rossum 4b8c6eaf8b Actually, the previous batch's comment should have been different;
*this* set of patches is Ka-Ping's final sweep:

The attached patches update the standard library so that all modules
have docstrings beginning with one-line summaries.

A new docstring was added to formatter.  The docstring for os.py
was updated to mention nt, os2, ce in addition to posix, dos, mac.
2000-02-04 15:39:30 +00:00
Guido van Rossum e7b146fb3b The third and final doc-string sweep by Ka-Ping Yee.
The attached patches update the standard library so that all modules
have docstrings beginning with one-line summaries.

A new docstring was added to formatter.  The docstring for os.py
was updated to mention nt, os2, ce in addition to posix, dos, mac.
2000-02-04 15:28:42 +00:00
Guido van Rossum 54f22ed30b More trivial comment -> docstring transformations by Ka-Ping Yee,
who writes:

Here is batch 2, as a big collection of CVS context diffs.
Along with moving comments into docstrings, i've added a
couple of missing docstrings and attempted to make sure more
module docstrings begin with a one-line summary.

I did not add docstrings to the methods in profile.py for
fear of upsetting any careful optimizations there, though
i did move class documentation into class docstrings.

The convention i'm using is to leave credits/version/copyright
type of stuff in # comments, and move the rest of the descriptive
stuff about module usage into module docstrings.  Hope this is
okay.
2000-02-04 15:10:34 +00:00
Jeremy Hylton 8b6323d3ef checking in initial weekend's work
compile.py: ASTVisitor framework plus bits of a code generator that
    should be bug-for-buf compatible with compile.c

misc.py: Set and Stack helpers

test.py: a bit of simple sample code that compile.py will work on
2000-02-04 00:28:21 +00:00
Jeremy Hylton 106a02da94 make p2c a package 2000-02-04 00:25:34 +00:00
Jeremy Hylton f968e8545d three files from the p2c cvs tree. the message here indicates the
revision number the p2c cvs tree.

COPYRIGHT: 1.1
ast.py: 1.3
transformer.py: 1.11
2000-02-04 00:25:23 +00:00
Greg Ward 7f0fb0b01e Improved an error message.
Announce when we start building each extension (better feedback).
2000-02-03 23:07:54 +00:00
Greg Ward ef6f515d49 Changed 'compile()' method to compile files one-at-a-time -- gives better
feedback and, theoretically, the opportunity to set compiler flags
on a per-file basis.
2000-02-03 23:07:19 +00:00
Fred Drake d89ffebd85 These modules are now declared obsolete. 2000-02-03 15:26:16 +00:00
Guido van Rossum 43265beff9 # module filecmp
# combo of old cmp, cmpcache and dircmp with redundancies removed
#
# bugs fixed:
#   dircmp.dircmp was not ignoring IGNORES
#   old stuff could falsely report files as "identical" when contents actually differed
#
# enhancements:
#   dircmp has a more straightforward interface
#cmp enhanced by Moshe Zadca
#dircmp enhanced byGordon McMillan

[some layout changes by GvR]
2000-02-03 00:41:22 +00:00
Guido van Rossum 75a7959335 In _fileobject, optimize read() a bit (it could be really slow), and
remove "import string" -- use string methods instead!
2000-02-02 16:57:32 +00:00
Guido van Rossum 823e91c767 Optimize abspath() slightly for the case that win32api can't be
imported; in that case, abspath is replaced by a fallback version.
2000-02-02 16:54:39 +00:00
Guido van Rossum 5606801b64 Make read() and readlines() conform more to the file object interface:
the default arg for read() is -1, not None, and readlines() has an
optional argument (which for now is ignored).
2000-02-02 16:51:06 +00:00
Guido van Rossum 4acc25bd39 Mass patch by Ka-Ping Yee:
1. Comments at the beginning of the module, before
       functions, and before classes have been turned
       into docstrings.

    2. Tabs are normalized to four spaces.

Also, removed the "remove" function from dircmp.py, which reimplements
list.remove() (it must have been very old).
2000-02-02 15:10:15 +00:00
Greg Ward 113e70efa2 Patch from Joe Van Andel: fix arg to % operator in warning. 2000-02-02 00:07:14 +00:00
Greg Ward a0ca3f24f9 Comment fix.
Always use normalized (with os.path.normpath()) versions of prefix and
  exec_prefix.
2000-02-02 00:05:14 +00:00
Guido van Rossum 3c8baedaf8 Sjoerd Mullender writes:
Fixed a TypeError: not enough arguments; expected 4, got 3.
When authentication is needed, the default http_error_401 method calls
retry_http_basic_auth.  The default version of that method expected a
data argument which wasn't provided, so now we provide the argument if
it was given and we also made the data argument optional.

Also changed other calls where data was optional to not pass data if
it was not passed to the calling method (in line with other similar
occurances).
2000-02-01 23:36:55 +00:00
Greg Ward d1466b968f Allow either README or README.txt as a "standard file". 2000-01-30 20:22:27 +00:00
Greg Ward a002edc85b Fixed broken list extend in 'copy_tree()'. 2000-01-30 19:57:48 +00:00
Greg Ward 37bc815053 Added 'description' class attribute to every command class (to help the
'--help-commands' option).
Shuffled imports around in a few command modules to avoid expensive
  up-front import of sysconfig (and resulting delays in generating list
  of all commands).
2000-01-30 18:34:15 +00:00
Greg Ward 4c67936e4e Added 'dist' command. 2000-01-30 18:31:34 +00:00
Greg Ward f0fd6175b3 Improvements to the help system:
* "--help" can now come either before or after particular commands
    to get help on and can give help on multiple commands, eg.
    "--help install dist" gives help on those two commands
  * added "--help-commands" option, implemented by the 'print_commands()'
    and 'print_command_list()' methods
2000-01-30 18:30:32 +00:00
Greg Ward 7478a4832a Added missing run of corresponding 'build' command. 2000-01-30 15:07:56 +00:00
Jeremy Hylton 6d7e47b8ea EXPERIMENTAL
An extensible library for opening URLs using a variety protocols.
Intended as a replacement for urllib.
2000-01-20 18:19:08 +00:00
Guido van Rossum 331f19e894 Change two occurrences of type(x) <> types.CodeType into
isinstance(x, types.CodeType).

Suggested by Finn Bock.
2000-01-19 21:57:30 +00:00
Greg Ward 9f200cbaa6 Fix indentation bug. 2000-01-17 21:58:07 +00:00
Greg Ward 3b49c9babd Catch OSError from 'spawnv()' in '_spawn_nt()'.
Tweaked error messages in '_spawn_posix()'.
2000-01-17 21:57:55 +00:00
Greg Ward 01f5215828 Removed /GD switch -- currently ignored by MSVC. 2000-01-17 21:57:17 +00:00
Greg Ward 8dbf681a97 Added compiler flags suggested by Thomas Heller: optimize, use multi-threaded
RT library.
2000-01-17 20:40:48 +00:00
Greg Ward 1b3a9af5cf Added missing import.
Fixed 'make_release_tree()' to copy files if 'os.link()' doesn't exist.
2000-01-17 20:23:34 +00:00
Greg Ward cbeca7b408 Added code to use Jim Ahlstrom's zipfile.py module if the external zip
command wasn't found or failed.  (Code supplied by Thomas Heller
<thomas.heller@ion-tof.com>.)
2000-01-17 18:04:04 +00:00
Greg Ward c8a95c8d5e Fix library filename methods -- there is no 'lib' prefix under DOS/Windows. 2000-01-17 18:00:04 +00:00
Greg Ward c27d800251 Always run sys.prefix and sys.exec_prefix through 'os.path.normpath()'
before storing or using.
2000-01-17 16:25:59 +00:00
Greg Ward 7c463ef362 Ditch unneeded imports. 2000-01-17 16:25:17 +00:00
Guido van Rossum 1d2b23ef22 Fix by Nick Russo in processing of timezone in test program; the
ParsedDate didn't have the correct day of week.
2000-01-17 14:11:04 +00:00
Greg Ward 7b7679eb79 'newer_group()' can now deal with missing files, in a way specified by
the 'missing' parameter.
2000-01-09 22:48:59 +00:00
Greg Ward c9f3187be2 Abstracted '_fix_link_args()' out of 'link_shared_object()'.
Added 'link_static_lib()' method, and 'archiver' and 'archiver_options'
  class attributes to support it.
Added 'link_executable()' method, and 'ld_exec' instance attribute
  to support it.
'newer_group()' is now able to handle missing files, so we don't have
  to kludge it by catching OSError when calling it.
'object_filenames()' and 'shared_object_filename()' now take 'keep_dir'
  flag parameters.
'library_filename()' and 'shared_library_filename()' now respect
  a directory component in the library name.
Various comment updates/deletions.
2000-01-09 22:47:53 +00:00
Greg Ward 5baf1c2111 Removed a bunch of irrelevant parameters from 'link_static_lib()' signature.
Added 'link_executable()' signature.
2000-01-09 22:41:02 +00:00
Greg Ward e9436da686 Typo fix: 'file.warn' should have been 'manifest.warn' in a couple of places. 2000-01-09 22:39:32 +00:00
Guido van Rossum d2783da63e The correct RFC to reference is RFC-1521 (MIME part one), not 1421 (PEM). 2000-01-03 15:44:40 +00:00
Greg Stein f23aa1ee9f redesign/rebuild around the ImportManager concept. 2000-01-03 02:38:29 +00:00
Fred Drake db1bd5c230 Revise tests to support str(<long int object>) not appending "L". 1999-12-23 15:36:42 +00:00
Fred Drake fbff97a73b Don't call len() if the value is already cached! Caught by Gerrit
Holl <gerrit.holl@pobox.com>.
1999-12-22 21:52:32 +00:00
Guido van Rossum 80c33e562d Contribution from Gerrit Holl:
This patch changes the string-based exceptions to class-based
exceptions, so that you can fetch the unknown option as an
attribute.  As far as I know, it is backward compatible.

[The new exception class is called GetoptError; the name error is an
alias for compatibility.]
1999-12-21 22:38:40 +00:00
Greg Ward 9d46b9ce97 When emitting a command-line error message, *say* it's an error. 1999-12-16 01:19:05 +00:00
Greg Ward ad83f04086 Catch errors from 'rmtree' and emit a warning. 1999-12-16 01:14:15 +00:00
Guido van Rossum cd97576184 Only set msg.fp to None when there are no extra arguments; if there
are, we must keep the file around so we can print the body.
1999-12-14 22:18:37 +00:00
Guido van Rossum 8c0622114b V 2.16 from Piers:
I've changed the login command to force proper
	quoting of the password argument. I've also added
	some extra debugging code, which is removed when
	__debug__ is false.
1999-12-13 23:27:45 +00:00
Greg Ward 97798b1d47 Use 'search', not 'match', on filename pattern regexes. 1999-12-13 21:38:57 +00:00
Greg Ward 0bdd90a7e7 Catch up with terminology change in UnixCCompiler: 'includes' -> 'include_dirs'. 1999-12-12 17:19:58 +00:00
Greg Ward 1d0495e05c Catch missing MANIFEST file and warn rather than blowing up.
Added 'nuke_release_tree()' method to blow away the directory from
  which the archive file(s) are created, and call it (conditionally)
  from 'make_distribution()'.
Added 'keep_tree' option (false by default) to disable the call to
  'nuke_release_tree()'.
1999-12-12 17:07:22 +00:00
Greg Ward 9b45443c1b Fixed 'find_package_modules()' to ensure that we never build (and thus
install) the setup script itself.
Fixed 'build_module()' so we do *not* preserve file mode (which means
  we can install read-only files, which makes the next installation
  of this distribution fail -- at least under Unix); added a comment
  explaining this.
1999-12-12 17:03:59 +00:00
Greg Ward 48697d931b Changed 'build_extensions()' so 'sources' can be a list or tuple; and
call CCompiler method 'compile()' with 'include_dirs' not 'includes'.
Fixed stupid typo in 'get_source_files()'.
1999-12-12 17:01:01 +00:00
Greg Ward 04d78328f3 In 'compile()' method, renamed 'includes' parameter to 'include_dirs' for
consistency with 'build_ext' command option.
Changed 'compile()' and 'link_shared_object()' so 'include_dirs',
  'libraries', and 'library_dirs' can be lists or tuples.
1999-12-12 16:57:47 +00:00
Greg Ward 44f8e4ea08 Added support for printing out help text from option table: 'print_help()',
'generate_help()', 'wrap_text()' functions, and a little tiny test
  of 'wrap_text()'.
Changed how caller states that one option is the boolean opposite of
  another: added 'negative_opt' parameter to 'fancy_getopt()', and changed
  to use it instead of parsing long option name.
1999-12-12 16:54:55 +00:00
Greg Ward c9c37b1c6e Made "verbose" mode the default; now you have to supply --quiet if you
want no output.  Still no option for a happy medium though.
Added "--help" global option.
Changed 'parse_command_line()' to recognize help options (both for the
  whole distribution and per-command), and to distinguish "regular run"
  and "user asked for help" by returning false in the latter case.
Also in 'parse_command_line()', detect invalid command name on command
  line by catching DistutilsModuleError.
  a 'negative_opt' class attribute right after 'global_options'; changed
  how we call 'fancy_getopt()' accordingly.
Initialize 'maintainer' and 'maintainer_email' attributes to Distribution
  to avoid AttributeError when 'author' and 'author_email' not defined.
Initialize 'help' attribute in Command constructor (to avoid
  AttributeError when user *doesn't* ask for help).
In 'setup()':
  * show usage message before dying when we catch DistutilsArgError
  * only run commands if 'parse_command_line()' returned true (that
    way, we exit immediately when a help option is found)
  * catch KeyboardInterrupt and IOError from running commands
Bulked up usage message to show --help options.
Comment, docstring, and error message tweaks.
1999-12-12 16:51:44 +00:00
Guido van Rossum 09c8b6c3e4 OpenSSL support. This is based on patches for a version of SSLeay by
Brian E Gallew, which were improved and adapted to OpenSSL 0.9.4 by
Laszlo Kovacs of HP.  Both have kindly given permission to include
the patches in the Python distribution.  Final formatting by GvR.
1999-12-07 21:37:17 +00:00
Guido van Rossum 5274c336f5 According to Craig H Rowland, openbsd2 is yet another BSD variant that
uses the BSD version of the lock structure.  Sigh, @!%$.
1999-12-06 14:51:05 +00:00
Greg Ward 631e6a0c07 [from 1999-11-04]
Bunch of little bug fixes that appeared in building non-packagized
distributions.  Mainly:
  - brain-slip typo in 'get_package_dir()'
  - don't try to os.path.join() an empty path tuple -- it doesn't like it
  - more type-safety in 'build_module()'
1999-12-03 16:18:56 +00:00
Guido van Rossum 6dfc792fea In abspath(), always use normpath(), even when win32api is available
(and even when it fails).  This avoids the problem where a trailing
separator is not removed when win32api.GetFullPathName() is used.
1999-11-30 15:00:00 +00:00
Barry Warsaw d25c1b73d2 A bunch of docstring fixes. 1999-11-28 17:11:06 +00:00
Greg Stein 32efef33ae look for builtins before stuff on the path. 1999-11-24 02:38:37 +00:00
Greg Stein 2b23413ce2 add loading of dynamic library modules. 1999-11-24 02:37:05 +00:00
Greg Stein 7ec28d298d turn SysPathImporter into PathImporter. 1999-11-20 12:31:07 +00:00
Greg Stein 72ee43527d remove the __version__ global. 1999-11-20 11:39:56 +00:00
Greg Stein 6d3165a5a1 only put __path__ into package modules. 1999-11-20 11:39:00 +00:00
Greg Stein 63faa01538 shift code from DirectoryImporter out to a common area.
remove use of "os" module (bootstrap issues) and go to the underlying
  platform-specific modules
fix problem in _compile() (trapped wrong error on permission issues)
add SysPathImporter and BuiltinImporter
put __file__ into modules imported from the filesystem. [backwards compat]
put __path__ into modules [backwards compat]
  oops: it is doing this for all modules, not just packages.
comment and tweak to the PackageArchiveImporter
1999-11-20 11:22:37 +00:00
Guido van Rossum d7b147b040 Moshe Zadka writes: When deploying SimpleHTTPServer, I noticed a
problem: it does not encode/decode the urls, which is wrong.
1999-11-16 19:04:32 +00:00
Guido van Rossum 77980a731c Correct typo in module doc string doscovered by Jonathan Giddy. 1999-11-15 14:19:15 +00:00
Guido van Rossum 768d2271a8 Oops. Remove some garbage from the doc string that was accidentally
checked in due to a patching mishap.  Reported by Detlef Lannert;
thanks!
1999-11-09 16:36:45 +00:00
Greg Stein d4c64ba0f9 Add some header comments to all the files. 1999-11-07 13:14:58 +00:00
Greg Stein 281b8d82f7 initial checkin for my Python stuff. 1999-11-07 12:54:45 +00:00
Fred Drake e4f13660f8 split() docstring: Made signature and description for the first
parameter match.  Error pointed out by François
                    Pinard <pinard@iro.umontreal.ca> on c.l.py.
1999-11-04 19:19:48 +00:00
Guido van Rossum 19878f58fe Sjoerd Mullender writes:
I regularly find that pdb sets the breakpoint on the wrong line when I
try to set a breakpoint on a function.  This fixes the problem
somewhat.
The real problem is that pdb tries to parse the Python source code to
find the first executable line.  A better way might be to inspect the
code object, or even have a variable in the code object
co_firstexecutablelineno, but that's too much work.

The patch fixes the problem when the first code line after the def
statement contains the start *and* end of a triple-quoted string.  The
code assumed that the end of a triple-quoted string is not on the same
line as the start, and so it would skip to the end of the *next*
triple-quoted string.
1999-11-03 13:10:07 +00:00
Guido van Rossum dd7cbbf4d3 Oops. spawnl() and spawnle() should be implemented on Windows too.
Also added a comment that the 'p' variants (spawnvp() etc.) are *not*
supported on Windows.  (They could be by adding them to posixmodule.c)
1999-11-02 20:44:07 +00:00
Guido van Rossum f618a48d11 Correct typo in walk.__doc__ reported by Francois Pinard. 1999-11-02 13:29:08 +00:00
Guido van Rossum 5a2ca9328d Checking in a bunch of spawn functions. These are only defined if we
have fork and execv (and friends) but not spawnv.  They operate
exactly like the spawn functions on Windows.  A limited set of needed
constants is also defined (P_WAIT, P_NOWAIT etc.).

Also add getenv() as a familiar alias for environ.get().
1999-11-02 13:27:32 +00:00
Guido van Rossum 2d72687006 New module by Moshe Zadka (submitted on Sept. 25). This unifies the
functionality of cmp.py and cmpcache.py, which are hereby declared
obsolescent.
1999-10-26 14:02:01 +00:00
Guido van Rossum 4e20de59dd Patch by Michael Hudson: when the object of attribute expansion is a
class instance, include the class attributes in the list of possible
expansions.
1999-10-26 13:09:08 +00:00
Guido van Rossum d65b53923e Fix by Moshe Zadka (cleaned up and documented by GvR) to break out the
request handling into separate parse_request() and handle_request()
methods.
1999-10-26 13:01:36 +00:00
Greg Ward e1ada50559 Don't assume GNU tar -- generate tar file and compress in separate steps.
Now supports the full range of intended formats (tar, ztar, gztar, zip).
"-f" no longer a short option for "--formats" -- conflicts with new
  global option "--force"!
1999-10-23 19:25:05 +00:00
Greg Ward d6c30f66c7 Removed massive comment speculating about needlessly complex variations
on the manifest file syntax.
1999-10-23 19:10:59 +00:00
Greg Ward 346e320c6e Qualified use of 'newer_group' function. 1999-10-23 19:06:56 +00:00
Greg Ward 6bad86462b Fix how we run 'zip' -- give explicit .zip extension. 1999-10-23 19:06:20 +00:00
Guido van Rossum bda10c81d0 In helo() and ehlo(), Don't fail when gethostbyaddr() fails -- just
keep whatever gethostname() returns.  After a suggestion by Doug Wyatt.
1999-10-22 13:09:20 +00:00
Guido van Rossum 8fa42af978 Fix PR#107: wm_colormapwindows() did the wrong thing when presented
more than one window argument.
1999-10-20 12:29:56 +00:00
Guido van Rossum 910d9a0634 Test output.
(XXX perhaps a bit too verbose; in particular it is sensitive to
all the doc strings.)
1999-10-19 19:09:00 +00:00
Guido van Rossum fdecda0123 Rewritten -- this now tests the binascii *except* for the binhex
module, which is tested by test_binhex.py.
1999-10-19 19:08:13 +00:00
Guido van Rossum a0e85b241d Test output for test_binhex.py. 1999-10-19 19:07:33 +00:00
Guido van Rossum 7b8f1abfca This test really only tests the binhex module.
Renamed it and adapted a comment and an error message.
1999-10-19 17:48:54 +00:00
Jeremy Hylton 88d23309e9 print a warning if the password will be echoed.
At import time, getpass will be bound to the appropriate
platform-specific function.  If the platform's echo-disabler is not
available, default_getpass, which prints the warning, will be used
1999-10-18 22:25:22 +00:00
Guido van Rossum f8d8e07601 Fixed PR#106: winfo_visualsavailable() with the includeids=1 option
didn't properly handle the hex numbers returned.
1999-10-18 22:06:38 +00:00
Guido van Rossum dcb8583c18 Fix for PR#111: when using the inplace option, give the new file the
same permissions as the old file, plugging a security hole.
(Not using exactly the suggested bugfix.)
1999-10-18 21:41:43 +00:00
Fred Drake 14bb71d553 os.fork raises AttributeError, not NameError, if fork() isn't
supported.  Pointed out by Moshe Zadka <moshez@math.huji.ac.il>.
1999-10-18 13:43:44 +00:00
Fred Drake 40e84db0f4 Based on comments from Paul Prescod:
If os.fork() doesn't exist, raise SystemError with an explanation at
the top of the module.  Added a note to the module docstring.
1999-10-16 02:07:50 +00:00
Barry Warsaw 226ae6ca12 Mainlining the string_methods branch. See branch revision log
messages for specific changes.
1999-10-12 19:54:53 +00:00
Jeremy Hylton 75260275fe update to use threading module instead of thread. 1999-10-12 16:20:13 +00:00
Barry Warsaw 2539451fb9 fixed a typo in a docstring, and slightly expanded the module
docstring info for readfp().
1999-10-12 16:12:48 +00:00
Guido van Rossum 1b7aec35c4 Fix PR#31 -- zfill() mishandles empty string. 1999-10-11 22:15:41 +00:00
Guido van Rossum 08a92cb568 Jeremy writes:
I found the following patch helpful in tracking down a bug in some
code.  I had appended time, the module, instead of time.time().  Not
sure if it is generally true that printing the repr of the object is
good, but I expect that most unpicklable things will have fairly
information and concise reprs (like files or sockets or modules).
1999-10-10 21:14:25 +00:00
Guido van Rossum d8957d6802 Fix PR#3, submitted by Skip Montanaro: if no space appears after the
colon, the first character of the value is lost.
1999-10-06 15:19:19 +00:00
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