Commit 413d0226 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Some numpy_test.py improvements

- support CPython
- don't blow away the checkout each time
parent 96bcd8cd
...@@ -38,6 +38,9 @@ def print_progress_header(text): ...@@ -38,6 +38,9 @@ def print_progress_header(text):
ENV_NAME = "numpy_test_env_" + os.path.basename(sys.executable) ENV_NAME = "numpy_test_env_" + os.path.basename(sys.executable)
DEPENDENCIES = ["nose==1.3.7"] DEPENDENCIES = ["nose==1.3.7"]
import platform
USE_CUSTOM_PATCHES = (platform.python_implementation() == "Pyston")
if not os.path.exists(ENV_NAME) or os.stat(sys.executable).st_mtime > os.stat(ENV_NAME + "/bin/python").st_mtime: if not os.path.exists(ENV_NAME) or os.stat(sys.executable).st_mtime > os.stat(ENV_NAME + "/bin/python").st_mtime:
print "Creating virtualenv to install testing dependencies..." print "Creating virtualenv to install testing dependencies..."
VIRTUALENV_SCRIPT = os.path.dirname(__file__) + "/../lib/virtualenv/virtualenv.py" VIRTUALENV_SCRIPT = os.path.dirname(__file__) + "/../lib/virtualenv/virtualenv.py"
...@@ -69,9 +72,10 @@ if not os.path.exists(CYTHON_DIR): ...@@ -69,9 +72,10 @@ if not os.path.exists(CYTHON_DIR):
subprocess.check_call(["wget", url], cwd=SRC_DIR) subprocess.check_call(["wget", url], cwd=SRC_DIR)
subprocess.check_call(["tar", "-zxf", "Cython-0.22.tar.gz"], cwd=SRC_DIR) subprocess.check_call(["tar", "-zxf", "Cython-0.22.tar.gz"], cwd=SRC_DIR)
PATCH_FILE = os.path.abspath(os.path.join(os.path.dirname(__file__), "Cython-0.22.patch")) if USE_CUSTOM_PATCHES:
subprocess.check_call(["patch", "-p1", "--input=" + PATCH_FILE], cwd=CYTHON_DIR) PATCH_FILE = os.path.abspath(os.path.join(os.path.dirname(__file__), "Cython-0.22.patch"))
print ">>> Applied Cython patch" subprocess.check_call(["patch", "-p1", "--input=" + PATCH_FILE], cwd=CYTHON_DIR)
print ">>> Applied Cython patch"
try: try:
...@@ -93,8 +97,9 @@ else: ...@@ -93,8 +97,9 @@ else:
PATCH_FILE = os.path.abspath(os.path.join(os.path.dirname(__file__), "numpy_patch.patch")) PATCH_FILE = os.path.abspath(os.path.join(os.path.dirname(__file__), "numpy_patch.patch"))
print_progress_header("Patching NumPy...") if USE_CUSTOM_PATCHES:
subprocess.check_call(["patch", "-p1", "--input=" + PATCH_FILE], cwd=NUMPY_DIR) print_progress_header("Patching NumPy...")
subprocess.check_call(["patch", "-p1", "--input=" + PATCH_FILE], cwd=NUMPY_DIR)
try: try:
env = os.environ env = os.environ
...@@ -107,7 +112,16 @@ try: ...@@ -107,7 +112,16 @@ try:
print_progress_header("Installing NumPy...") print_progress_header("Installing NumPy...")
subprocess.check_call([PYTHON_EXE, "setup.py", "install"], cwd=NUMPY_DIR, env=env) subprocess.check_call([PYTHON_EXE, "setup.py", "install"], cwd=NUMPY_DIR, env=env)
except: except:
subprocess.check_call(["rm", "-rf", NUMPY_DIR]) if USE_CUSTOM_PATCHES:
print_progress_header("Unpatching NumPy...")
cmd = ["patch", "-p1", "--forward", "-i", NUMPY_PATCH_FILE, "-R", "-d", NUMPY_DIR]
subprocess.check_output(cmd, stderr=subprocess.STDOUT)
# TODO: I'm not sure we need to do this:
subprocess.check_call(["rm", "-rf", NUMPY_DIR + "/build"])
subprocess.check_call(["rm", "-rf", NUMPY_DIR + "/dist"])
raise
# From Wikipedia # From Wikipedia
script = """ script = """
...@@ -176,9 +190,10 @@ print_progress_header("Running NumPy test suite...") ...@@ -176,9 +190,10 @@ print_progress_header("Running NumPy test suite...")
# when all the crashes are fixed. # when all the crashes are fixed.
# subprocess.check_call([PYTHON_EXE, "-c", numpy_test], cwd=CYTHON_DIR) # subprocess.check_call([PYTHON_EXE, "-c", numpy_test], cwd=CYTHON_DIR)
print_progress_header("Unpatching NumPy...") if USE_CUSTOM_PATCHES:
cmd = ["patch", "-p1", "--forward", "-i", NUMPY_PATCH_FILE, "-R", "-d", NUMPY_DIR] print_progress_header("Unpatching NumPy...")
subprocess.check_output(cmd, stderr=subprocess.STDOUT) cmd = ["patch", "-p1", "--forward", "-i", NUMPY_PATCH_FILE, "-R", "-d", NUMPY_DIR]
subprocess.check_output(cmd, stderr=subprocess.STDOUT)
print print
print "PASSED" print "PASSED"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment