summaryrefslogtreecommitdiffstats
path: root/Lib/os.py
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2001-02-06 01:07:02 (GMT)
committerSkip Montanaro <skip@pobox.com>2001-02-06 01:07:02 (GMT)
commit269b83bc05452f4f54fa9df5a76608f88da544fe (patch)
tree3463eb160b6a7a04a8a1a9aebc79075d9390f91e /Lib/os.py
parent46fa39ab1d1e2f14c1b44c5e81c34c5f6cfb9a58 (diff)
downloadcpython-269b83bc05452f4f54fa9df5a76608f88da544fe.zip
cpython-269b83bc05452f4f54fa9df5a76608f88da544fe.tar.gz
cpython-269b83bc05452f4f54fa9df5a76608f88da544fe.tar.bz2
added several more __all__ lists
Diffstat (limited to 'Lib/os.py')
-rw-r--r--Lib/os.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/Lib/os.py b/Lib/os.py
index 0ccdad2..1583323 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -19,12 +19,22 @@ and opendir), and leave all pathname manipulation to os.path
(e.g., split and join).
"""
+#'
+
import sys
_names = sys.builtin_module_names
altsep = None
+__all__ = []
+
+def _get_exports_list(module):
+ try:
+ return list(module.__all__)
+ except AttributeError:
+ return [n for n in dir(module) if n[0] != '_']
+
if 'posix' in _names:
name = 'posix'
linesep = '\n'
@@ -38,6 +48,11 @@ if 'posix' in _names:
import posixpath
path = posixpath
del posixpath
+
+ import posix
+ __all__.extend(_get_exports_list(posix))
+ del posix
+
elif 'nt' in _names:
name = 'nt'
linesep = '\r\n'
@@ -52,6 +67,11 @@ elif 'nt' in _names:
import ntpath
path = ntpath
del ntpath
+
+ import nt
+ __all__.extend(_get_exports_list(nt))
+ del nt
+
elif 'dos' in _names:
name = 'dos'
linesep = '\r\n'
@@ -65,6 +85,11 @@ elif 'dos' in _names:
import dospath
path = dospath
del dospath
+
+ import dos
+ __all__.extend(_get_exports_list(dos))
+ del dos
+
elif 'os2' in _names:
name = 'os2'
linesep = '\r\n'
@@ -78,6 +103,11 @@ elif 'os2' in _names:
import ntpath
path = ntpath
del ntpath
+
+ import os2
+ __all__.extend(_get_exports_list(os2))
+ del os2
+
elif 'mac' in _names:
name = 'mac'
linesep = '\r'
@@ -91,6 +121,11 @@ elif 'mac' in _names:
import macpath
path = macpath
del macpath
+
+ import mac
+ __all__.extend(_get_exports_list(mac))
+ del mac
+
elif 'ce' in _names:
name = 'ce'
linesep = '\r\n'
@@ -106,13 +141,22 @@ elif 'ce' in _names:
import ntpath
path = ntpath
del ntpath
+
+ import ce
+ __all__.extend(_get_exports_list(ce))
+ del ce
+
else:
raise ImportError, 'no os specific module found'
+__all__.append("path")
+
del _names
sys.modules['os.path'] = path
+#'
+
# Super directory utilities.
# (Inspired by Eric Raymond; the doc strings are mostly his)
@@ -180,6 +224,8 @@ def renames(old, new):
except error:
pass
+__all__.extend(["makedirs", "removedirs", "renames"])
+
# Make sure os.environ exists, at least
try:
environ
@@ -234,6 +280,8 @@ def execvpe(file, args, env):
args may be a list or tuple of strings. """
_execvpe(file, args, env)
+__all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"])
+
_notfound = None
def _execvpe(file, args, env=None):
if env is not None:
@@ -319,6 +367,7 @@ def getenv(key, default=None):
The optional second argument can specify an alternate default."""
return environ.get(key, default)
+__all__.append("getenv")
def _exists(name):
try:
@@ -454,6 +503,10 @@ otherwise return -SIG, where SIG is the signal that killed it. """
return spawnvpe(mode, file, args[:-1], env)
+ __all__.extend(["spawnlp","spawnlpe","spawnv", "spawnve","spawnvp",
+ "spawnvpe","spawnl","spawnle",])
+
+
# Supply popen2 etc. (for Unix)
if _exists("fork"):
if not _exists("popen2"):
@@ -461,15 +514,18 @@ if _exists("fork"):
import popen2
stdout, stdin = popen2.popen2(cmd, bufsize)
return stdin, stdout
+ __all__.append("popen2")
if not _exists("popen3"):
def popen3(cmd, mode="t", bufsize=-1):
import popen2
stdout, stdin, stderr = popen2.popen3(cmd, bufsize)
return stdin, stdout, stderr
+ __all__.append("popen3")
if not _exists("popen4"):
def popen4(cmd, mode="t", bufsize=-1):
import popen2
stdout, stdin = popen2.popen4(cmd, bufsize)
return stdin, stdout
+ __all__.append("popen4")