Skip to content

Commit d1bb66d

Browse files
committed
hacked .mk.sh so can build both fortran and bumba files and told travis to test them both
1 parent 0e6aaee commit d1bb66d

7 files changed

Lines changed: 35 additions & 10 deletions

File tree

.travis.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ language: python
33
python:
44
- "3.6"
55

6+
matrix:
7+
include:
8+
- env: MK_ARGS=""
9+
- env: MK_ARGS=fortran
10+
611
before_install:
712
- export PATH=$(echo $PATH | tr ':' "\n" | sed '/\/opt\/python/d' | tr "\n" ":" | sed "s|::|:|g")
813

@@ -19,7 +24,7 @@ install:
1924
before_script:
2025
- export PYTHONPATH=$PYTHONPATH:$(pwd)
2126
- export PYRO_HOME=$(pwd)
22-
- ./mk.sh
27+
- ./mk.sh $MK_ARGS
2328

2429
script:
2530
- flake8 --ignore=W504,F403,E226,E126,E127,E128,E129,E241,E741 .

advection_fv4/fluxes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import advection_fv4.interface_states as interface_f
1+
import advection_fv4.interface as interface_f
22
import mesh.array_indexer as ai
33

44

compressible_fv4/fluxes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import numpy as np
44

5-
import advection_fv4.interface_states as interface_f
5+
import advection_fv4.interface as interface_f
66
import compressible as comp
77
import compressible.interface as cf
88
import mesh.reconstruction as reconstruction

mk.sh

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,26 @@
1414

1515
if [ "$1" == "clean" ]; then
1616

17-
rm -rf mesh/*.so
18-
rm -rf incompressible/*.so
17+
rm -rf advection_fv4/*.so
1918
rm -rf compressible/*.so
19+
rm -rf incompressible/*.so
2020
rm -rf lm_atm/*.so
21+
rm -rf mesh/*.so
22+
rm -rf swe/*.so
2123
find . -name "*.pyc" -exec rm -f {} \;
2224
find . -type d -name "__pycache__" -exec rm -rf {} \;
2325
find . -type d -name "build" -exec rm -rf {} \;
2426

27+
# move numba interface files back
28+
regex="([a-z0-9A-Z_/]*/)_([a-z0-9A-Z_]*interface.py)"
29+
for f in $(find . -name "*interface.py")
30+
do
31+
if [[ $f =~ $regex ]]
32+
then
33+
mv ".${BASH_REMATCH[1]}_${BASH_REMATCH[2]}" ".${BASH_REMATCH[1]}${BASH_REMATCH[2]}"
34+
fi
35+
done
36+
2537
elif [ "$1" == "fortran" ]; then
2638

2739
if [ "$1" == "debug" ]; then
@@ -30,6 +42,16 @@ elif [ "$1" == "fortran" ]; then
3042
FFLAGS="-C"
3143
fi
3244

45+
# move numba interface files out of the way
46+
regex="([a-z0-9A-Z_/]*/)([a-z0-9A-Z_]*interface.py)"
47+
for f in $(find . -name "*interface.py")
48+
do
49+
if [[ $f =~ $regex ]]
50+
then
51+
mv ".${BASH_REMATCH[1]}${BASH_REMATCH[2]}" ".${BASH_REMATCH[1]}_${BASH_REMATCH[2]}"
52+
fi
53+
done
54+
3355
${PYTHON} setup_fortran.py config_fc --f90flags "${FFLAGS}" build_ext
3456

3557
else

setup_fortran.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66

77
from numpy.distutils.core import setup, Extension
88

9-
ext_modules = [Extension("compressible.interface_f", ["compressible/interface_f.f90"]),
10-
Extension("advection_fv4.interface_f", ["advection_fv4/interface_states.f90"]),
11-
Extension("lm_atm.LM_atm_interface_f", ["lm_atm/LM_atm_interface_f.f90"]),
12-
Extension("incompressible.incomp_interface_f", ["incompressible/incomp_interface_f.f90"]),
13-
Extension("swe.interface_f", ["swe/interface_f.f90"])]
9+
f_modules = ["compressible.interface", "advection_fv4.interface", "lm_atm.LM_atm_interface", "incompressible.incomp_interface", "swe.interface"]
10+
11+
ext_modules = [Extension(module, [module.replace('.', '/')+'_f.f90']) for module in f_modules]
1412

1513
setup(ext_modules=ext_modules)

0 commit comments

Comments
 (0)