source: dynamico_lmdz/simple_physics/phyparam/bash/extract_cython.sh @ 4236

Last change on this file since 4236 was 4236, checked in by dubos, 5 years ago

simple_physics : some Python bindings

  • Property svn:executable set to *
File size: 943 bytes
Line 
1#!/bin/bash
2
3function extract_header()
4{
5    grep header tmp/cython | sed -E 's/.*cython.*header//g' | awk '{print "  " $0}'
6}
7
8function extract_wrapper()
9{
10    grep wrapper tmp/cython | sed -n -e 's/^.* wrapper //p'
11}
12
13
14#       grep -v extern python/phyparam.hpxd > python/phyparam.h
15#       cat python/phyparam.hpxd | tr ';' ' ' > python/phyparam.pxd
16#       cd python ; rm -rf build *.c ; python setup.py build_ext --inplace
17
18#cat tmp/all_code | extract_header
19
20grep '!$cython' tmp/all_code > tmp/cython
21
22extract_header > python/phyparam.h
23
24cat <<EOF > python/phyparam.pxd
25cdef extern from "phyparam.h" :
26$(cat python/phyparam.h | tr -d ';')
27EOF
28
29cat <<EOF > python/phyparam.pyx
30# cython: language_level=3
31
32cimport phyparam as phy
33
34#------------------------ wrappers  extracted from Fortran --------------------------#
35
36$(extract_wrapper)
37
38#-------------------------- plugins from python/plugins.pyx -------------------------#
39
40$(cat python/plugins.pyx)
41EOF
Note: See TracBrowser for help on using the repository browser.