[pypy-commit] stmgc c7-refactor: Move this logic in common.py, otherwise when running only test_list.py

arigo noreply at buildbot.pypy.org
Wed Feb 26 16:18:07 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: c7-refactor
Changeset: r874:00e254f45cf1
Date: 2014-02-26 16:17 +0100
http://bitbucket.org/pypy/stmgc/changeset/00e254f45cf1/

Log:	Move this logic in common.py, otherwise when running only
	test_list.py the C files are not rebuilt

diff --git a/c7/test/common.py b/c7/test/common.py
--- a/c7/test/common.py
+++ b/c7/test/common.py
@@ -6,3 +6,22 @@
 os.environ['CC'] = 'clang'
 
 parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+# ----------
+
+source_files = [os.path.join(parent_dir, "stmgc.c")]
+all_files = [os.path.join(parent_dir, "stmgc.h"),
+             os.path.join(parent_dir, "stmgc.c")] + [
+    os.path.join(parent_dir, 'stm', _n)
+        for _n in os.listdir(os.path.join(parent_dir, 'stm'))
+            if _n.endswith('.h') or _n.endswith('.c')]
+
+_pycache_ = os.path.join(parent_dir, 'test', '__pycache__')
+if os.path.exists(_pycache_):
+    _fs = [_f for _f in os.listdir(_pycache_) if _f.startswith('_cffi_')]
+    if _fs:
+        _fsmtime = min(os.stat(os.path.join(_pycache_, _f)).st_mtime
+                       for _f in _fs)
+        if any(os.stat(src).st_mtime >= _fsmtime for src in all_files):
+            import shutil
+            shutil.rmtree(_pycache_)
diff --git a/c7/test/support.py b/c7/test/support.py
--- a/c7/test/support.py
+++ b/c7/test/support.py
@@ -1,25 +1,6 @@
 import os
 import cffi, weakref
-from common import parent_dir
-
-# ----------
-
-source_files = [os.path.join(parent_dir, "stmgc.c")]
-all_files = [os.path.join(parent_dir, "stmgc.h"),
-             os.path.join(parent_dir, "stmgc.c")] + [
-    os.path.join(parent_dir, 'stm', _n)
-        for _n in os.listdir(os.path.join(parent_dir, 'stm'))
-            if _n.endswith('.h') or _n.endswith('.c')]
-
-_pycache_ = os.path.join(parent_dir, 'test', '__pycache__')
-if os.path.exists(_pycache_):
-    _fs = [_f for _f in os.listdir(_pycache_) if _f.startswith('_cffi_')]
-    if _fs:
-        _fsmtime = min(os.stat(os.path.join(_pycache_, _f)).st_mtime
-                       for _f in _fs)
-        if any(os.stat(src).st_mtime >= _fsmtime for src in all_files):
-            import shutil
-            shutil.rmtree(_pycache_)
+from common import parent_dir, source_files
 
 # ----------
 


More information about the pypy-commit mailing list