From 9b5bb858fe9804caf5639e62b48e8fe1400d97b7 Mon Sep 17 00:00:00 2001 From: Victor Leikehman Date: Tue, 21 Oct 2014 16:47:15 +0300 Subject: [PATCH] wip --- .gitignore | 1 + smop/Makefile | 2 +- smop/main.py | 14 ++++++++------ smop/runtime/Makefile | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 34bc4437..e23f6cf0 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ parsetab.py version.py dist/ build/ +runtime/ diff --git a/smop/Makefile b/smop/Makefile index a2c9f3cb..4e1d49fd 100644 --- a/smop/Makefile +++ b/smop/Makefile @@ -24,7 +24,7 @@ GENERAL = accumarray.m accumdim.m bicubic.m bincoeff.m\ saveobj.m shiftdim.m shift.m sortrows.m sph2cart.m structfun.m\ subsindex.m trapz.m triplequad.m -all: mybench.py runtime.py +all: mybench.py $(PYTHON) -c "import mybench ; mybench.mybench()" general.py: $(GENERAL) diff --git a/smop/main.py b/smop/main.py index 7e8aaf96..6ab3cc30 100644 --- a/smop/main.py +++ b/smop/main.py @@ -48,13 +48,14 @@ def main(): """ try: opts, args = getopt.gnu_getopt(sys.argv[1:], - "d:ho:vVsS:X:", + "d:ho:vVsr:S:X:", [ "dot=", "exclude=", "help", "syntax-errors=", "output=", + "runtime=", "strict", "verbose", "version", @@ -69,9 +70,12 @@ def main(): output = None strict = 0 dot = None + runtime = "runtime" for o, a in opts: - if o in ("-s", "--strict"): + if o in ("-r", "--runtime"): + runtime = a + elif o in ("-s", "--strict"): strict = 1 elif o in ("-S", "--syntax-errors"): options.syntax_errors += a.split(",") @@ -141,10 +145,8 @@ def main(): fp = open(output,"w") if output != "-" else sys.stdout print >> fp, "# Autogenerated with SMOP version " + __version__ print >> fp, "# " + " ".join(sys.argv) - print >> fp, """ -from __future__ import division -from . import * -""" + print >> fp, "from __future__ import division" + print >> fp, "from %s import *" % runtime for pattern in args: for filename in glob.glob(os.path.expanduser(pattern)): diff --git a/smop/runtime/Makefile b/smop/runtime/Makefile index 7c37145e..606341ba 100644 --- a/smop/runtime/Makefile +++ b/smop/runtime/Makefile @@ -6,7 +6,7 @@ SCRIPTS = $(OCTAVE)/scripts CYTHON = cython PYTHON = python -FLAGS = -Xquadgk.m,quadl.m,lcm.m +FLAGS = -Xquadgk.m,quadl.m,lcm.m --runtime . V = 2.7 SMOP = smop SPECFUN = bessel.py betaln.py beta.py ellipke.py expint.py factorial.py\ @@ -41,4 +41,4 @@ clean: gcc -Wno-cpp -I /usr/include/python$V -O2 -shared -o $@ $^ %.py: %.m - smop $(FLAGS) -o $@ $^ + $(SMOP) $(FLAGS) -o $@ $^