* 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.
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.
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
* 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)
* 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
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!)
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
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)
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.
*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.
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.
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.
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
# 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]
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).
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).
'--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).
* "--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
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.
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.]
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.
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()'.
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.
consistency with 'build_ext' command option.
Changed 'compile()' and 'link_shared_object()' so 'include_dirs',
'libraries', and 'library_dirs' can be lists or tuples.
'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.
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.
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.
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()'
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
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.
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().
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"!
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
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).
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.
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.
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.
- 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.)
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.
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.