Commit Graph

62 Commits

Author SHA1 Message Date
Andrew M. Kuchling df66df0a28 Patch #407434: add rfc822_escape utility function 2001-03-22 03:03:41 +00:00
Andrew M. Kuchling 83c158fdc9 Bug #229280: remove '/' characters from the OS name (for BSD/OS :) ) 2001-02-27 19:25:42 +00:00
Andrew M. Kuchling 9767e76808 Patch #404275: generate a reasonable platform string for AIX 2001-02-27 18:48:00 +00:00
Jack Jansen b4cd5c1a3a Remove single "." components from pathnames, and return os.curdir if
the resulting path is empty.
2001-01-28 12:23:32 +00:00
Jeremy Hylton 5e2d0764cd In subst_vars(), change the name of the argument from str to s to
prevent binding for str from masking use of builtin str in nested
function.

(This is the only case I found in the standard library where a local
shadows a global or builtin.  There may be others, but the regression
test doesn't catch them.)
2001-01-25 20:10:32 +00:00
Andrew M. Kuchling 989835c9fc Patch #103220 from Jason Tishler:
This patch adds support for Cygwin to util.get_platform(). A Cygwin
  specific case is needed due to the format of Cygwin's uname command,
  which contains '/' characters.
2001-01-19 16:26:12 +00:00
Greg Ward 047c3723d0 Removed debugging code at bottom. 2000-10-14 04:07:39 +00:00
Greg Ward 9216cfe7ba Added a long-winded comment (and commented-out comment to go with out)
about how it would be nice to write absolute paths to the temporary
byte-compilation script, but this doesn't work because it screws up the
trailing-slash trickery done to 'prefix' in build_py's 'byte_compile()'
method.

Fixed to use 'execute()' instead of 'os.remove()' to remove the temporary
script: now it doesn't blow up in dry-run mode!
2000-10-03 03:31:05 +00:00
Greg Ward 04cc88df05 Remove the temporary byte-compilation script when we're done with it. 2000-10-02 02:09:55 +00:00
Greg Ward f217e2124a Tweaked 'byte_compile()' so it silently skips non-Python files, rather than
blowing up.
2000-10-01 23:49:30 +00:00
Greg Ward 1297b5ce67 Added 'byte_compile(): an all-singing, all-dancing wrapper around the
standard 'py_compile.compile()' function.  Laundry list of features:
  - handles standard Distutils 'force', 'verbose', 'dry_run' flags
  - handles various levels of optimization: can compile directly in
    this interpreter process, or write a temporary script that is
    then executed by a new interpreter with the appropriate flags
  - can rewrite the source filename by stripping an optional prefix
    and preprending an optional base dir.
2000-09-30 20:37:56 +00:00
Greg Ward 4752769d08 Various docstring tweaks.
Fixed 'subst_vars()' so it actually blows up like the docstring claims
  (and fixed the docstring not to claim it handles ${var}, which it
  doesn't).
2000-09-30 18:49:14 +00:00
Greg Ward b8b263b92f Reformat docstrings. 2000-09-30 18:40:42 +00:00
Greg Ward ec84c21ce2 In 'get_platform()', handle so-called POSIX systems that don't have
'uname()' -- specifically NeXTSTEP.
2000-09-30 17:09:39 +00:00
Greg Ward be86bdea73 Standardize whitespace in function calls. 2000-09-26 01:56:15 +00:00
Greg Ward 817dc098ef Added 'strtobool()' function: convert strings like "yes", "1",
"no", "0", etc. to true/false.
2000-09-25 01:25:06 +00:00
Greg Ward 7ec053544c Fix 'convert_path()' so it returns immediately under Unix -- prevents blowing
up when the pathname starts with '/', which is needed when converting
installation directories in the "install" command.
2000-09-22 01:05:43 +00:00
Greg Ward f5855746fe Corran Webster: fix 'change_root()' to handle Mac OS paths. 2000-09-21 01:23:35 +00:00
Greg Ward 59399bb303 Revamped 'get_platform()' to try and do something reasonably smart on
POSIX platforms, ie. get a little more detail than 'sys.platform' gives.
2000-09-15 01:16:14 +00:00
Greg Ward 2b042ded19 Fix so 'split_quoted()' handles any whitespace delimiter (not just space). 2000-08-08 14:38:13 +00:00
Greg Ward 5a8aa1ba2e Drop the 'extend()' function -- old 1.5.1 compatibility hack that
wasn't actually used anywhere.
Drop the "from xxx_util import*" backwards compability hacks.
2000-08-05 01:25:24 +00:00
Greg Ward 1c16ac360a Added the 'execute()' function (moved here from cmd.py with minor tweakage). 2000-08-02 01:37:30 +00:00
Greg Ward bb56190422 Ditched 'abspath()' -- don't need 1.5.1 compatability hacks anymore. 2000-08-02 00:37:32 +00:00
Greg Ward 612eb9f58f Fixed a grab-bag of typos spotted by Rob Hooft. 2000-07-27 02:13:20 +00:00
Jeremy Hylton a05e293a21 typos fixed by Rob Hooft 2000-06-28 14:48:01 +00:00
Greg Ward 6a2a3dbec5 Added 'split_quoted()' function to deal with strings that are quoted in
Unix shell-like syntax (eg. in Python's Makefile, for one thing -- now that
I have this function, I'll probably allow quoted strings in config files too.
2000-06-24 20:40:02 +00:00
Greg Ward b75c485f0b 'get_platform()' now just returns 'sys.platform' on all platforms. 2000-06-18 15:45:55 +00:00
Greg Ward e905513be0 Added 'grok_environment_error()' function to deal with the various
forms that IOError and OSError can take (taken from core.py).
2000-06-17 02:16:46 +00:00
Greg Ward d8dfb4c4b8 Renamed 'native_path()' to 'convert_path()'.
Also changed it so it doesn't barf if the path is already in native format
  (ie. contains os.sep).
2000-05-31 02:32:10 +00:00
Greg Ward 4b46ef9a4f Fixed 'change_root() to work at all on Windows, and to work correctly on Unix. 2000-05-31 02:14:32 +00:00
Gregory P. Smith e7e35ac1c2 Made 'check_environ()' "public" by stripping the leading underscore;
added a global '_environ_checked' so we know if it's already been
called.
2000-05-12 00:40:00 +00:00
Greg Ward 67f75d4bcb Added 'change_root()' to forcibly slap a new root directory onto a pathname,
even if it's already absolute.  Currently only implemented for Unix; I'm
not entirely sure of the right thing to do for DOS/Windows, and have no
clue what to do for Mac OS.
2000-04-27 01:53:46 +00:00
Greg Ward 464023fb64 Lyle Johnson: fixed broken logic in 'native_path()'. 2000-04-25 01:33:11 +00:00
Greg Ward aa458bc465 Merged in Python 1.5.1 compatibility changes from the 0.1.3 branch:
added 'abspath()' and 'extend()'.
2000-04-22 15:14:58 +00:00
Greg Ward 02a1a2b077 Cleaned up/simplified error-handling:
- DistutilsOptionError is now documented as it's actually used, ie.
    to indicate bogus option values (usually user options, eg. from
    the command-line)
  - added DistutilsSetupError to indicate errors that definitely arise
    in the setup script
  - got rid of DistutilsValueError, and changed all usage of it to
    either DistutilsSetupError or ValueError as appropriate
  - simplified a bunch of option get/set methods in Command and
    Distribution classes -- just pass on AttributeError most of
    the time, rather than turning it into something else
2000-04-15 22:15:07 +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 1889de8889 Fixed 'make_archive()' to explicitly turn of compression when format is "tar". 2000-03-31 05:20:27 +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 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 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 a7540bd043 Import fix. 2000-03-23 04:39:16 +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 b98fe36c46 Patch from Bastian Kleineidam <calvin@cs.uni-sb.de>: added 'remove_tree()'. 2000-03-18 15:42:22 +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 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 9552665436 Rewrote 'newer_pairwise(): more natural (and incompatible) interface,
simpler implementation.
2000-03-06 03:44:32 +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