Created
August 26, 2011 22:19
-
-
Save joshmoore/1174568 to your computer and use it in GitHub Desktop.
PyTables script to be run during continuous integration (cross-platform)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
import sys | |
import subprocess | |
import platform | |
venv = os.environ.get("VIRTUALENV", "default") | |
if platform.system() == "Windows": | |
home = "C:\\hudson" | |
bin = "Scripts" | |
exe = ".exe" | |
win32 = True | |
else: | |
home = os.path.expanduser("~") | |
bin = "bin" | |
exe = "" | |
win32 = False | |
bindir = os.path.join(home, venv, bin) | |
python = os.path.join(bindir, "python" + exe) | |
nosetests = os.path.join(bindir, "nosetests" + exe) | |
coverage = os.path.join(bindir, "coverage" + exe ) | |
print "Using %s..." % python | |
os.environ["PATH"] = os.path.pathsep.join([bindir, os.environ["PATH"]]) | |
try: | |
os.environ["PYTHONPATH"] = os.path.pathsep.join([".", os.environ["PYTHONPATH"]]) | |
except KeyError: | |
os.environ["PYTHONPATH"] = "." | |
def call(*args): | |
cmd = list(args) | |
rc = subprocess.call(cmd) | |
if rc != 0: | |
print >>sys.stderr, "FAILED: '%s'" % " ".join(cmd) | |
sys.exit(rc) | |
build_ext = [python, 'setup.py', 'build_ext', '--inplace'] | |
build_win = [python, 'setup.py', 'bdist_wininst'] | |
if "HDF5_DIR" not in os.environ: | |
build_ext.append("--hdf5=/usr") | |
call(*build_ext) | |
if win32: | |
call(*build_win) | |
TESTS = 'tables/tests/test_all.py' | |
call(nosetests, '--with-xunit', '--with-coverage', TESTS) | |
call(coverage, 'xml') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment