Commit Graph

66 Commits

Author SHA1 Message Date
Tim Peters 2c60f7a136 Whitespace normalization. 2003-01-29 03:49:43 +00:00
Tim Peters 6757c1e856 SF patch 661583: Remove old code from lib\os.py
A patch from Andrew Wilkinson to change some bizarre old exec statements
specific to NT and CE.
2003-01-08 21:20:57 +00:00
Jack Jansen b11ce9b96c Always define getenv(), as suggested by Guido. This means that os.getenv() is also defined for MacPython-OS9 (even though it doesn't actually do anything useful), and it shouldn't hurt on other platforms. 2003-01-08 16:33:40 +00:00
Martin v. Löwis 8b10f8988f Remove more DOS support. 2002-10-09 17:23:29 +00:00
Raymond Hettinger 05212fc7f3 Change UserDict to IterableUserDict 2002-09-07 04:48:03 +00:00
Raymond Hettinger ca2f537e32 Have os.environ() inherit from the iterable version of UserDict.
Closes SF bug 605731.
2002-09-06 19:36:31 +00:00
Guido van Rossum 683c0fe414 Fix for SF bug 601077 by Zack Weinberg.
The new execvpe code would sometimes do the wrong thing when a
non-executable file existed earlier in the path and an executable file
of the same name existed later in the path.  This patch restores the
proper behavior (which is to execute the second file).  When only a
non-executable file exists, the correct error is still reported.
2002-09-03 16:36:17 +00:00
Guido van Rossum aed51d8121 SF patch 590294: os._execvpe security fix (Zack Weinberg).
1) Do not attempt to exec a file which does not exist
just to find out what error the operating system
returns. This is an exploitable race on all platforms
that support symbolic links.

2) Immediately re-raise the exception if we get an
error other than errno.ENOENT or errno.ENOTDIR. This
may need to be adapted for other platforms.

(As a security issue, this should be considered for 2.1
and 2.2 as well as 2.3.)
2002-08-05 16:13:24 +00:00
Fred Drake cadb9eb8f6 Be consistent with the functions in the posix/nt module: docstrings
don't include a " -> None" for functions that have no return value.
2002-07-02 21:28:04 +00:00
Raymond Hettinger 54f0222547 SF 563203. Replaced 'has_key()' with 'in'. 2002-06-01 14:18:47 +00:00
Martin v. Löwis a066f46b9b Patch 550804: Make os.environ.copy() return a copy. 2002-05-02 17:39:19 +00:00
Tim Peters bc0e910826 Convert a pile of obvious "yes/no" functions to return bool. 2002-04-04 22:55:58 +00:00
Michael W. Hudson e5363b7de5 .... 2002-03-15 10:21:59 +00:00
Michael W. Hudson ce00b735cd Fix
[ 530236 ] os.py assumes existence of statvfs_resul

This was pretty dense of me.  Sorry.

2.2.1 candidate.
2002-03-15 10:18:58 +00:00
Michael W. Hudson 0e02530a79 Special support for pickling os.stat and os.stat_vfs results portably
(the types come from different modules on different platforms).

Added tests for pickling these types.

May be a bugfix candidate.
2002-03-06 17:11:18 +00:00
Andrew MacIntyre 5cef57131f OS/2 EMX port Library and regression test changes:
Lib/
    os.py
    os2emxpath.py   // added - OS/2 EMX specific path manipulation routines
    popen2.py
    site.py
  Lib/test/
    test_fcntl.py
    test_longexp.py
2002-02-24 05:32:32 +00:00
Tim Peters 1633a2e345 Whitespace normalization. 2001-10-30 05:56:40 +00:00
Guido van Rossum e2ae77b8b8 SF patch #474590 -- RISC OS support 2001-10-24 20:42:55 +00:00
Guido van Rossum c524d952da SF patch #460805 by Chris Gonnerman: Support for unsetenv()
This adds unsetenv to posix, and uses it in the __delitem__ method of
os.environ.

