Commit Graph

88 Commits

Author SHA1 Message Date
Fredrik Lundh
96c1c7a571 SF#1343671.
The removedirs function removes empty directories, it doesn't
empty them.
2005-11-12 15:55:04 +00:00
Georg Brandl
9e43acf2f3 bug #1177468: don't cache /dev/urandom file descriptor in os.urandom 2005-07-04 17:16:07 +00:00
Martin v. Löwis
5510f65f5a Avoid using items() in environ.update(). Fixes #1124513.
Will backport to 2.4.
2005-02-17 21:23:20 +00:00
Martin v. Löwis
1d11de6dbd Revert os.py 1.75, and directly implement update.
Fixes #1110478 and #1100235.
2005-01-29 13:29:23 +00:00
Martin v. Löwis
22b457e03b Added SEEK_* constants. Fixes #711830. 2005-01-16 08:40:58 +00:00
Johannes Gijsbers
9fc9789a0d Document that on Unix, the 'cmd' argument to the os.popen2/3/4 and
popen2.popen2/3/4 functions can be a sequence. All texts are a variation on the
following:

On \UNIX, \var{cmd} may be a sequence, in which case arguments will be passed
directly to the program without shell intervention (as with
\function{os.spawnv()}). If \var{cmd} is a string it will be passed to the shell
(as with \function{os.system()}).
2004-10-11 18:12:20 +00:00
Martin v. Löwis
725f8c83a2 Patch #1021596: Check for None to determine whether _urandomfd is
uninitialized.
2004-09-18 16:07:58 +00:00
Tim Peters
3b2cdad4fd Whitespace normalization. 2004-09-01 13:10:32 +00:00
Andrew M. Kuchling
33ad28b68d Use multi-line import 2004-08-31 11:38:12 +00:00
Tim Peters
45e77c55ff Whitespace normalization. 2004-08-29 18:47:31 +00:00
Martin v. Löwis
dc3883f671 Patch #934711: Expose platform-specific entropy. 2004-08-29 15:46:35 +00:00
Martin v. Löwis
bdec50f027 Feature request #935915: Add os.path.devnull. 2004-06-08 08:29:33 +00:00
Andrew MacIntyre
69e18c9344 OS/2 has support for spawnvp() and spawnvpe() in the C libraries supplied
with major C compilers (VACPP, EMX+gcc and [Open]Watcom).

Also tidy up the export of spawn*() symbols in the os module to match what
is found/implemented.
2004-04-04 07:11:43 +00:00
Raymond Hettinger
31017aed36 SF #904720: dict.update should take a 2-tuple sequence like dict.__init_
(Championed by Bob Ippolito.)

The update() method for mappings now accepts all the same argument forms
as the dict() constructor.  This includes item lists and/or keyword
arguments.
2004-03-04 08:25:44 +00:00
Andrew M. Kuchling
6fccc8a9ec [Bug #829532] Invoking os.makedirs() with an argument that contains a
directory name with a single dot fails.  The patch skips creating
    directories named os.curdir. (Patch by Bram Moolenaar)

2.3 bugfix candidate.
2003-12-23 16:33:28 +00:00
Andrew MacIntyre
89f9865b91 OS/2+EMX: make the link() emulation available as os.link() 2003-12-02 12:33:01 +00:00
Neal Norwitz
b7f6810a1f SF #764121, docstring for spawnlp incorrect 2003-07-02 02:49:33 +00:00
Guido van Rossum
bf1bef820c Add optional 'onerror' argument to os.walk(), to control error
handling.
2003-05-13 18:01:19 +00:00
Tim Peters
c4e0940042 New generator os.walk() does a bit more than os.path.walk() does, and
seems much easier to use.  Code, docs, NEWS, and additions to test_os.py
(testing this sucker is a bitch!).
2003-04-25 07:11:48 +00:00
Guido van Rossum
68468eba63 Get rid of many apply() calls. 2003-02-27 20:14:51 +00:00
Tim Peters
f2715e0764 Whitespace normalization. 2003-02-19 02:35:07 +00:00
Skip Montanaro
117910dc44 Migrate definitions of several platform-dependent path-related variables
into the relevant path modules.  See patch #686397.
2003-02-14 19:35:31 +00:00
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