Unify _Environ processing on riscos with other platforms.
authorMartin v. Löwis <martin@v.loewis.de>
Wed, 7 Mar 2001 09:05:45 +0000 (09:05 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Wed, 7 Mar 2001 09:05:45 +0000 (09:05 +0000)
Lib/os.py
Lib/plat-riscos/riscosenviron.py

index 367ea72545b785f98159dbde9439db3a2d00ddfd..64caee6efae0186c1522a5b2adbe23a927b762be 100644 (file)
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -160,7 +160,6 @@ elif 'riscos' in _names:
     import riscospath
     path = riscospath
     del riscospath
-    from riscosenviron import environ
 
     import riscos
     __all__.extend(_get_exports_list(riscos))
@@ -346,17 +345,19 @@ def _execvpe(file, args, env=None):
     raise exc, arg
 
 
-if name != "riscos":
-    # Change environ to automatically call putenv() if it exists
-    try:
-        # This will fail if there's no putenv
-        putenv
-    except NameError:
-        pass
-    else:
-        import UserDict
+# Change environ to automatically call putenv() if it exists
+try:
+    # This will fail if there's no putenv
+    putenv
+except NameError:
+    pass
+else:
+    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
         class _Environ(UserDict.UserDict):
             def __init__(self, environ):
index d44aa0a79dd791c9346f1b425c716e904fbcac5e..67c75d1daea05ac1ba6c2a805be137e9b4638834 100644 (file)
@@ -3,7 +3,7 @@
 import riscos
 
 class _Environ:
-    def __init__(self):
+    def __init__(self, initial = None):
         pass
     def __repr__(self):
         return repr(riscos.getenvdict())
@@ -43,4 +43,3 @@ class _Environ:
         else:
             return failobj
 
-environ = _Environ()