Author: Armin Rigo <[email protected]>
Branch: stmgc-c4
Changeset: r65079:787c3e1796bd
Date: 2013-06-28 19:01 +0200
http://bitbucket.org/pypy/pypy/changeset/787c3e1796bd/

Log:    A tool similar to pypy/tool/import_cffi.py.

diff --git a/rpython/translator/stm/import_stmgc.py 
b/rpython/translator/stm/import_stmgc.py
new file mode 100755
--- /dev/null
+++ b/rpython/translator/stm/import_stmgc.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+""" A simple tool for importing the current version of the external stmgc
+repository into pypy; should sync whatever version you provide.  Usage:
+
+import_stmgc.py <path-to-stmgc-working-copy>
+
+The working copy comes from:  hg clone https://bitbucket.org/pypy/stmgc
+"""
+
+import sys, py
+
+def mangle(lines):
+    yield "/* Imported by rpython/translator/stm/import_stmgc.py */\n"
+    for line in lines:
+        yield line
+
+def main(stmgc_dir):
+    stmgc_dir = py.path.local(stmgc_dir).join('c4')
+    stmgc_dest = py.path.local(__file__).join('..', 'src_stm')
+    plist = stmgc_dir.visit(rec=lambda p: False)
+    for p in sorted(plist):
+        if not (p.basename.endswith('.c') or p.basename.endswith('.h')):
+            continue
+        if p.basename.startswith('demo'):
+            continue
+        path = stmgc_dest.join(p.relto(stmgc_dir))
+        print path
+        path.join('..').ensure(dir=1)
+        if path.check():
+            path.remove()
+        path.write(''.join(mangle(p.readlines())))
+        path.chmod(0444)
+
+if __name__ == '__main__':
+    if len(sys.argv) != 2:
+        print __doc__
+        sys.exit(2)
+    main(sys.argv[1])
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to