python: use os.environ[] instead of os.putenv()
authorAndrew Tridgell <tridge@samba.org>
Mon, 21 Feb 2011 05:46:58 +0000 (16:46 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 22 Feb 2011 01:51:10 +0000 (02:51 +0100)
using os.putenv() causes too much confusion, as it doesn't update
os.getenv()

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

buildtools/wafsamba/wafsamba.py
lib/tdb/wscript
script/autobuild.py
script/land.py
source4/lib/ldb/wscript
source4/scripting/bin/samba_dnsupdate
source4/scripting/bin/samba_spnupdate
wintest/wintest.py

index 8c4296605741d84104648f17d1b4fd9ecf9aad95..ebe8fba1f7ba7357b1a41c4e5bb140a1ae80e4b4 100644 (file)
@@ -37,7 +37,7 @@ if os.environ.get('WAF_NOTHREADS') == '1':
 
 LIB_PATH="shared"
 
-os.putenv('PYTHONUNBUFFERED', '1')
+os.environ['PYTHONUNBUFFERED'] = '1'
 
 
 if Constants.HEXVERSION < 0x105019:
index d20c93893cfd960a1127cbef9a0e40f6580bb337..f704bc79aadaaf9618538a6e2c0302b3359de5e5 100644 (file)
@@ -119,7 +119,7 @@ def test(ctx):
     test_prefix = "%s/st" % (Utils.g_module.blddir)
     shutil.rmtree(test_prefix, ignore_errors=True)
     os.makedirs(test_prefix)
-    os.putenv('TEST_DATA_PREFIX', test_prefix)
+    os.environ['TEST_DATA_PREFIX'] = test_prefix
     cmd = os.path.join(Utils.g_module.blddir, 'tdbtorture')
     ret = samba_utils.RUN_COMMAND(cmd)
     print("testsuite returned %d" % ret)
index b02928574a5e18908f8fa3c71ae1ead856baa361..c6e965e69e055cdbc704e17b6e92d7a49c377d47 100755 (executable)
@@ -14,7 +14,7 @@ samba_master_ssh = os.getenv('SAMBA_MASTER_SSH', 'git+ssh://git.samba.org/data/g
 
 cleanup_list = []
 
-os.putenv('CC', "ccache gcc")
+os.environ['CC'] = "ccache gcc"
 
 builddirs = {
     "samba3"  : "source3",
index 4b7d1cacba324c4c9a7867e95cea4ac846fe5a23..f8ae7b4493d9f56389aa083e147a3f9c2982eb5f 100755 (executable)
@@ -26,7 +26,7 @@ samba_master_ssh = os.getenv('SAMBA_MASTER_SSH', 'git+ssh://git.samba.org/data/g
 
 cleanup_list = []
 
-os.putenv('CC', "ccache gcc")
+os.environ['CC'] = "ccache gcc"
 
 tasks = {
     "source3" : [ ("autogen", "./autogen.sh", "text/plain"),
index a0b92d57d60633fee18bd44f2681168f28303801..f31f3dd29d1b1e6c898cb03cc9cf875c39bc7289 100755 (executable)
@@ -252,7 +252,7 @@ def test(ctx):
     test_prefix = "%s/st" % (Utils.g_module.blddir)
     shutil.rmtree(test_prefix, ignore_errors=True)
     os.makedirs(test_prefix)
-    os.putenv('TEST_DATA_PREFIX', test_prefix)
+    os.environ['TEST_DATA_PREFIX'] = test_prefix
     cmd = 'tests/test-tdb.sh'
     ret = samba_utils.RUN_COMMAND(cmd)
     print("testsuite returned %d" % ret)
index cacdc36194f7e06be26c7808c61f560b8a52f335..99f898e2044d52dbed4dcaecffd87d41f5f7690a 100755 (executable)
@@ -26,13 +26,13 @@ import subprocess
 
 # ensure we get messages out immediately, so they get in the samba logs,
 # and don't get swallowed by a timeout
-os.putenv('PYTHONUNBUFFERED', '1')
+os.environ['PYTHONUNBUFFERED'] = '1'
 
 # forcing GMT avoids a problem in some timezones with kerberos. Both MIT
 # heimdal can get mutual authentication errors due to the 24 second difference
 # between UTC and GMT when using some zone files (eg. the PDT zone from
 # the US)
-os.putenv("TZ", "GMT")
+os.environ["TZ"] = "GMT"
 
 # Find right directory when running from source tree
 sys.path.insert(0, "bin/python")
@@ -259,7 +259,7 @@ def call_nsupdate(d):
     f.write("send\n")
     f.close()
 
-    os.putenv("KRB5CCNAME", ccachename)
+    os.environ["KRB5CCNAME"] = ccachename
     try:
         cmd = nsupdate_cmd[:]
         cmd.append(tmpfile)
@@ -359,7 +359,7 @@ else:
 # use our private krb5.conf to avoid problems with the wrong domain
 # bind9 nsupdate wants the default domain set
 krb5conf = lp.private_path('krb5.conf')
-os.putenv('KRB5_CONFIG', krb5conf)
+os.environ['KRB5_CONFIG'] = krb5conf
 
 file = open(dns_update_list, "r")
 
index 0dcc9fecfedcf0e46bcbc14c345002d4a488dfb8..169c12ab0066ece7dfce0ac06afeb0ea51eacf39 100755 (executable)
@@ -22,13 +22,13 @@ import os, sys
 
 # ensure we get messages out immediately, so they get in the samba logs,
 # and don't get swallowed by a timeout
-os.putenv('PYTHONUNBUFFERED', '1')
+os.environ['PYTHONUNBUFFERED'] = '1'
 
 # forcing GMT avoids a problem in some timezones with kerberos. Both MIT
 # heimdal can get mutual authentication errors due to the 24 second difference
 # between UTC and GMT when using some zone files (eg. the PDT zone from
 # the US)
-os.putenv("TZ", "GMT")
+os.environ["TZ"] = "GMT"
 
 # Find right directory when running from source tree
 sys.path.insert(0, "bin/python")
index 189d251ada476b80af65486aa622be1e82f4bf1d..d10d0ad2ff21e01cb68c76a4e2d217b394a1ae3d 100644 (file)
@@ -13,7 +13,7 @@ class wintest():
         self.vars = {}
         self.list_mode = False
         self.vms = None
-        os.putenv('PYTHONUNBUFFERED', '1')
+        os.environ['PYTHONUNBUFFERED'] = '1'
         self.parser = optparse.OptionParser("wintest")
 
     def check_prerequesites(self):
@@ -142,7 +142,7 @@ class wintest():
 
     def putenv(self, key, value):
         '''putenv with substitution'''
-        os.putenv(key, self.substitute(value))
+        os.environ[key] = self.substitute(value)
 
     def chdir(self, dir):
         '''chdir with substitution'''