detect if we could use cython-2.7 prior to cython. closes #28

This commit is contained in:
Mathieu Virbel 2013-02-28 19:07:05 +01:00
parent 5e3c5768b4
commit ad85ed15f0
3 changed files with 28 additions and 2 deletions

View file

@ -104,7 +104,7 @@ XSLT_CONFIG=$PREFIX/bin/xslt-config
#pushd src
#find . -name *.pyx -exec $KIVYIOSROOT/tools/cythonize.py {} \;
#popd
find . -name *.pyx -exec cython {} \;
find . -name *.pyx -exec $CYTHON {} \;
try $HOSTPYTHON setup.py build_ext
try $HOSTPYTHON setup.py install -O2 --root iosbuild

View file

@ -1,8 +1,20 @@
#!/usr/bin/env python
import os
import sys
import subprocess
# resolve cython executable
cython = None
def resolve_cython():
global cython
for executable in ('cython', 'cython-2.7'):
for path in os.environ['PATH'].split(':'):
if executable in os.listdir(path):
cython = os.path.join(path, executable)
return
def do(fn):
print 'cythonize:', fn
parts = fn.split('/')
@ -13,7 +25,7 @@ def do(fn):
package = '_'.join(parts[:-1])
# cythonize
subprocess.Popen(['cython', fn]).communicate()
subprocess.Popen([cython, fn]).communicate()
if not package:
print 'no need to rewrite', fn
@ -43,5 +55,6 @@ def do(fn):
if __name__ == '__main__':
print '-- cythonize', sys.argv
resolve_cython()
for fn in sys.argv[1:]:
do(fn)

View file

@ -44,6 +44,19 @@ export PKG_CONFIG_PATH="$BUILDROOT/pkgconfig:$PKG_CONFIG_PATH"
# some tools
export CCACHE=$(which ccache)
for fn in cython-2.7 cython; do
export CYTHON=$(which $fn)
if [ "X$CYTHON" != "X" ]; then
echo "Cython found at $CYTHON"
break
fi
done
if [ "X$CYTHON" == "X" ]; then
print "Cython is not installed, aborting."
exit 1
fi
# flags for arm compilation
export ARM_CC="$CCACHE $DEVROOT/usr/bin/arm-apple-darwin10-llvm-gcc-4.2"