Use locals() instead of setattr to insert generated functions into the current module...
authorZac Medico <zmedico@gentoo.org>
Sun, 18 Mar 2007 00:25:43 +0000 (00:25 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 18 Mar 2007 00:25:43 +0000 (00:25 -0000)
svn path=/main/trunk/; revision=6241

pym/portage/output.py
pym/portage/tests/bin/setup_env.py

index 0b58c81b67f87a4145c1cbd665fe1a799b73c40d..386d4c8e518eb3040f97900b5e49626fd35bdb95 100644 (file)
@@ -235,7 +235,7 @@ def create_color_func(color_key):
        return derived_func
 
 for c in compat_functions_colors:
-       setattr(sys.modules[__name__], c, create_color_func(c))
+       locals()[c] = create_color_func(c)
 
 class EOutput:
        """
index e0a89f1e29ea3f5b7f1e579c75eeef84306b3c5e..a69a19ec6785a53ff877caa8ebd8ead765b4623f 100644 (file)
@@ -66,4 +66,4 @@ for bin in os.listdir(bindir):
           bin.startswith("new") or \
           bin.startswith("prep") or \
           bin in ["ecompress","ecompressdir","fowners","fperms"]:
-               setattr(sys.modules[__name__], bin, create_portage_wrapper(bin))
+               locals()[bin] = create_portage_wrapper(bin)