mirror of https://github.com/python/cpython
Unify _Environ processing on riscos with other platforms.
This commit is contained in:
parent
1d79f79bd0
commit
a90f438d4a
23
Lib/os.py
23
Lib/os.py
|
@ -160,7 +160,6 @@ elif 'riscos' in _names:
|
||||||
import riscospath
|
import riscospath
|
||||||
path = riscospath
|
path = riscospath
|
||||||
del riscospath
|
del riscospath
|
||||||
from riscosenviron import environ
|
|
||||||
|
|
||||||
import riscos
|
import riscos
|
||||||
__all__.extend(_get_exports_list(riscos))
|
__all__.extend(_get_exports_list(riscos))
|
||||||
|
@ -346,17 +345,19 @@ def _execvpe(file, args, env=None):
|
||||||
raise exc, arg
|
raise exc, arg
|
||||||
|
|
||||||
|
|
||||||
if name != "riscos":
|
# Change environ to automatically call putenv() if it exists
|
||||||
# Change environ to automatically call putenv() if it exists
|
try:
|
||||||
try:
|
# This will fail if there's no putenv
|
||||||
# This will fail if there's no putenv
|
putenv
|
||||||
putenv
|
except NameError:
|
||||||
except NameError:
|
pass
|
||||||
pass
|
else:
|
||||||
else:
|
import UserDict
|
||||||
import UserDict
|
|
||||||
|
|
||||||
if name in ('os2', 'nt', 'dos'): # Where Env Var Names Must Be UPPERCASE
|
if name == "riscos":
|
||||||
|
# On RISC OS, all env access goes through getenv and putenv
|
||||||
|
from riscosenviron import _Environ
|
||||||
|
elif name in ('os2', 'nt', 'dos'): # Where Env Var Names Must Be UPPERCASE
|
||||||
# But we store them as upper case
|
# But we store them as upper case
|
||||||
class _Environ(UserDict.UserDict):
|
class _Environ(UserDict.UserDict):
|
||||||
def __init__(self, environ):
|
def __init__(self, environ):
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import riscos
|
import riscos
|
||||||
|
|
||||||
class _Environ:
|
class _Environ:
|
||||||
def __init__(self):
|
def __init__(self, initial = None):
|
||||||
pass
|
pass
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return repr(riscos.getenvdict())
|
return repr(riscos.getenvdict())
|
||||||
|
@ -43,4 +43,3 @@ class _Environ:
|
||||||
else:
|
else:
|
||||||
return failobj
|
return failobj
|
||||||
|
|
||||||
environ = _Environ()
|
|
||||||
|
|
Loading…
Reference in New Issue