#!/usr/bin/env python """Build and automation file for _sre.py.""" __revision__ = "$Id: build.py,v 1.37 2005/04/03 14:26:35 Nik Exp $" import os, os.path, re, sys from Sysyphus import TaskList, depends class SreBuild(TaskList): test = "test" testName = "" python = "/sw/bin/python2.4" ucs4Python = "~/Projects/Python-2.4.1/python.exe" allPythons = "/sw/bin/python2.4 /sw/bin/python2.3 %s" % ucs4Python pypybase = "/Users/Nik/Projects/pypy/dist" pypy = os.path.join(pypybase, "pypy/bin/py.py") def taskSdist(self): os.system("%s setup.py sdist" % self.python) os.remove("MANIFEST") def taskTest(self): os.system("%s run_tests.py %s" % (self.python, self.testName)) def taskTdd(self): self.testName = "sre_py" self.executeTasks("test") self.testName = "" def taskCTest(self): os.system("%s run_tests.py -c sre_py %s" % (self.python, self.testName)) def taskUcs4Test(self): os.system("%s run_tests.py %s" % (self.ucs4Python, self.testName)) def taskPyPyTest(self): os.system("%s %s test/test_sre_py.py" % (self.python, self.pypy)) os.system("%s %s %s -E -v" % (self.python, os.path.join(self.pypybase, "py/bin/py.test"), os.path.join(self.pypybase, "lib-python/2.4.1/test/test_re.py"))) def taskAcceptanceTest(self): for python in self.allPythons.split(): self.python = python self.executeTasks("test", "ctest", "pypytest") def taskUnibr(self): import unibr for i in range(sys.maxunicode): if unibr.islinebreak(i): print i def taskTimeit(self): print "CPython 2.4 with _sre.c:" os.system("%s time_sre.py" % self.python) print "\nCPython 2.4 with _sre.py:" os.system("%s time_sre.py -s" % self.python) print "\nPyPy with faked _sre:" os.system("%s time_sre.py --usemodules=faked+_sre" % self.pypy) print "\nPyPy with _sre.py:" os.system("%s time_sre.py" % self.pypy) if __name__ == "__main__": SreBuild().commandLineTasks()