[pypy-svn] r76038 - pypy/branch/reflex-support/pypy/translator/tool

arigo at codespeak.net arigo at codespeak.net
Thu Jul 8 17:23:46 CEST 2010


Author: arigo
Date: Thu Jul  8 17:23:45 2010
New Revision: 76038

Modified:
   pypy/branch/reflex-support/pypy/translator/tool/cbuild.py
Log:
Running some tests depending on cbuild would create externmod_1.so,
externmod_2.so, etc., in a random directory, the list growing forever.
Attempt to fix that by forcing the externmod_x.so to be created in
the usession directory.


Modified: pypy/branch/reflex-support/pypy/translator/tool/cbuild.py
==============================================================================
--- pypy/branch/reflex-support/pypy/translator/tool/cbuild.py	(original)
+++ pypy/branch/reflex-support/pypy/translator/tool/cbuild.py	Thu Jul  8 17:23:45 2010
@@ -271,15 +271,10 @@
         if not self.separate_module_files:
             return self
         if outputfilename is None:
-            # find more or less unique name there
-            basepath = py.path.local(self.separate_module_files[0]).dirpath()
-            pth = basepath.join('externmod').new(ext=host.so_ext)
-            num = 0
-            while pth.check():
-                pth = basepath.join(
-                    'externmod_%d' % (num,)).new(ext=host.so_ext)
-                num += 1
-            outputfilename=pth.purebasename
+            global _counter_so_names
+            counter = _counter_so_names
+            _counter_so_names = counter + 1
+            outputfilename = str(udir.join('externmod_%d' % counter))
         lib = str(host.compile([], self, outputfilename=outputfilename,
                                standalone=False))
         d = self._copy_attributes()
@@ -288,6 +283,8 @@
         d['separate_module_sources'] = ()
         return ExternalCompilationInfo(**d)
 
+_counter_so_names = 0
+
 
 # ____________________________________________________________
 #



More information about the Pypy-commit mailing list