(XXX Should we change the preferred name for putenv to setenv, for
consistency?)
2001-10-19 01:31:59 +00:00
Martin v. Löwis a90f438d4a Unify _Environ processing on riscos with other platforms. 2001-03-07 09:05:45 +00:00
Skip Montanaro 81e4b1c5c8 fix typo in extending __all__ for riscos platform - closes bug 406296 2001-03-06 15:26:07 +00:00
Ka-Ping Yee feb6719851 Use r""" instead of """ for the docstring so that backslashes are preserved. 2001-03-02 23:31:43 +00:00
Guido van Rossum b7fe432a88 Fix by Donn Cave for BeOS (SF #403642):
UNIX style fork/execve/wait are not fully compatible with thread
  support on BeOS.  For Python, that means neither fork() from import
  nor import from a fork work reliably. os._execvpe() does the latter,
  importing tempfile to set up a tantalizing target for hackers. This
  patch replaces both the tempfile name generation and the exec that
  uses it, in case we're on BeOS. Need this for
  setup:distutils:execvp(); symptoms are random crashes and internal
  BeOS error messages about th name, in case we're on BeOS. It's an
  issue because setup.py + distutils calls os.execvp(); symptoms are
  random crashes during setup.py, and internal BeOS error messages
  about thread IDs.
2001-03-02 07:04:51 +00:00
Guido van Rossum d74fb6b12a RISCOS changes by dschwertberger. 2001-03-02 06:43:49 +00:00
Skip Montanaro 6c0a0e1538 added some elements missing from __all__ 2001-02-28 01:00:58 +00:00
Skip Montanaro 269b83bc05 added several more __all__ lists 2001-02-06 01:07:02 +00:00
Tim Peters 2344fae6d0 Whitespace normalization. 2001-01-15 00:50:52 +00:00
Fred Drake 20af3172ce popen4(): Added for Unix.
Fixed a typo in a docstring.
2000-09-28 19:10:56 +00:00
Guido van Rossum d9a8e96543 Only supply popen2, popen3 when fork exists.
(This avoids defining non-working versions of these on the Mac.)
2000-09-19 03:04:52 +00:00
Fred Drake 31f182e830 Added os.popen2() and os.popen3() for non-Windows platforms. 2000-08-28 17:20:05 +00:00
Fred Drake 9f2550f581 makedirs(), removedirs(): If the tail of the path is empty, do a second
split so the logic does not fail in corner cases.

This closes bug #407.
2000-07-25 15:16:40 +00:00
Thomas Wouters 7e47402264 Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").

There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
2000-07-16 12:04:32 +00:00
Guido van Rossum 868b50af17 Michael Hudson fixes a case where execv() is called (for a test) with
an empty argument list -- another patch he's checking in will make
this illegal (the first argument should always be the program name).
2000-04-26 20:32:08 +00:00
Guido van Rossum 7da3cc5dfb Michael Hudson:
I think that after this patch, all objects in the os module (with names
that don't start with "_") that can have docstrings, do, on Linux at
least.

Also fix a nit in one of my spawn* docstrings.
2000-04-25 10:53:22 +00:00
Guido van Rossum e0cd291b81 Doc strings for the spawn* functions, by Michael Hudson. 2000-04-21 18:35:36 +00:00
Guido van Rossum 965fdae40e Patch by Fred Gansevles.
This patch solves 2 problems of the os module.
1) Bug ID #50 (case-mismatch wiht "environ.get(..,..)" and "del environ[..]")
2) os.environ.update (dict) doesn't propagate changes to the 'real'
   environment (i.e doesn't call putenv)

This patches also has minor changes specific for 1.6a
The string module isn't used anymore, instead the strings own methods are
used.
2000-04-04 19:50:04 +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 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
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 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 18df5d479c Mark Hammond: patch for Windows/CE. 1999-06-11 01:37:27 +00:00
Guido van Rossum b46413f274 The case-insensitive _Environ class was lacking a case-insensitive has_key(). 1999-05-03 15:23:24 +00:00
Guido van Rossum fb801e7d33 As Finn Bock points out, _P_WAIT etc. don't have a leading underscore
so they don't need to be treated specially here.
1999-02-22 15:40:34 +00:00
Guido van Rossum 67c65b2954 Special-case _P_WAIT etc. for NT. 1999-02-01 23:52:29 +00:00
Fred Drake 0237909e42 Enable os.path as a mostly-normal submodule, including "from os.path
import isfile" and "import os.path".
1999-01-19 16:05:13 +00:00
Guido van Rossum da4d6daa4a Support case insensitive treatment of os.environ keys on Windows and
DOS (as well as OS/2).  I presume that making a call to putenv() with
a lowercase key will actually do the right thing.  I know this is so
on Windows/DOS, and I expect it is so OS/2 -- but the old OS/2 code
didn't assume this.  (I don't know if the person who provided the OS/2
patch was clueless or just didn't care about DOS and Windows.)

Also ripped out the support for pickling -- as of 1.5, this is no
longer needed to make pickling work.
1998-08-04 16:01:23 +00:00
Guido van Rossum 4def7de7c6 Add makedirs(), removedirs(), renames() -- ESR-inspired super-versions
of mkdir(), rmdir() and rename() that make or remove intermediate
directories as well.
1998-07-24 20:48:03 +00:00
Guido van Rossum e9387ea773 introduce a new platform-specific variable: os.linesep is the
platform's line separator.  \n on Unix, \r\n on DOS, OS/2 and Windows,
\r on Macs.
1998-05-22 15:26:04 +00:00
Guido van Rossum 61de0ac4bb Reindented according to new standard, without tabs.
Also added one more os2 specific piece of code, by Jeff Rush.
1997-12-05 21:24:30 +00:00
Barry Warsaw 58a88b3e34 _Environ(): Added __getinitargs__() method so os.environ.copy() works,
as does unpickling, as in: pickle.loads(pickle.dumps(os.environ)).

Hope this is right!  Don't shoot me Guido. :-)
1997-12-01 04:30:19 +00:00