From 822e01d242ab707aac7643f2c70b7b9124b74d18 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Tue, 7 Jan 2020 17:08:26 +0100 Subject: [PATCH 01/35] Bind in API-mode --- .gitignore | 2 + .travis.yml | 70 ++++++--------- CMakeLists.txt | 18 +++- Pipfile | 11 +++ account/CMakeLists.txt | 121 ++++++++++++++++++++++++-- account/__init__.py | 37 +------- account/account.h | 9 +- account/builder.py | 34 ++++++++ account/implementation/CMakeLists.txt | 16 +--- account/shim.py | 25 ++++++ test/CMakeLists.txt | 28 +++++- test/test.py | 28 ------ test/test_account.py | 19 ++++ 13 files changed, 287 insertions(+), 131 deletions(-) create mode 100644 Pipfile create mode 100644 account/builder.py create mode 100644 account/shim.py delete mode 100644 test/test.py create mode 100644 test/test_account.py diff --git a/.gitignore b/.gitignore index b475b03..e41aae7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ build*/ __pycache__/ venv/ .cache/ +.direnv/ +.ccls-cache/ diff --git a/.travis.yml b/.travis.yml index a602b30..cd2af05 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,63 +1,51 @@ -language: python - sudo: false +dist: xenial + matrix: include: - os: linux compiler: gcc - addons: &gcc49 + addons: apt: sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-4.9', 'gcc-4.9', 'gfortran-4.9'] + packages: ['g++-7', 'gcc-7', 'gfortran-7'] env: - - CXX='g++-4.9' - - CC='gcc-4.9' - - FC='gfortran-4.9' - python: 2.7 - - os: linux - compiler: gcc - addons: &gcc49 - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-4.9', 'gcc-4.9', 'gfortran-4.9'] - env: - - CXX='g++-4.9' - - CC='gcc-4.9' - - FC='gfortran-4.9' - python: 3.6 + - CXX_COMPILER='g++-7' + - C_COMPILER='gcc-7' + - FC_COMPILER='gfortran-7' - os: osx - osx_image: xcode7.3 compiler: gcc - sudo: required - language: generic + addons: + homebrew: + packages: + - gcc install: - - | - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then - # manually install python on osx - brew update &> /dev/null - brew install python3 - brew reinstall gcc - virtualenv venv - source venv/bin/activate - pip install -r requirements.txt --upgrade - fi - - pip install -r requirements.txt --upgrade - - python --version + - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh + - bash miniconda.sh -b -p $HOME/miniconda + - source "$HOME/miniconda/etc/profile.d/conda.sh" + - hash -r + - conda config --set always_yes yes --set changeps1 no + - conda update -q conda + - conda info -a + - conda create --name context-api-example python=3.7 pytest cffi pycodestyle cmake -c conda-forge before_script: - - pycodestyle account/ - - pycodestyle test/test.py + - test -n $CXX && unset CXX + - test -n $CC && unset CC + - test -n $FC && unset FC script: - - mkdir build + - conda activate context-api-example + - pycodestyle account/ + - pycodestyle test/test.py + - cmake -H. -Bbuild + - cmake --build build -- VERBOSE=1 - cd build - - cmake .. - - make - - make test + - ctest + - python -m pytest -rws -vv lib/python3.7 - cd .. - - ACCOUNT_LIBRARY_DIR=$PWD/build/lib ACCOUNT_INCLUDE_DIR=$PWD/account PYTHONPATH=$PWD pytest -vv test/test.py - mkdir test-setup-script - cd test-setup-script - virtualenv venv diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b5d8a0..a46757a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,28 @@ # define minimum cmake version -cmake_minimum_required(VERSION 2.8 FATAL_ERROR) +cmake_minimum_required(VERSION 3.14) # project name and supported languages -project(example CXX Fortran) +project(example LANGUAGES CXX Fortran C) + +include(GNUInstallDirs) # require C++11 set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON) +# require C99 +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_EXTENSIONS OFF) +set(CMAKE_C_STANDARD_REQUIRED ON) + +# specify where to place libraries +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) + +# Python is required to get the Python interface working +find_package(Python 3.7 REQUIRED COMPONENTS Development Interpreter) +file(TO_NATIVE_PATH "lib/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/account" PYMOD_INSTALL_FULLDIR) + # interface and sources add_subdirectory(account) diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..b6dff76 --- /dev/null +++ b/Pipfile @@ -0,0 +1,11 @@ +[[source]] +name = "pypi" +url = "https://pypi.org/simple" +verify_ssl = true + +[dev-packages] +pytest = "*" +cffi = "*" +pycodestyle = "*" + +[packages] \ No newline at end of file diff --git a/account/CMakeLists.txt b/account/CMakeLists.txt index 945f8b8..5f4b7d5 100644 --- a/account/CMakeLists.txt +++ b/account/CMakeLists.txt @@ -1,16 +1,121 @@ -# specify where to place libraries -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +# Get file extension for Python module +execute_process( + COMMAND + "${Python_EXECUTABLE}" "-c" "from distutils import sysconfig as s;print(s.get_config_var('EXT_SUFFIX'))" + RESULT_VARIABLE _PYTHON_SUCCESS + OUTPUT_VARIABLE Python_MODULE_EXTENSION + ERROR_VARIABLE _PYTHON_ERROR_VALUE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + +# Call CFFI to generate bindings source file _account.cc +file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/generated) +add_custom_command( + OUTPUT + ${PROJECT_BINARY_DIR}/generated/_account.c + COMMAND + ${Python_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/builder.py + MAIN_DEPENDENCY + ${CMAKE_CURRENT_LIST_DIR}/builder.py + DEPENDS + ${CMAKE_CURRENT_LIST_DIR}/account.f90 + ${CMAKE_CURRENT_LIST_DIR}/account.h + WORKING_DIRECTORY + ${PROJECT_BINARY_DIR}/generated + ) + +add_custom_target( + cffi-builder + ALL + DEPENDS + ${PROJECT_BINARY_DIR}/generated/_account.c + ) + +Python_add_library(_account + MODULE + account.f90 + ${PROJECT_BINARY_DIR}/generated/_account.c + ) + +add_dependencies(_account cffi-builder) + +# generate account_export.h +include(GenerateExportHeader) +generate_export_header(_account + BASE_NAME account + ) + +target_include_directories(_account + PRIVATE + ${CMAKE_CURRENT_LIST_DIR} # where account.h lives + ${CMAKE_CURRENT_BINARY_DIR} # where lsdalton_py_export.h lives + ) # implementation sources add_subdirectory(implementation) +target_link_libraries(_account + PUBLIC + account_fortran_implementation + ) + # fortran interface add_library(fortran_c_interface account.f90) -install( - FILES - account.h - account.f90 - DESTINATION - include +# RPATH fixing +file(RELATIVE_PATH _rel ${CMAKE_INSTALL_PREFIX}/${PYMOD_INSTALL_FULLDIR} ${CMAKE_INSTALL_PREFIX}) +if(APPLE) + set(_RPATH "@loader_path/${_rel}") +else() + set(_RPATH "\$ORIGIN/${_rel}") +endif() + +# List of Python files around the compiled extension +list(APPEND _pys + ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py + ${CMAKE_CURRENT_SOURCE_DIR}/shim.py + ) + +set_target_properties(_account + PROPERTIES + SUFFIX "${Python_MODULE_EXTENSION}" + MACOSX_RPATH ON + SKIP_BUILD_RPATH OFF + BUILD_WITH_INSTALL_RPATH OFF + INSTALL_RPATH "${_RPATH}${CMAKE_INSTALL_LIBDIR}" + INSTALL_RPATH_USE_LINK_PATH ON + LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${PYMOD_INSTALL_FULLDIR} + RESOURCE "${_pys}" + ) + +# Create symlinks into build tree +file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${PYMOD_INSTALL_FULLDIR}) +foreach(_py IN LISTS _pys) + get_filename_component(__py ${_py} NAME) + file( + CREATE_LINK + ${_py} + ${PROJECT_BINARY_DIR}/${PYMOD_INSTALL_FULLDIR}/${__py} + SYMBOLIC ) +endforeach() + +install( + FILES + account.h + account.f90 + ${CMAKE_CURRENT_BINARY_DIR}/account_export.h + DESTINATION + ${CMAKE_INSTALL_INCLUDEDIR} + ) + +install( + TARGETS + _account + LIBRARY + DESTINATION ${PYMOD_INSTALL_FULLDIR}/lib + RUNTIME + DESTINATION ${PYMOD_INSTALL_FULLDIR}/lib + RESOURCE + DESTINATION ${PYMOD_INSTALL_FULLDIR} + ) diff --git a/account/__init__.py b/account/__init__.py index 54f6068..6249938 100644 --- a/account/__init__.py +++ b/account/__init__.py @@ -1,34 +1,5 @@ -from .cffi_helpers import get_lib_handle -import os -import sys +from .shim import * - -def get_env(v): - _v = os.getenv(v) - if _v is None: - sys.stderr.write('ERROR: variable {0} is undefined\n'.format(v)) - sys.exit(1) - return _v - - -_this_path = os.path.dirname(os.path.realpath(__file__)) - -_library_dir = os.getenv('ACCOUNT_LIBRARY_DIR') -if _library_dir is None: - _library_dir = os.path.join(_this_path, 'lib') - -_include_dir = os.getenv('ACCOUNT_INCLUDE_DIR') -if _include_dir is None: - _include_dir = os.path.join(_this_path, 'include') - -c_lib = get_lib_handle(['-DACCOUNT_API=', '-DACCOUNT_NOINCLUDE'], - 'account.h', - 'account_cpp_implementation', - _library_dir, - _include_dir) - -f_lib = get_lib_handle(['-DACCOUNT_API=', '-DACCOUNT_NOINCLUDE'], - 'account.h', - 'account_fortran_implementation', - _library_dir, - _include_dir) +__all__ = [ + "Account", +] diff --git a/account/account.h b/account/account.h index 1e40d00..0905af5 100644 --- a/account/account.h +++ b/account/account.h @@ -1,4 +1,6 @@ -#pragma once +/* CFFI would issue warning with pragma once */ +#ifndef ACCOUNT_H_INCLUDED +#define ACCOUNT_H_INCLUDED #ifndef ACCOUNT_API #include "account_export.h" @@ -6,7 +8,8 @@ #endif #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif struct account_context; @@ -30,3 +33,5 @@ double account_get_balance(const account_context_t *context); #ifdef __cplusplus } #endif + +#endif /* ACCOUNT_H_INCLUDED */ diff --git a/account/builder.py b/account/builder.py new file mode 100644 index 0000000..6a32279 --- /dev/null +++ b/account/builder.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +from pathlib import Path +from subprocess import check_output + +from cffi import FFI + +ffibuilder = FFI() + +definitions = ["-DACCOUNT_API=", "-DACCOUNT_NOINCLUDE"] +header = Path(__file__).resolve().parent / "account.h" +command = ["cc", "-E"] + definitions + [str(header)] +interface = check_output(command).decode("utf-8") + +# remove possible \r characters on windows which +# would confuse cdef +_interface = [l.strip("\r") for l in interface.split("\n")] + +# cdef() expects a single string declaring the C types, functions and +# globals needed to use the shared object. It must be in valid C syntax. +ffibuilder.cdef("\n".join(_interface)) + +# set_source() gives the name of the python extension module to +# produce, and some C source code as a string. This C code needs +# to make the declared functions, types and globals available, +# so it is often just the "#include". +ffibuilder.set_source( + "_account", + """ + #include "account.h" +""", +) + +ffibuilder.emit_c_code("_account.c") diff --git a/account/implementation/CMakeLists.txt b/account/implementation/CMakeLists.txt index 6ef386a..2941a74 100644 --- a/account/implementation/CMakeLists.txt +++ b/account/implementation/CMakeLists.txt @@ -9,7 +9,7 @@ target_include_directories( account_cpp_implementation PRIVATE ${PROJECT_SOURCE_DIR}/account - ${PROJECT_BINARY_DIR}/account/implementation + ${PROJECT_BINARY_DIR}/account ) add_library( @@ -18,20 +18,6 @@ add_library( fortran_implementation.f90 ) -# generate account_export.h -include(GenerateExportHeader) -generate_export_header( - account_cpp_implementation - BASE_NAME account - ) - -install( - FILES - ${PROJECT_BINARY_DIR}/account/implementation/account_export.h - DESTINATION - include - ) - install( TARGETS account_cpp_implementation diff --git a/account/shim.py b/account/shim.py new file mode 100644 index 0000000..b8adcb2 --- /dev/null +++ b/account/shim.py @@ -0,0 +1,25 @@ +from dataclasses import dataclass, field +from typing import Any + +from ._account import lib + + +@dataclass +class Account: + _context: Any = field(repr=False, init=False, compare=False) + + def __post_init__(self): + self._context = lib.account_new() + + def __del__(self): + lib.account_free(self._context) + + @property + def balance(self) -> float: + return lib.account_get_balance(self._context) + + def deposit(self, amount: float) -> None: + lib.account_deposit(self._context, amount) + + def withdraw(self, amount: float) -> None: + lib.account_withdraw(self._context, amount) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 48c8e1b..64422b6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,7 +3,7 @@ target_include_directories( c_testing_c PRIVATE ${PROJECT_SOURCE_DIR}/account - ${PROJECT_BINARY_DIR}/account/implementation + ${PROJECT_BINARY_DIR}/account ) target_link_libraries(c_testing_c account_cpp_implementation) @@ -12,7 +12,7 @@ target_include_directories( c_testing_fortran PRIVATE ${PROJECT_SOURCE_DIR}/account - ${PROJECT_BINARY_DIR}/account/implementation + ${PROJECT_BINARY_DIR}/account ) target_link_libraries(c_testing_fortran account_fortran_implementation) @@ -35,3 +35,27 @@ target_link_libraries(fortran_testing_fortran account_fortran_implementation for foreach(_test c_testing_c c_testing_fortran fortran_testing_c fortran_testing_fortran) add_test(${_test} ${PROJECT_BINARY_DIR}/test/${_test}) endforeach() + +file( + CREATE_LINK + ${CMAKE_CURRENT_SOURCE_DIR}/test_account.py + ${PROJECT_BINARY_DIR}/${PYMOD_INSTALL_FULLDIR}/../test_account.py + SYMBOLIC + ) + +# FIXME Does not work +#add_test( +# NAME +# cffi-test +# COMMAND +# ${Python_EXECUTABLE} -m pytest -rws -vv ${PROJECT_BINARY_DIR}/${PYMOD_INSTALL_FULLDIR}/../test_account.py +# WORKING_DIRECTORY +# ${CMAKE_CURRENT_BINARY_DIR} +# ) + +install( + FILES + test_account.py + DESTINATION + ${PYMOD_INSTALL_FULLDIR}/.. + ) diff --git a/test/test.py b/test/test.py deleted file mode 100644 index ed2db6d..0000000 --- a/test/test.py +++ /dev/null @@ -1,28 +0,0 @@ -def _test_implementation(lib): - account1 = lib.account_new() - - lib.account_deposit(account1, 100.0) - lib.account_deposit(account1, 100.0) - - account2 = lib.account_new() - - lib.account_deposit(account2, 200.0) - lib.account_deposit(account2, 200.0) - - lib.account_withdraw(account1, 50.0) - - assert lib.account_get_balance(account1) == 150.0 - lib.account_free(account1) - - assert lib.account_get_balance(account2) == 400.0 - lib.account_free(account2) - - -def test_fortran(): - from account import f_lib - _test_implementation(f_lib) - - -def test_cpp(): - from account import c_lib - _test_implementation(c_lib) diff --git a/test/test_account.py b/test/test_account.py new file mode 100644 index 0000000..867adf7 --- /dev/null +++ b/test/test_account.py @@ -0,0 +1,19 @@ +import pytest + +from account import Account + + +def test_account(): + account1 = Account() + account1.deposit(100.0) + account1.deposit(100.0) + + account2 = Account() + account2.deposit(200.0) + account2.deposit(200.0) + + account1.withdraw(50.0) + + assert account1.balance == pytest.approx(150.0) + + assert account2.balance == pytest.approx(400.0) From bf0fdbd3c6d9cca835764f987b609e5a8f07e5d3 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Tue, 7 Jan 2020 18:56:36 +0100 Subject: [PATCH 02/35] Remove requirements.txt --- requirements.txt | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 9c03204..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -pytest -cffi -pycodestyle From b36f159018a0f2d8a5474d541aaaf37e2f142ee0 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Tue, 7 Jan 2020 19:20:38 +0100 Subject: [PATCH 03/35] Appease CI, maybe? --- .travis.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index cd2af05..fa72518 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,10 @@ matrix: homebrew: packages: - gcc + env: + - CXX_COMPILER='g++' + - C_COMPILER='gcc' + - FC_COMPILER='gfortran' install: - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh @@ -39,8 +43,8 @@ before_script: script: - conda activate context-api-example - pycodestyle account/ - - pycodestyle test/test.py - - cmake -H. -Bbuild + - pycodestyle test/test_account.py + - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=$CXX_COMPILER -DCMAKE_C_COMPILER=$C_COMPILER -DCMAKE_Fortran_COMPILER=$FC_COMPILER - cmake --build build -- VERBOSE=1 - cd build - ctest From 9e32a3dcdb1d0beeeb5ce93f214cec9b94ec9fe7 Mon Sep 17 00:00:00 2001 From: Radovan Bast Date: Fri, 10 Jan 2020 19:13:27 +0100 Subject: [PATCH 04/35] fix miniconda install on travis/macOS --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fa72518..529bd78 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,11 @@ matrix: - FC_COMPILER='gfortran' install: - - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; + else + wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh; + fi - bash miniconda.sh -b -p $HOME/miniconda - source "$HOME/miniconda/etc/profile.d/conda.sh" - hash -r From ca6566a3808e7ce4870c62b37ff78cb71232e0ea Mon Sep 17 00:00:00 2001 From: Radovan Bast Date: Fri, 10 Jan 2020 19:13:49 +0100 Subject: [PATCH 05/35] fix the pip install part of the test now we use the actual setup.py instead of an outdated setup.py on a possibly different branch --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 529bd78..bf94ed0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,13 +53,16 @@ script: - cd build - ctest - python -m pytest -rws -vv lib/python3.7 + - conda deactivate - cd .. +# in the remaining part test that we can pip install the code - mkdir test-setup-script - cd test-setup-script - virtualenv venv - source venv/bin/activate - - pip install git+https://github.com/bast/context-api-example.git + - pip install /home/travis/build/dev-cafe/context-api-example/ - python -c 'import account' + - deactivate notifications: email: false From f926a1832d018f51c67263aa1586c8781c0d7d62 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Fri, 10 Jan 2020 19:36:48 +0100 Subject: [PATCH 06/35] No conda --- .travis.yml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index bf94ed0..c480751 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,8 @@ sudo: false dist: xenial +python: 3.7 + matrix: include: - os: linux @@ -20,32 +22,35 @@ matrix: homebrew: packages: - gcc + - cmake env: - CXX_COMPILER='g++' - C_COMPILER='gcc' - FC_COMPILER='gfortran' +before_install: + - mkdir -p $HOME/Downloads $HOME/Deps + install: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; - else - wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh; + CMAKE_VERSION=3.14.7 + target_path=$HOME/Deps/cmake/$CMAKE_VERSION + cmake_url="https://cmake.org/files/v${CMAKE_VERSION%.*}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz" + mkdir -p "$target_path" + curl -Ls "$cmake_url" | tar -xz -C "$target_path" --strip-components=1 + export PATH=$HOME/Deps/cmake/$CMAKE_VERSION/bin${PATH:+:$PATH} fi - - bash miniconda.sh -b -p $HOME/miniconda - - source "$HOME/miniconda/etc/profile.d/conda.sh" - - hash -r - - conda config --set always_yes yes --set changeps1 no - - conda update -q conda - - conda info -a - - conda create --name context-api-example python=3.7 pytest cffi pycodestyle cmake -c conda-forge + - pip install --upgrade pip + - pip install -U pipenv + - pipenv install --dev before_script: - test -n $CXX && unset CXX - test -n $CC && unset CC - test -n $FC && unset FC + - source $(pipenv --venv)/bin/activate script: - - conda activate context-api-example - pycodestyle account/ - pycodestyle test/test_account.py - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=$CXX_COMPILER -DCMAKE_C_COMPILER=$C_COMPILER -DCMAKE_Fortran_COMPILER=$FC_COMPILER @@ -53,7 +58,6 @@ script: - cd build - ctest - python -m pytest -rws -vv lib/python3.7 - - conda deactivate - cd .. # in the remaining part test that we can pip install the code - mkdir test-setup-script From e4a4f0e0102d55478368295a1ce1dc5b7a74801e Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Fri, 10 Jan 2020 19:41:38 +0100 Subject: [PATCH 07/35] Effing YAML --- .travis.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index c480751..3cca61b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,13 +32,14 @@ before_install: - mkdir -p $HOME/Downloads $HOME/Deps install: - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - CMAKE_VERSION=3.14.7 - target_path=$HOME/Deps/cmake/$CMAKE_VERSION - cmake_url="https://cmake.org/files/v${CMAKE_VERSION%.*}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz" - mkdir -p "$target_path" - curl -Ls "$cmake_url" | tar -xz -C "$target_path" --strip-components=1 - export PATH=$HOME/Deps/cmake/$CMAKE_VERSION/bin${PATH:+:$PATH} + - | + if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + CMAKE_VERSION=3.14.7 + target_path=$HOME/Deps/cmake/$CMAKE_VERSION + cmake_url="https://cmake.org/files/v${CMAKE_VERSION%.*}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz" + mkdir -p "$target_path" + curl -Ls "$cmake_url" | tar -xz -C "$target_path" --strip-components=1 + export PATH=$HOME/Deps/cmake/$CMAKE_VERSION/bin${PATH:+:$PATH} fi - pip install --upgrade pip - pip install -U pipenv From 016db1dc7058f8a67ac001ab9c01859ef580e370 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Fri, 10 Jan 2020 19:42:06 +0100 Subject: [PATCH 08/35] Deactivate --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 3cca61b..cd3afcf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,6 +59,7 @@ script: - cd build - ctest - python -m pytest -rws -vv lib/python3.7 + - deactivate - cd .. # in the remaining part test that we can pip install the code - mkdir test-setup-script From ce13aa225a358247d44febcf5ffb7aa2d241342e Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Fri, 10 Jan 2020 19:52:16 +0100 Subject: [PATCH 09/35] Try stuff --- .travis.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index cd3afcf..2a83c35 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,12 +2,11 @@ sudo: false dist: xenial -python: 3.7 - matrix: include: - os: linux compiler: gcc + python: 3.7 addons: apt: sources: ['ubuntu-toolchain-r-test'] @@ -54,7 +53,12 @@ before_script: script: - pycodestyle account/ - pycodestyle test/test_account.py - - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=$CXX_COMPILER -DCMAKE_C_COMPILER=$C_COMPILER -DCMAKE_Fortran_COMPILER=$FC_COMPILER + - | + cmake -H. -Bbuild + -DCMAKE_CXX_COMPILER=$CXX_COMPILER + -DCMAKE_C_COMPILER=$C_COMPILER + -DCMAKE_Fortran_COMPILER=$FC_COMPILER + -DPython_ROOT_DIR=$(pipenv --venv) - cmake --build build -- VERBOSE=1 - cd build - ctest From 3f8666ac482ded7183d1bd17b76aa0e2c4dda1a6 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Fri, 10 Jan 2020 19:54:48 +0100 Subject: [PATCH 10/35] Try more stuff --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2a83c35..bb74cbd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,11 +2,14 @@ sudo: false dist: xenial +language: python + +python: 3.7 + matrix: include: - os: linux compiler: gcc - python: 3.7 addons: apt: sources: ['ubuntu-toolchain-r-test'] From 719de57bce37a83c3da54c13f764aad12c4fa42b Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Fri, 10 Jan 2020 19:57:37 +0100 Subject: [PATCH 11/35] More and more stuff --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bb74cbd..5a8cf1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,7 +36,7 @@ before_install: install: - | if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - CMAKE_VERSION=3.14.7 + CMAKE_VERSION="3.14.7" target_path=$HOME/Deps/cmake/$CMAKE_VERSION cmake_url="https://cmake.org/files/v${CMAKE_VERSION%.*}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz" mkdir -p "$target_path" From fc8cb8bf543a1b3cfdbaeed99177f49735994994 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Fri, 10 Jan 2020 21:25:43 +0100 Subject: [PATCH 12/35] Disgusting --- .travis.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5a8cf1c..889b3c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,12 +36,14 @@ before_install: install: - | if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - CMAKE_VERSION="3.14.7" - target_path=$HOME/Deps/cmake/$CMAKE_VERSION - cmake_url="https://cmake.org/files/v${CMAKE_VERSION%.*}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz" - mkdir -p "$target_path" - curl -Ls "$cmake_url" | tar -xz -C "$target_path" --strip-components=1 - export PATH=$HOME/Deps/cmake/$CMAKE_VERSION/bin${PATH:+:$PATH} + CMAKE_VERSION="3.14.7" + echo "-- Installing CMake ${CMAKE_VERSION}" + target_path=$HOME/Deps/cmake/$CMAKE_VERSION + cmake_url="https://cmake.org/files/v${CMAKE_VERSION%.*}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz" + mkdir -p "$target_path" + curl -Ls "$cmake_url" | tar -xz -C "$target_path" --strip-components=1 + export PATH=$HOME/Deps/cmake/$CMAKE_VERSION/bin${PATH:+:$PATH} + echo "-- Done with CMake ${CMAKE_VERSION}" fi - pip install --upgrade pip - pip install -U pipenv From 2c28a4b5abf9d29806f9657befcafe1723b5c9e6 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Fri, 10 Jan 2020 21:28:45 +0100 Subject: [PATCH 13/35] On PATH --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 889b3c0..5a65bb2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,11 +38,10 @@ install: if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then CMAKE_VERSION="3.14.7" echo "-- Installing CMake ${CMAKE_VERSION}" - target_path=$HOME/Deps/cmake/$CMAKE_VERSION + target_path=$HOME/Deps/cmake cmake_url="https://cmake.org/files/v${CMAKE_VERSION%.*}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz" mkdir -p "$target_path" curl -Ls "$cmake_url" | tar -xz -C "$target_path" --strip-components=1 - export PATH=$HOME/Deps/cmake/$CMAKE_VERSION/bin${PATH:+:$PATH} echo "-- Done with CMake ${CMAKE_VERSION}" fi - pip install --upgrade pip @@ -56,6 +55,7 @@ before_script: - source $(pipenv --venv)/bin/activate script: + - export PATH=$HOME/Deps/cmake/bin${PATH:+:$PATH} - pycodestyle account/ - pycodestyle test/test_account.py - | From 7ef348fa7c7ff1aec92a76bc8e29d924f2c64510 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Fri, 10 Jan 2020 21:31:41 +0100 Subject: [PATCH 14/35] Compilers --- .travis.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5a65bb2..f2eb1eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,12 +12,11 @@ matrix: compiler: gcc addons: apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-7', 'gcc-7', 'gfortran-7'] + packages: ['g++', 'gcc', 'gfortran'] env: - - CXX_COMPILER='g++-7' - - C_COMPILER='gcc-7' - - FC_COMPILER='gfortran-7' + - CXX_COMPILER='g++' + - C_COMPILER='gcc' + - FC_COMPILER='gfortran' - os: osx compiler: gcc addons: From 3e9521d6d778b3d508accfa5a91a4f9de1b38da1 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Fri, 10 Jan 2020 21:34:27 +0100 Subject: [PATCH 15/35] Multiline --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index f2eb1eb..9200bb5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,12 +57,12 @@ script: - export PATH=$HOME/Deps/cmake/bin${PATH:+:$PATH} - pycodestyle account/ - pycodestyle test/test_account.py - - | - cmake -H. -Bbuild - -DCMAKE_CXX_COMPILER=$CXX_COMPILER - -DCMAKE_C_COMPILER=$C_COMPILER - -DCMAKE_Fortran_COMPILER=$FC_COMPILER - -DPython_ROOT_DIR=$(pipenv --venv) + - > + cmake -H. -Bbuild + -DCMAKE_CXX_COMPILER=$CXX_COMPILER + -DCMAKE_C_COMPILER=$C_COMPILER + -DCMAKE_Fortran_COMPILER=$FC_COMPILER + -DPython_ROOT_DIR=$(pipenv --venv) - cmake --build build -- VERBOSE=1 - cd build - ctest From d312dc18fc1024318cd86b16efaf72f43d1762d5 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Fri, 10 Jan 2020 21:35:15 +0100 Subject: [PATCH 16/35] Prune --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9200bb5..10fdd83 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,12 +4,10 @@ dist: xenial language: python -python: 3.7 - matrix: include: - os: linux - compiler: gcc + python: 3.7 addons: apt: packages: ['g++', 'gcc', 'gfortran'] @@ -18,7 +16,6 @@ matrix: - C_COMPILER='gcc' - FC_COMPILER='gfortran' - os: osx - compiler: gcc addons: homebrew: packages: From 335584fddb0365aa0fee7d3c97f160efe1b7a832 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Fri, 10 Jan 2020 21:37:28 +0100 Subject: [PATCH 17/35] Braces --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 10fdd83..5e8c841 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,9 +56,9 @@ script: - pycodestyle test/test_account.py - > cmake -H. -Bbuild - -DCMAKE_CXX_COMPILER=$CXX_COMPILER - -DCMAKE_C_COMPILER=$C_COMPILER - -DCMAKE_Fortran_COMPILER=$FC_COMPILER + -DCMAKE_CXX_COMPILER=${CXX_COMPILER} + -DCMAKE_C_COMPILER=${C_COMPILER} + -DCMAKE_Fortran_COMPILER=${FC_COMPILER} -DPython_ROOT_DIR=$(pipenv --venv) - cmake --build build -- VERBOSE=1 - cd build From 0713c59392083a031751652a86b069b816645513 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Fri, 10 Jan 2020 21:39:57 +0100 Subject: [PATCH 18/35] One line --- .travis.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5e8c841..04bb58f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ matrix: - C_COMPILER='gcc' - FC_COMPILER='gfortran' - os: osx + python: 3.7 addons: homebrew: packages: @@ -54,12 +55,7 @@ script: - export PATH=$HOME/Deps/cmake/bin${PATH:+:$PATH} - pycodestyle account/ - pycodestyle test/test_account.py - - > - cmake -H. -Bbuild - -DCMAKE_CXX_COMPILER=${CXX_COMPILER} - -DCMAKE_C_COMPILER=${C_COMPILER} - -DCMAKE_Fortran_COMPILER=${FC_COMPILER} - -DPython_ROOT_DIR=$(pipenv --venv) + - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_Fortran_COMPILER=${FC_COMPILER} -DPython_ROOT_DIR=$(pipenv --venv) - cmake --build build -- VERBOSE=1 - cd build - ctest From 0d26c654c7be8ca6f7a6e8802e80eefbc06895cc Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Fri, 10 Jan 2020 21:41:45 +0100 Subject: [PATCH 19/35] Remove suggestion --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 04bb58f..15a1cbb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,7 +55,7 @@ script: - export PATH=$HOME/Deps/cmake/bin${PATH:+:$PATH} - pycodestyle account/ - pycodestyle test/test_account.py - - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_Fortran_COMPILER=${FC_COMPILER} -DPython_ROOT_DIR=$(pipenv --venv) + - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_Fortran_COMPILER=${FC_COMPILER} - cmake --build build -- VERBOSE=1 - cd build - ctest From 6956098b4ed6a57c166a7ecc324a7a576eeb922e Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Jan 2020 09:52:25 +0100 Subject: [PATCH 20/35] Suggest away --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 15a1cbb..4bd0b71 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,7 +55,7 @@ script: - export PATH=$HOME/Deps/cmake/bin${PATH:+:$PATH} - pycodestyle account/ - pycodestyle test/test_account.py - - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_Fortran_COMPILER=${FC_COMPILER} + - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_Fortran_COMPILER=${FC_COMPILER} -DPython_ROOT_DIR="$(pipenv --venv)" - cmake --build build -- VERBOSE=1 - cd build - ctest From 8b3b3e250b699576dc003b6730894b54bad04cc5 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Jan 2020 10:03:06 +0100 Subject: [PATCH 21/35] Are you effing with me? --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 4bd0b71..67d76cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,6 +52,8 @@ before_script: - source $(pipenv --venv)/bin/activate script: + - echo "ls $(type -P python)" + - echo "$(pipenv --venv)" - export PATH=$HOME/Deps/cmake/bin${PATH:+:$PATH} - pycodestyle account/ - pycodestyle test/test_account.py From 20332e7906f574109c0a99f8ed2e1cdea28c43f7 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Jan 2020 10:04:48 +0100 Subject: [PATCH 22/35] Get Python on macOS, maybe? --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 67d76cc..53b0b28 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,12 +16,12 @@ matrix: - C_COMPILER='gcc' - FC_COMPILER='gfortran' - os: osx - python: 3.7 addons: homebrew: packages: - gcc - cmake + - python env: - CXX_COMPILER='g++' - C_COMPILER='gcc' From b007468cbd3223ac97120ae50da6bccdf45f94c0 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Jan 2020 10:06:07 +0100 Subject: [PATCH 23/35] PIPENV_IGNORE_VIRTUALENVS=1 --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 53b0b28..a5dfa6f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,9 @@ dist: xenial language: python +env: + - PIPENV_IGNORE_VIRTUALENVS=1 + matrix: include: - os: linux From ee590c0e7f398ccc819f85f73a0d8f6534ea9767 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Jan 2020 10:09:48 +0100 Subject: [PATCH 24/35] enraging --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a5dfa6f..856bd36 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,9 @@ dist: xenial language: python env: - - PIPENV_IGNORE_VIRTUALENVS=1 + global: + - PIPENV_IGNORE_VIRTUALENVS=1 + - PATH=$HOME/Deps/cmake/bin${PATH:+:$PATH} matrix: include: @@ -57,7 +59,6 @@ before_script: script: - echo "ls $(type -P python)" - echo "$(pipenv --venv)" - - export PATH=$HOME/Deps/cmake/bin${PATH:+:$PATH} - pycodestyle account/ - pycodestyle test/test_account.py - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_Fortran_COMPILER=${FC_COMPILER} -DPython_ROOT_DIR="$(pipenv --venv)" From 2ab3e8491b8f66d73314390c1ce3d086d606529e Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Jan 2020 10:10:21 +0100 Subject: [PATCH 25/35] Foooo --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 856bd36..ffdaa95 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,6 @@ sudo: false dist: xenial -language: python - env: global: - PIPENV_IGNORE_VIRTUALENVS=1 From c934de52abbfffe00447b2f07b78028d24f8799f Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Jan 2020 10:12:09 +0100 Subject: [PATCH 26/35] Piece of s**t --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index ffdaa95..e2bb732 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ env: matrix: include: - os: linux + language: python python: 3.7 addons: apt: From 458d6234bc3e2d91d7933b3f90704f6dadc41df7 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Jan 2020 10:15:01 +0100 Subject: [PATCH 27/35] No suggest --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e2bb732..5236e09 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,7 +60,7 @@ script: - echo "$(pipenv --venv)" - pycodestyle account/ - pycodestyle test/test_account.py - - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_Fortran_COMPILER=${FC_COMPILER} -DPython_ROOT_DIR="$(pipenv --venv)" + - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_Fortran_COMPILER=${FC_COMPILER} - cmake --build build -- VERBOSE=1 - cd build - ctest From 633d129210d3a8c6338a6d84fdb1a5a4359fc8ff Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Jan 2020 10:18:22 +0100 Subject: [PATCH 28/35] Follow docs? --- .travis.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5236e09..8f7dbdb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ sudo: false -dist: xenial +dist: bionic env: global: @@ -9,23 +9,23 @@ env: matrix: include: - - os: linux + - name: "Context API example on Linux" + os: linux language: python python: 3.7 - addons: - apt: - packages: ['g++', 'gcc', 'gfortran'] env: - CXX_COMPILER='g++' - C_COMPILER='gcc' - FC_COMPILER='gfortran' - - os: osx + - name: "Context API example on macOS" + os: osx + osx_image: xcode11.2 # Python 3.7.4 running on macOS 10.14.4 + language: shell # 'language: python' is an error on Travis CI macOS addons: homebrew: packages: - gcc - cmake - - python env: - CXX_COMPILER='g++' - C_COMPILER='gcc' From 176095eb1cad9ec9c20d6aaae155f5ffdb06d794 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Jan 2020 10:26:01 +0100 Subject: [PATCH 29/35] gfortran --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8f7dbdb..477f824 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,9 @@ matrix: os: linux language: python python: 3.7 + addons: + apt: + packages: ['gfortran'] env: - CXX_COMPILER='g++' - C_COMPILER='gcc' From 7c644ce6b8b30472022e7b8ec870a24556a23555 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Jan 2020 10:31:07 +0100 Subject: [PATCH 30/35] Piece of s**t --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 477f824..2eb19fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,11 +59,9 @@ before_script: - source $(pipenv --venv)/bin/activate script: - - echo "ls $(type -P python)" - - echo "$(pipenv --venv)" - pycodestyle account/ - pycodestyle test/test_account.py - - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_Fortran_COMPILER=${FC_COMPILER} + - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_Fortran_COMPILER=${FC_COMPILER} -DPython_ROOT_DIR="$(pipenv --venv)" - cmake --build build -- VERBOSE=1 - cd build - ctest From 1daca9fe5ec513a8eb963e6f539707bc006643a8 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Jan 2020 10:34:11 +0100 Subject: [PATCH 31/35] This makes no sense --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2eb19fa..996aa8f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,7 +61,8 @@ before_script: script: - pycodestyle account/ - pycodestyle test/test_account.py - - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_Fortran_COMPILER=${FC_COMPILER} -DPython_ROOT_DIR="$(pipenv --venv)" + - Python_ROOT_DIR="$(pipenv --venv)" + - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_Fortran_COMPILER=${FC_COMPILER} -DPython_ROOT_DIR="${Python_ROOT_DIR}" - cmake --build build -- VERBOSE=1 - cd build - ctest From 90984f317429a2fc3de0f01d68a956b937c82d25 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Jan 2020 10:38:55 +0100 Subject: [PATCH 32/35] Still makes no sense --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 996aa8f..124e315 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,17 +51,17 @@ install: - pip install --upgrade pip - pip install -U pipenv - pipenv install --dev + - export Python_ROOT_DIR="$(pipenv --venv)" before_script: - test -n $CXX && unset CXX - test -n $CC && unset CC - test -n $FC && unset FC - - source $(pipenv --venv)/bin/activate + - source ${Python_ROOT_DIR}/bin/activate script: - pycodestyle account/ - pycodestyle test/test_account.py - - Python_ROOT_DIR="$(pipenv --venv)" - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_Fortran_COMPILER=${FC_COMPILER} -DPython_ROOT_DIR="${Python_ROOT_DIR}" - cmake --build build -- VERBOSE=1 - cd build From 54ba8d0b59cb6f132c1e34fcca9daf3488bf6c81 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Jan 2020 10:41:50 +0100 Subject: [PATCH 33/35] Ufff --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 124e315..123b16f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,15 +51,17 @@ install: - pip install --upgrade pip - pip install -U pipenv - pipenv install --dev - - export Python_ROOT_DIR="$(pipenv --venv)" before_script: - test -n $CXX && unset CXX - test -n $CC && unset CC - test -n $FC && unset FC - - source ${Python_ROOT_DIR}/bin/activate + - source $(pipenv --venv)/bin/activate script: + - echo "pipenv --venv gives $(pipenv --venv)" + - Python_ROOT_DIR=$(pipenv --venv) + - echo "Python_ROOT_DIR is ${Python_ROOT_DIR}" - pycodestyle account/ - pycodestyle test/test_account.py - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_Fortran_COMPILER=${FC_COMPILER} -DPython_ROOT_DIR="${Python_ROOT_DIR}" From 2828911ea6df2a81f9cba88d39d8e0f4bcc58163 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Jan 2020 10:49:54 +0100 Subject: [PATCH 34/35] uffff --- .travis.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 123b16f..052ab98 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,20 +51,18 @@ install: - pip install --upgrade pip - pip install -U pipenv - pipenv install --dev + - echo "pipenv --venv is $(pipenv --venv)" + - source $(pipenv --venv)/bin/activate before_script: - test -n $CXX && unset CXX - test -n $CC && unset CC - test -n $FC && unset FC - - source $(pipenv --venv)/bin/activate script: - - echo "pipenv --venv gives $(pipenv --venv)" - - Python_ROOT_DIR=$(pipenv --venv) - - echo "Python_ROOT_DIR is ${Python_ROOT_DIR}" - pycodestyle account/ - pycodestyle test/test_account.py - - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_Fortran_COMPILER=${FC_COMPILER} -DPython_ROOT_DIR="${Python_ROOT_DIR}" + - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_Fortran_COMPILER=${FC_COMPILER} -DPython_ROOT_DIR="$(which python)/.." - cmake --build build -- VERBOSE=1 - cd build - ctest From a7f5e55bf0e1d59f217eca3490f4bd1d7a101168 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Jan 2020 10:54:52 +0100 Subject: [PATCH 35/35] Bah --- .travis.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 052ab98..db179d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,8 +51,6 @@ install: - pip install --upgrade pip - pip install -U pipenv - pipenv install --dev - - echo "pipenv --venv is $(pipenv --venv)" - - source $(pipenv --venv)/bin/activate before_script: - test -n $CXX && unset CXX @@ -60,14 +58,13 @@ before_script: - test -n $FC && unset FC script: - - pycodestyle account/ - - pycodestyle test/test_account.py - - cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_Fortran_COMPILER=${FC_COMPILER} -DPython_ROOT_DIR="$(which python)/.." - - cmake --build build -- VERBOSE=1 + - pipenv run pycodestyle account/ + - pipenv run pycodestyle test/test_account.py + - pipenv run cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_Fortran_COMPILER=${FC_COMPILER} + - pipenv run cmake --build build -- VERBOSE=1 - cd build - ctest - - python -m pytest -rws -vv lib/python3.7 - - deactivate + - pipenv run python -m pytest -rws -vv lib/python3.7 - cd .. # in the remaining part test that we can pip install the code - mkdir test-setup-script