Fix bug reported by atkins@gweep.net; re.compile(r"[\100-\410]")
dumps core. Solution: fix check_escape() to match its comment and
use only the low 8 bits of the octal number.
Greg Ward [Thu, 1 Jun 2000 00:40:25 +0000 (00:40 +0000)]
More tweaking to make this command act like other Distutils commands:
* added "--bdist-base" option to parameterize where we build
the RPM (comes from "bdist" by default: "build/bdist.<plat>")
* simplified/cleaned up some code in 'run()' in the process of
removing (most) hard-coded directory names
* if "--spec-only", drop spec file in "dist" rather than "redhat"
(directory name still hard-coded, though)
* use 'reinitialize_command()' to fetch the "sdist" object to
tweak before running "sdist" command
* use 'self.copy_file()' method rather than 'copy_file()' function
* cosmetic tweaks to comments, error messages
Greg Ward [Wed, 31 May 2000 23:56:45 +0000 (23:56 +0000)]
Regularize options a bit:
* help strings start with lowercase
* added affirmative version of '--no-clean' and '--no-rpm-opt-flags',
which are the default (thus the attributes that correspond to
the options are now 'clean' and 'use_rpm_opt_flags')
Greg Ward [Wed, 31 May 2000 01:09:52 +0000 (01:09 +0000)]
Overhauled to expect 'self.extensions' (taken from 'ext_modules' in the
setup script) to be a list of Extension instances, rather than a list of of
(ext_name, build_info) tuples. This is mostly a simplification, but
'check_extension_list()' got a lot more complicated because of the need to
convert the old-style tuples to Extension instances.
Temporarily dropped support for defining/undefining macros in the
'extensions' list -- I want to change the interface, but haven't yet made
the required changes in CCompiler and friends to support this nicely.
Also neatened up the code that merges 'extra_compile_flags' and the CFLAGS
environment variable.
Greg Ward [Sun, 28 May 2000 23:53:06 +0000 (23:53 +0000)]
Factored '_set_command_options()' out of 'get_command_obj()'.
Added 'reinitialize_command()' -- lets us "push" option values in
a controlled, safe way; this is a small change to the code, but
a big change to the Distutils philosophy of passing option values
around. The preferred mode is still definitely to "pull" options
from another command (eg. "install" fetches the base build directory
from "build"), but it is now feasible to "push" options onto another
command, when you know what's best for it. One possible application
will be a "config" command, which pokes around the system and pushes
values (eg. include and library directories) onto the "build" command.
Added 'dump_option_dicts()' method (for debugging output).
Greg Ward [Sat, 27 May 2000 17:27:23 +0000 (17:27 +0000)]
Some far-reaching naming changes:
* Command method 'find_peer()' -> 'get_finalized_command()'
* Command method 'run_peer()' -> 'run_command()'
Also deleted the 'get_command_option()' method from Command, and
fixed the one place where it was used (in "bdist_dumb").
Greg Ward [Sat, 27 May 2000 03:03:23 +0000 (03:03 +0000)]
Patch from Andrew Kuchling: prune out the build and source distribution
directories after all is said and done, so we don't accidentally include
those files in the source distribution.
(This is the quick and easy way to fix this; Andrew says: "Changing
findall() looked like it was going to be messy, so I tried this instead.
The only problem is that redundant directory traversals are being done,
walking through build/ only to throw out all the files found at the end.").
Greg Ward [Sat, 27 May 2000 01:35:27 +0000 (01:35 +0000)]
'mkpath()' now detects non-string 'name' arguments -- this is a fairly common
bug when adding new code, so I thought I'd make it blow up earlier
than deep in posix.py.
Greg Ward [Sat, 27 May 2000 01:33:12 +0000 (01:33 +0000)]
Support for the "install_headers" command:
* 'headers' entry added to all the install schemes
* '--install-headers' option added
* 'install_headers' added to 'sub_commands'
* added 'dist_name' to configuration variables (along with a few
others that seem handy: 'dist_version', 'dist_fullname', and
'py_version'
* in 'finalize_unix()', make sure 'install_headers' defined if
user specified 'install_base' and/or 'install_platbase'
* added 'has_headers()'
* a few other small changes
Jeremy Hylton [Fri, 26 May 2000 21:49:07 +0000 (21:49 +0000)]
Patch from M.-A. Lemburg:
Python on UNIX now trusts PYTHONHOME unconditionally
Modules/getpath.c:
Landmark changed to os.py.
Setting PYTHONHOME now unconditionally sets sys.prefix
(and sys.exec_prefix). No further checks are done whether the
standard lib can be found in that location or not. This is in
sync with the PC subdir getpath implementations.
PC/getpathp.c:
Landmark changed to os.py.
PC/os2vacpp/getpathp.c:
Landmark changed to os.py.
Note: BAW's checkin on exceptions.c eliminates earlier concerns about
a bogus PYTHONHOME value leading to a core dump. Instead it causes a
useless sys.path and prevents imports.
Fred Drake [Fri, 26 May 2000 19:32:14 +0000 (19:32 +0000)]
Added documentation for gettempprefix().
Deprecated direct access to template.
Added note about past need to modify template so that legacy code has a
better chance of being understood, noting that the requirement to reset
template after os.fork() disappeared in 1.5.2.
Fred Drake [Fri, 26 May 2000 19:05:16 +0000 (19:05 +0000)]
Added documentation for TemporaryFile() and the siffix parameter to mktemp().
Removed obsolete comments about this module not creating or removing actual
files.
Removed obsolete comment about users needing to set template to None after
calling os.fork().
Greg Ward [Fri, 26 May 2000 12:22:54 +0000 (12:22 +0000)]
When building on Solaris and the compiler is GCC, use '$(CC) -G' to
create shared extensions rather than 'ld -G'. This ensures that shared
extensions link against libgcc.a, in case there are any functions in the
GCC runtime not already in the Python core.
Fred Drake [Fri, 26 May 2000 04:08:37 +0000 (04:08 +0000)]
Piers Lauder <piers@cs.su.oz.au>:
I've added an extra comment about quoting arguments to
IMAP4 commands. Also changed the command descriptions
to show optional extra commands where appropriate.
Fred Drake:
Added example usage for the search() method based on comments from
<Lucas.DeJonge@awtpl.com.au>; elaborated error handling information
when arguments are missing from search() and uid().
Greg Ward [Fri, 26 May 2000 01:31:53 +0000 (01:31 +0000)]
Rene Liebscher: check if the extension file (.so or .pyd) is
up-to-date with respect to the source files; that way, we
don't needlessly rebuild just because object files go away.
Greg Ward [Fri, 26 May 2000 01:00:15 +0000 (01:00 +0000)]
Factored out code for extracting-or-creating one of the option
dictionaries in 'self.command_options' to 'get_option_dict()'.
Simplified code in 'parse_config_files()' and 'parse_command_line()'
accordingly.
Fixed code in constructor that processes the 'options' dictionary
from the setup script so it actually works: uses the new
'self.command_options' dictionary rather than creating command
objects and calling 'set_option()' on them.
Greg Ward [Fri, 26 May 2000 00:54:52 +0000 (00:54 +0000)]
Added the DEBUG global (set from the DISTUTILS_DEBUG environment variable).
Changed the exception-handling code in 'setup()' to re-raise exceptions
if DEBUG is true.
Greg Ward [Fri, 26 May 2000 00:44:06 +0000 (00:44 +0000)]
Fixed a couple of long-hidden bugs (amazing what you find when you
attempt to verify the bold assertions in the documentation):
* entries for the "root package" in 'package_dir' didn't work --
fixed by improving the fall-through code in 'get_package_dir()'
* __init__.py files weren't installed when modules-in-packages
were listed individually (ie. in 'py_modules' in the setup script);
fixed by making 'check_package()' return the name of the __init__
file if it exists, and making 'find_modules()' add an entry to
the module list for __init__ if applicable
Barry Warsaw [Thu, 25 May 2000 23:15:05 +0000 (23:15 +0000)]
All the exception building related stuff has been moved out of this
module and into _exceptions.c. This includes all the PyExc_* globals,
the bltin_exc table, init_class_exc(), fini_instances(),
finierrors().
Renamed _PyBuiltin_Init_1() to _PyBuiltin_Init() since the two phase
initializations are necessary any more.
Removed as obsolete _PyBuiltin_Init_2(), _PyBuiltin_Fini_1() and
_PyBuiltin_Fini_2().
Barry Warsaw [Thu, 25 May 2000 23:09:49 +0000 (23:09 +0000)]
Py_Initialize(): Now that standard exceptions are builtin, we don't
need two phase init or fini of the builtin module. Change the call of
_PyBuiltin_Init_1() to _PyBuiltin_Init(). Add a call to
init_exceptions().
Py_Finalize(): Don't call _PyBuiltin_Fini_1(). Instead call
fini_exceptions() but move this to before the thread state is
cleared.
Fred Drake [Thu, 25 May 2000 03:25:26 +0000 (03:25 +0000)]
Piers Lauder <piers@cs.su.oz.au>:
This patch adds a comment about quoting to the doc string,
and also checks that the 'flags' argument to the STORE command
is appropriately enclosed inside parentheses to avoid quoting.
Greg Ward [Thu, 25 May 2000 02:03:56 +0000 (02:03 +0000)]
Improvements to Bastian's build_scripts command:
* 'first_line_re' loosened up
* command description improved
* replaced '_copy_files()' and '_adjust_files()' with one method
that does everything, 'copy_scripts()' -- this should be more
efficient than Bastian's version, should behave better in
dry-run mode, and does timestamp dependency-checking
Greg Ward [Thu, 25 May 2000 01:19:18 +0000 (01:19 +0000)]
Bastian Kleineidam: the "build_scripts" command and changes
necessary to support it.
Details:
- build command additionally calls build_scripts
- build_scripts builds your scripts in 'build/scripts' and adjusts the
first line if it begins with "#!" and ends with "python", optionally
ending with commandline options (like -O, -t ...). Adjusting means we
write the current path to the Python interpreter in the first line.
- install_scripts copies the scripts to the install_scripts dir
- install_data copies your data_files in install_data. You can
supply individual directories for your data_files:
data_files = ['doc/info.txt', # copy this file in install_scripts dir
('testdata', ['a.dat', 'b.dat']), # copy these files in
# install_scripts/testdata
('/etc', ['packagerc']), # copy this in /etc. When --root is
# given, copy this in rootdir/etc
]
So you can use the --root option with absolute data paths.
Guido van Rossum [Wed, 24 May 2000 13:21:46 +0000 (13:21 +0000)]
Fix a problem reported by Oleg Broytmann, who complains that very
often, ftp URLs hang in the final close. Further analysis suggests
that this is because the close hook in addclosehook() calls the hook
before acually closing the connection. The hook, in this case, waits
for the '226 Transfer complete' status from the server on the command
socket. However, more and more ftp servers only send this status when
the data socket has actually been closed -- causing a deadlock.
The fix is simple: in addclosehook.close(), call addbase.close()
*before* calling the closehook.
Greg Ward [Tue, 23 May 2000 23:14:00 +0000 (23:14 +0000)]
Catch failure to open installed Makefile, and report it as a
DistutilsPlatformError: "invalid Python installation". (This will
happen on Red Hat-ish systems where the python-devel package is not
installed.)
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Lots of typo fixes (a bit too much cut-and-paste in this module)
Aliases removed: attr_on, attr_off, attr_set
Lowercased the names COLOR_PAIR and PAIR_NUMBER
#ifdef's for compiling on Solaris added (need to understand SYSV curses
versions better and generalize this)
Bumped version number bumped to 1.6
Barry Warsaw [Tue, 23 May 2000 05:47:43 +0000 (05:47 +0000)]
(py-execute-region): Based on suggestions by Francois Pinard and Skip
Montanaro, handle execution of indented regions by inserting an "if
1:" in front of the block. This better preserves things like triple
quoted strings and commented regions. This patch resolves PR#264.
Greg Ward [Tue, 23 May 2000 04:11:14 +0000 (04:11 +0000)]
Fix 'get_command_obj()' so it checks if a command object has an attribute
before setting it -- this will catch bad options (eg. typos) in config files.
Greg Ward [Tue, 23 May 2000 03:54:16 +0000 (03:54 +0000)]
Added some debuging output (actually moved here from dist.py) --
dump the Distribution's 'command_options' dict after parsing config files,
and then after parsing the command line.
Greg Ward [Tue, 23 May 2000 03:47:35 +0000 (03:47 +0000)]
Fixed so options from config files and command lines actually work:
* 'get_command_obj()' now sets command attributes based on
the 'command_options' dictionary
* some typos fixed
* kludged 'parse_config_files()' to re-initialize the ConfigParser
instance after each file, so we know for sure which config
file each option comes form
* added lots of handy debugging output
Greg Ward [Tue, 23 May 2000 01:44:20 +0000 (01:44 +0000)]
OptionDummy now has a constructor that takes a list of options: each string
in the option list is an attribute of the OptionDummy that will be
initialized to None.
Greg Ward [Tue, 23 May 2000 01:42:17 +0000 (01:42 +0000)]
Marching towards full support of config files: thoroughly overhauled the
command-line parsing code, splitting it up into several methods (new
methods: '_parse_command_opts()', '_show_help()') and making it put options
into the 'command_options' dictionary rather than instantiating command
objects and putting them there.
Lots of other little changes:
* merged 'find_command_class()' and 'create_command_obj()' and
called the result 'get_command_class()'
* renamed 'find_command_obj()' to 'get_command_obj()', and added
command object creation and maintenance of the command object cache to
its responsibilities (taken over from 'create_command_obj()')
* parse config files one-at-a-time, so we can keep track of the
filename for later error reporting
* tweaked some help messages
* fixed up many obsolete comments and docstrings
Guido van Rossum [Sun, 21 May 2000 16:25:29 +0000 (16:25 +0000)]
Changed list_directory() somewhat. It is now only called when there
is no index.htm[l] file, and when it is called, it also spits out the
headers. When an index.htm[l] file is present, the regular (file
access) path is followed. Also, when the guessed content-type matches
text/*, open the file in text mode; otherwise in binary mode.
Greg Ward [Sat, 20 May 2000 15:17:09 +0000 (15:17 +0000)]
Changed the semantics of the 'sub_commands' list: instead of function
objects, it now has method names.
Added three methods, 'has_lib()', 'has_scripts()', and 'has_data()'
to determine if we need to run each of the three possible sub-commands.
Added 'get_sub_commands()' to take care of finding the methods named
in 'sub_commands', running them, and interpreting the results to
build a list of sub-commands that actually have to be run.
Greg Ward [Sat, 20 May 2000 15:08:57 +0000 (15:08 +0000)]
Check if the claimed build directory doesn't exist, and warn that we don't
have any Python modules to install (rather than bomb when we try to copy
a non-existent directory).