Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlei committed Oct 21, 2014
1 parent cf44923 commit 9b5bb85
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ parsetab.py
version.py
dist/
build/
runtime/
2 changes: 1 addition & 1 deletion smop/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 8 additions & 6 deletions smop/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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(",")
Expand Down Expand Up @@ -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)):
Expand Down
4 changes: 2 additions & 2 deletions smop/runtime/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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\
Expand Down Expand Up @@ -41,4 +41,4 @@ clean:
gcc -Wno-cpp -I /usr/include/python$V -O2 -shared -o $@ $^

%.py: %.m
smop $(FLAGS) -o $@ $^
$(SMOP) $(FLAGS) -o $@ $^

0 comments on commit 9b5bb85

Please sign in to comment.