[pypy-svn] r8239 - pypy/trunk/src/pypy/translator/tool

arigo at codespeak.net arigo at codespeak.net
Wed Jan 12 17:39:41 CET 2005


Author: arigo
Date: Wed Jan 12 17:39:41 2005
New Revision: 8239

Modified:
   pypy/trunk/src/pypy/translator/tool/buildpyxmodule.py
Log:
Updated make_module_from_c() to save/restore os.environ along the lines of
py/misc/buildcmodule.  These two should be unified at some point, but the PyPy
version is a bit messy and uses various strange tricks...



Modified: pypy/trunk/src/pypy/translator/tool/buildpyxmodule.py
==============================================================================
--- pypy/trunk/src/pypy/translator/tool/buildpyxmodule.py	(original)
+++ pypy/trunk/src/pypy/translator/tool/buildpyxmodule.py	Wed Jan 12 17:39:41 2005
@@ -70,16 +70,22 @@
                 else:
                     from distutils.core import setup
                     from distutils.extension import Extension
-                    setup(
-                      name = "testmodules",
-                      ext_modules=[
-                            Extension(modname, [str(cfile)],
-                                include_dirs=include_dirs)
-                      ],
-                      script_name = 'setup.py',
-                      script_args = ['-q', 'build_ext', '--inplace']
-                      #script_args = ['build_ext', '--inplace']
-                    )
+                    saved_environ = os.environ.items()
+                    try:
+                        setup(
+                          name = "testmodules",
+                          ext_modules=[
+                                Extension(modname, [str(cfile)],
+                                    include_dirs=include_dirs)
+                          ],
+                          script_name = 'setup.py',
+                          script_args = ['-q', 'build_ext', '--inplace']
+                          #script_args = ['build_ext', '--inplace']
+                        )
+                    finally:
+                        for key, value in saved_environ:
+                            if os.environ.get(key) != value:
+                                os.environ[key] = value
             finally:
                 foutput, foutput = c.done()
         except:



More information about the Pypy-commit mailing list