Commit 3eb3e5f9 authored by Boxiang Sun's avatar Boxiang Sun

Add SciPy test, but not enabled yet.

parent 5cc0a09a
import os import os
import sys import sys
import subprocess import subprocess
import shutil
""" """
Using this test file. Using this test file.
...@@ -64,6 +63,7 @@ SRC_DIR = ENV_NAME ...@@ -64,6 +63,7 @@ SRC_DIR = ENV_NAME
PYTHON_EXE = os.path.abspath(ENV_NAME + "/bin/python") PYTHON_EXE = os.path.abspath(ENV_NAME + "/bin/python")
CYTHON_DIR = os.path.abspath(os.path.join(SRC_DIR, "cython-0.22")) CYTHON_DIR = os.path.abspath(os.path.join(SRC_DIR, "cython-0.22"))
NUMPY_DIR = os.path.abspath(os.path.join(SRC_DIR, "numpy")) NUMPY_DIR = os.path.abspath(os.path.join(SRC_DIR, "numpy"))
SCIPY_DIR = os.path.abspath(os.path.join(SRC_DIR, "scipy"))
print_progress_header("Setting up Cython...") print_progress_header("Setting up Cython...")
if not os.path.exists(CYTHON_DIR): if not os.path.exists(CYTHON_DIR):
...@@ -77,7 +77,6 @@ if not os.path.exists(CYTHON_DIR): ...@@ -77,7 +77,6 @@ if not os.path.exists(CYTHON_DIR):
subprocess.check_call(["patch", "-p1", "--input=" + PATCH_FILE], cwd=CYTHON_DIR) subprocess.check_call(["patch", "-p1", "--input=" + PATCH_FILE], cwd=CYTHON_DIR)
print ">>> Applied Cython patch" print ">>> Applied Cython patch"
try: try:
subprocess.check_call([PYTHON_EXE, "setup.py", "install"], cwd=CYTHON_DIR) subprocess.check_call([PYTHON_EXE, "setup.py", "install"], cwd=CYTHON_DIR)
subprocess.check_call([PYTHON_EXE, "-c", "import Cython"], cwd=CYTHON_DIR) subprocess.check_call([PYTHON_EXE, "-c", "import Cython"], cwd=CYTHON_DIR)
...@@ -86,6 +85,10 @@ if not os.path.exists(CYTHON_DIR): ...@@ -86,6 +85,10 @@ if not os.path.exists(CYTHON_DIR):
else: else:
print ">>> Cython already installed." print ">>> Cython already installed."
env = os.environ
CYTHON_BIN_DIR = os.path.abspath(os.path.join(ENV_NAME + "/bin"))
env["PATH"] = CYTHON_BIN_DIR + ":" + env["PATH"]
print_progress_header("Cloning up NumPy...") print_progress_header("Cloning up NumPy...")
if not os.path.exists(NUMPY_DIR): if not os.path.exists(NUMPY_DIR):
url = "https://github.com/numpy/numpy" url = "https://github.com/numpy/numpy"
...@@ -94,10 +97,6 @@ else: ...@@ -94,10 +97,6 @@ else:
print ">>> NumPy already installed." print ">>> NumPy already installed."
try: try:
env = os.environ
CYTHON_BIN_DIR = os.path.abspath(os.path.join(ENV_NAME + "/bin"))
env["PATH"] = CYTHON_BIN_DIR + ":" + env["PATH"]
print_progress_header("Setting up NumPy...") print_progress_header("Setting up NumPy...")
subprocess.check_call([PYTHON_EXE, "setup.py", "build"], cwd=NUMPY_DIR, env=env) subprocess.check_call([PYTHON_EXE, "setup.py", "build"], cwd=NUMPY_DIR, env=env)
...@@ -109,6 +108,25 @@ except: ...@@ -109,6 +108,25 @@ except:
raise raise
print_progress_header("Cloning up SciPy...")
if not os.path.exists(SCIPY_DIR):
url = "https://github.com/scipy/scipy"
# subprocess.check_call(["git", "clone", "--depth", "1", "--branch", "v0.17.1", url], cwd=SRC_DIR)
else:
print ">>> SciPy already installed."
try:
print_progress_header("Setting up SciPy...")
# subprocess.check_call([PYTHON_EXE, "setup.py", "build"], cwd=SCIPY_DIR, env=env)
print_progress_header("Installing SciPy...")
# subprocess.check_call([PYTHON_EXE, "setup.py", "install"], cwd=SCIPY_DIR, env=env)
except:
subprocess.check_call(["rm", "-rf", SCIPY_DIR + "/build"])
subprocess.check_call(["rm", "-rf", SCIPY_DIR + "/dist"])
raise
# From Wikipedia # From Wikipedia
script = """ script = """
import numpy as np import numpy as np
......
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