From: Robert Bradshaw Date: Thu, 29 Oct 2009 05:12:14 +0000 (-0700) Subject: Test for --embedded mode. X-Git-Tag: 0.12.alpha0~8^2~26 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ac5bf544b00ecb19a6c33016ab9ffe0ca8cd8594;p=cython.git Test for --embedded mode. --- diff --git a/Demos/embed/Makefile b/Demos/embed/Makefile index 1356f9a2..4a5209e1 100644 --- a/Demos/embed/Makefile +++ b/Demos/embed/Makefile @@ -1,19 +1,23 @@ # Makefile for creating our standalone Cython program -PYVERSION=2.3 -PYPREFIX=/usr +PYVERSION=$(shell python -c "import sys; print sys.version[:3]") +PYPREFIX=$(shell python -c "import sys; print sys.prefix") INCLUDES=-I$(PYPREFIX)/include/python$(PYVERSION) - + embedded: embedded.o - gcc -o $@ $^ -lpython$(PYVERSION) + gcc -o $@ $^ -lpython$(PYVERSION) embedded.o: embedded.c - gcc -c $^ $(INCLUDES) + gcc -c $^ $(INCLUDES) embedded.c: embedded.pyx - @python ../../cython.py --embed embedded.pyx + @python ../../cython.py --embed embedded.pyx all: embedded clean: @echo Cleaning Demos/embed @rm -f *~ *.o *.so core core.* *.c embedded + +test: clean all + ./embedded > test.output + python assert_equal.py embedded.output test.output diff --git a/Demos/embed/assert_equal.py b/Demos/embed/assert_equal.py new file mode 100644 index 00000000..dfb42c56 --- /dev/null +++ b/Demos/embed/assert_equal.py @@ -0,0 +1,6 @@ +import sys +if open(sys.argv[1]).read() != open(sys.argv[2]).read(): + print "Files differ" + sys.exit(1) +else: + print "Files identical" diff --git a/Demos/embed/embedded.output b/Demos/embed/embedded.output new file mode 100644 index 00000000..6b27debd --- /dev/null +++ b/Demos/embed/embedded.output @@ -0,0 +1,2 @@ +__main__ +Hi, I'm embedded.