[pypy-svn] r59807 - in pypy/build/testrunner: . test

fijal at codespeak.net fijal at codespeak.net
Sat Nov 8 16:02:30 CET 2008


Author: fijal
Date: Sat Nov  8 16:02:29 2008
New Revision: 59807

Added:
   pypy/build/testrunner/scratchbox_runner.py   (contents, props changed)
   pypy/build/testrunner/test/test_scratchbox_runner.py   (contents, props changed)
Log:
re-add a hack, this time separated


Added: pypy/build/testrunner/scratchbox_runner.py
==============================================================================
--- (empty file)
+++ pypy/build/testrunner/scratchbox_runner.py	Sat Nov  8 16:02:29 2008
@@ -0,0 +1,30 @@
+
+""" This is a very hackish runner for cross compilation toolchain scratchbox.
+Later on we might come out with some general solution
+"""
+
+def args_for_scratchbox(cwd, args):
+    return ['/scratchbox/login', '-d', str(cwd)] + args
+
+
+def run_scratchbox(args, cwd, out, timeout=None):
+    username = os.environ['HOME'].split(os.sep)[-1]
+    scratchboxdir = '/scratchbox/users/%s/home/%s' % (username, username)
+    if cwd.startswith(scratchboxdir):
+        cwd = cwd.lstrip(scratchboxdir)
+    return run(args_for_scratchbox(cwd, args), cwd, out, timeout)
+
+def dry_run_scratchbox(args, cwd, out, timeout=None):
+    return dry_run(args_for_scratchbox(cwd, args), cwd, out, timeout)
+
+import runner
+# XXX hack hack hack
+dry_run = runner.dry_run
+run_scratchbox = runner.run
+
+runner.dry_run = dry_run_scratchbox
+runner.run = run_scratchbox
+
+if __name__ == '__main__':
+    import sys
+    runner.main(sys.argv)

Added: pypy/build/testrunner/test/test_scratchbox_runner.py
==============================================================================
--- (empty file)
+++ pypy/build/testrunner/test/test_scratchbox_runner.py	Sat Nov  8 16:02:29 2008
@@ -0,0 +1,5 @@
+import scratchbox_runner
+
+def test_scratchbox():
+    expected = ['/scratchbox/login', '-d', 'x/y', 'a', 'b']
+    assert scratchbox_runner.args_for_scratchbox('x/y', ['a', 'b']) == expected



More information about the Pypy-commit mailing list