diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..fd6a73d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,20 @@ +language: python +python: + - "3.6" + +matrix: + include: + - os: linux + sudo: required + addons: + apt: + sources: + - llvm-toolchain-trusty-5.0 + packages: + - clang-5.0 + + install: + - ./prepare_deps.sh + + script: + - python3 test_ffig_explorer.py diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..1051a15 --- /dev/null +++ b/build.sh @@ -0,0 +1,13 @@ +pip3 install --upgrade pip && pip3 install flask + +ls -al ../ + +git clone -b master --recurse-submodules https://github.com/FFIG/ffig.git ../ffig + +touch ../ffig/__init__.py ../ffig/templates/__init__.py + +ls -al ../ + +cd - + +export PYTHONPATH="${PYTHONPATH}:/home/ffig/" diff --git a/ffig_explorer.py b/ffig_explorer.py index 41996a7..bd13aec 100644 --- a/ffig_explorer.py +++ b/ffig_explorer.py @@ -6,7 +6,13 @@ import json import shutil -import ffig.FFIG +try: + import ffig.FFIG +except ModuleNotFoundError: + import sys + sys.path.insert(0, '/home/travis/build/FFIG/ffig') + import ffig.FFIG + """ Flask app that implements a basic front-end on the home page and a rest-api under the /api/ endpoints """ @@ -30,7 +36,7 @@ def gen_bindings_from_tu(): bindings_requested = request.form["bindings_to_generate"] # local re-write/copy of ffig functionality - ffig_subfolder = '/home/ffig/ffig/' + ffig_subfolder = '../ffig/ffig/' template_dir = os.path.join(ffig_subfolder, 'templates') env = ffig.FFIG.set_template_env(template_dir) diff --git a/prepare_deps.sh b/prepare_deps.sh new file mode 100755 index 0000000..aad41ff --- /dev/null +++ b/prepare_deps.sh @@ -0,0 +1,10 @@ +pip3 install --upgrade pip && pip3 install flask + +git clone -b master --recurse-submodules https://github.com/FFIG/ffig.git ../ffig + +touch ../ffig/__init__.py ../ffig/ffig/templates/__init__.py + +export PYTHONPATH="${PYTHONPATH}:../ffig/" + +apt-get install libclang-5.0-dev +export LD_LIBRARY_PATH=/usr/lib/llvm-5.0/lib:$LD_LIBRARY_PATH diff --git a/test_ffig_explorer.py b/test_ffig_explorer.py index 5bac287..f254fc6 100644 --- a/test_ffig_explorer.py +++ b/test_ffig_explorer.py @@ -2,6 +2,8 @@ import json import unittest +import sys +print(sys.path) import ffig_explorer