cython-devel

changeset 2622:e7638a4a3d4a

Test for --embedded mode.
author Robert Bradshaw <robertwb@math.washington.edu>
date Wed Oct 28 22:12:14 2009 -0700 (2 years ago)
parents 7f2e76ae9913
children b60435de6367
files Demos/embed/Makefile Demos/embed/assert_equal.py Demos/embed/embedded.output
line diff
1.1 --- a/Demos/embed/Makefile Wed Oct 28 17:10:12 2009 +0100 1.2 +++ b/Demos/embed/Makefile Wed Oct 28 22:12:14 2009 -0700 1.3 @@ -1,19 +1,23 @@ 1.4 # Makefile for creating our standalone Cython program 1.5 -PYVERSION=2.3 1.6 -PYPREFIX=/usr 1.7 +PYVERSION=$(shell python -c "import sys; print sys.version[:3]") 1.8 +PYPREFIX=$(shell python -c "import sys; print sys.prefix") 1.9 INCLUDES=-I$(PYPREFIX)/include/python$(PYVERSION) 1.10 - 1.11 + 1.12 embedded: embedded.o 1.13 - gcc -o $@ $^ -lpython$(PYVERSION) 1.14 + gcc -o $@ $^ -lpython$(PYVERSION) 1.15 1.16 embedded.o: embedded.c 1.17 - gcc -c $^ $(INCLUDES) 1.18 + gcc -c $^ $(INCLUDES) 1.19 1.20 embedded.c: embedded.pyx 1.21 - @python ../../cython.py --embed embedded.pyx 1.22 + @python ../../cython.py --embed embedded.pyx 1.23 1.24 all: embedded 1.25 1.26 clean: 1.27 @echo Cleaning Demos/embed 1.28 @rm -f *~ *.o *.so core core.* *.c embedded 1.29 + 1.30 +test: clean all 1.31 + ./embedded > test.output 1.32 + python assert_equal.py embedded.output test.output
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/Demos/embed/assert_equal.py Wed Oct 28 22:12:14 2009 -0700 2.3 @@ -0,0 +1,6 @@ 2.4 +import sys 2.5 +if open(sys.argv[1]).read() != open(sys.argv[2]).read(): 2.6 + print "Files differ" 2.7 + sys.exit(1) 2.8 +else: 2.9 + print "Files identical"
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/Demos/embed/embedded.output Wed Oct 28 22:12:14 2009 -0700 3.3 @@ -0,0 +1,2 @@ 3.4 +__main__ 3.5 +Hi, I'm embedded.