From fbb273c5fe8634a1ffe246f41eafe2ae492f6cc9 Mon Sep 17 00:00:00 2001 From: Josef Kemetmüller Date: Thu, 26 Dec 2019 21:53:05 +0100 Subject: fenics: 2017.1.0 -> 2019.1.0 Fixes: NixOS/nixpkgs#75886 --- .../libraries/science/math/fenics/default.nix | 244 ++++++++++++++------- .../libraries/science/math/fenics/unicode.patch | 67 ------ 2 files changed, 163 insertions(+), 148 deletions(-) delete mode 100644 pkgs/development/libraries/science/math/fenics/unicode.patch (limited to 'pkgs/development') diff --git a/pkgs/development/libraries/science/math/fenics/default.nix b/pkgs/development/libraries/science/math/fenics/default.nix index 2bb284477e6d..e70462cd9efc 100644 --- a/pkgs/development/libraries/science/math/fenics/default.nix +++ b/pkgs/development/libraries/science/math/fenics/default.nix @@ -1,43 +1,42 @@ { stdenv , fetchurl +, fetchpatch , boost , cmake , doxygen , eigen +, mpi4py , numpy -, pkgconfig +, pkg-config +, pybind11 , pytest , pythonPackages , six , sympy -, gtest ? null -, hdf5 ? null -, mpi ? null -, ply ? null -, python ? null -, sphinx ? null -, suitesparse ? null -, swig ? null -, vtk ? null -, zlib ? null -, docs ? false -, pythonBindings ? false -, doCheck ? true }: - -assert pythonBindings -> python != null && ply != null && swig != null; - +, gtest +, hdf5 +, mpi +, ply +, python +, scotch +, setuptools +, sphinx +, suitesparse +, swig +, zlib +}: let - version = "2017.1.0"; + version = "2019.1.0"; dijitso = pythonPackages.buildPythonPackage { pname = "dijitso"; inherit version; src = fetchurl { url = "https://bitbucket.org/fenics-project/dijitso/downloads/dijitso-${version}.tar.gz"; - sha256 = "0mw6mynjmg6yl3l2k33yra2x84s4r6mh44ylhk9znjfk74jra8zg"; + sha256 = "1ncgbr0bn5cvv16f13g722a0ipw6p9y6p4iasxjziwsp8kn5x97a"; }; - buildInputs = [ numpy six ]; - nativeBuildInputs = [ pytest ]; + propagatedBuildInputs = [ numpy six ]; + checkInputs = [ pytest ]; preCheck = '' export HOME=$PWD ''; @@ -59,11 +58,22 @@ let inherit version; src = fetchurl { url = "https://bitbucket.org/fenics-project/fiat/downloads/fiat-${version}.tar.gz"; - sha256 = "156ybz70n4n7p88q4pfkvbmg1xr2ll80inzr423mki0nml0q8a6l"; + sha256 = "1sbi0fbr7w9g9ajr565g3njxrc3qydqjy3334vmz5xg0rd3106il"; }; - buildInputs = [ numpy pytest six sympy ]; + propagatedBuildInputs = [ numpy six sympy ]; + checkInputs = [ pytest ]; + + preCheck = '' + # Workaround pytest 4.6.3 issue. + # See: https://bitbucket.org/fenics-project/fiat/pull-requests/59 + rm test/unit/test_quadrature.py + rm test/unit/test_reference_element.py + rm test/unit/test_fiat.py + ''; checkPhase = '' + runHook preCheck py.test test/unit/ + runHook postCheck ''; meta = { description = "Automatic generation of finite element basis functions"; @@ -78,11 +88,14 @@ let inherit version; src = fetchurl { url = "https://bitbucket.org/fenics-project/ufl/downloads/ufl-${version}.tar.gz"; - sha256 = "13ysimmwad429fjjs07j1fw1gq196p021j7mv66hwrljyh8gm1xg"; + sha256 = "04daxwg4y9c51sdgvwgmlc82nn0fjw7i2vzs15ckdc7dlazmcfi1"; }; - buildInputs = [ numpy pytest six ]; + propagatedBuildInputs = [ numpy six ]; + checkInputs = [ pytest ]; checkPhase = '' + runHook preCheck py.test test/ + runHook postCheck ''; meta = { description = "A domain-specific language for finite element variational forms"; @@ -97,12 +110,29 @@ let inherit version; src = fetchurl { url = "https://bitbucket.org/fenics-project/ffc/downloads/ffc-${version}.tar.gz"; - sha256 = "1cw7zsrjms11xrfg7x9wjd90x3w4v5s1wdwa18xqlycqz7cc8wr0"; + sha256 = "1zdg6pziss4va74pd7jjl8sc3ya2gmhpypccmyd8p7c66ji23y2g"; }; - buildInputs = [ dijitso fiat numpy pytest six sympy ufl ]; - checkPhase = '' + nativeBuildInputs = [ + pybind11 + ]; + propagatedBuildInputs = [ + dijitso + fiat + numpy + six + sympy + ufl + setuptools + ]; + checkInputs = [ pytest ]; + preCheck = '' export HOME=$PWD + rm test/unit/ufc/finite_element/test_evaluate.py + ''; + checkPhase = '' + runHook preCheck py.test test/unit/ + runHook postCheck ''; meta = { description = "A compiler for finite element variational forms"; @@ -111,66 +141,118 @@ let license = stdenv.lib.licenses.lgpl3; }; }; - - instant = pythonPackages.buildPythonPackage { - pname = "instant"; + dolfin = stdenv.mkDerivation { + pname = "dolfin"; inherit version; src = fetchurl { - url = "https://bitbucket.org/fenics-project/instant/downloads/instant-${version}.tar.gz"; - sha256 = "1rsyh6n04w0na2zirfdcdjip8k8ikb8fc2x94fq8ylc3lpcnpx9q"; + url = "https://bitbucket.org/fenics-project/dolfin/downloads/dolfin-${version}.tar.gz"; + sha256 = "0kbyi4x5f6j4zpasch0swh0ch81w2h92rqm1nfp3ydi4a93vky33"; }; - buildInputs = [ numpy six ]; + patches = [ + (fetchpatch { + name = "fix-double-prefix.patch"; + url = "https://bitbucket.org/josef_kemetmueller/dolfin/commits/328e94acd426ebaf2243c072b806be3379fd4340/raw"; + sha256 = "1zj7k3y7vsx0hz3gwwlxhq6gdqamqpcw90d4ishwx5ps5ckcsb9r"; + }) + ]; + propagatedBuildInputs = [ + dijitso + fiat + numpy + six + ufl + ]; + nativeBuildInputs = [ + cmake + doxygen + pkg-config + ]; + buildInputs = [ + boost + dijitso + eigen + ffc + fiat + hdf5 + mpi + numpy + (numpy.blas) + ply + python + scotch + six + sphinx + (suitesparse.override { openblas = numpy.blas; }) + swig + sympy + ufl + zlib + ]; + cmakeFlags = [ + "-DDOLFIN_CXX_FLAGS=-std=c++11" + "-DDOLFIN_AUTO_DETECT_MPI=ON" + "-DDOLFIN_ENABLE_CHOLMOD=ON" + "-DDOLFIN_ENABLE_DOCS=ON" + "-DDOLFIN_ENABLE_HDF5=ON" + "-DDOLFIN_ENABLE_MPI=ON" + "-DDOLFIN_ENABLE_SCOTCH=ON" + "-DDOLFIN_ENABLE_UMFPACK=ON" + "-DDOLFIN_ENABLE_ZLIB=ON" + "-DDOLFIN_SKIP_BUILD_TESTS=ON" # Otherwise SCOTCH is not found + # TODO: Enable the following features + "-DDOLFIN_ENABLE_PARMETIS=OFF" + "-DDOLFIN_ENABLE_PETSC=OFF" + "-DDOLFIN_ENABLE_SLEPC=OFF" + "-DDOLFIN_ENABLE_TRILINOS=OFF" + ]; + installCheckPhase = '' + source $out/share/dolfin/dolfin.conf + make runtests + ''; meta = { - description = "Instant inlining of C and C++ code in Python"; + description = "The FEniCS Problem Solving Environment in Python and C++"; homepage = https://fenicsproject.org/; - platforms = stdenv.lib.platforms.all; license = stdenv.lib.licenses.lgpl3; }; }; + python-dolfin = pythonPackages.buildPythonPackage rec { + pname = "dolfin"; + inherit version; + disabled = pythonPackages.isPy27; + src = dolfin.src; + sourceRoot = "${pname}-${version}/python"; + nativeBuildInputs = [ + pybind11 + cmake + ]; + dontUseCmakeConfigure = true; + preConfigure = '' + export CMAKE_PREFIX_PATH=${pybind11}/share/cmake/pybind11:$CMAKE_PREFIX_PATH + substituteInPlace setup.py --replace "pybind11==2.2.4" "pybind11" + substituteInPlace dolfin/jit/jit.py \ + --replace 'pkgconfig.exists("dolfin")' 'pkgconfig.exists("${dolfin}/lib/pkgconfig/dolfin.pc")' \ + --replace 'pkgconfig.parse("dolfin")' 'pkgconfig.parse("${dolfin}/lib/pkgconfig/dolfin.pc")' + ''; + buildInputs = [ + dolfin + boost + ]; -in -stdenv.mkDerivation { - pname = "dolfin"; - inherit version; - src = fetchurl { - url = "https://bitbucket.org/fenics-project/dolfin/downloads/dolfin-${version}.tar.gz"; - sha256 = "14hfb5q6rz79zmy742s2fiqkb9j2cgh5bsg99v76apcr84nklyds"; - }; - propagatedBuildInputs = [ dijitso fiat numpy six ufl ]; - buildInputs = [ - boost cmake dijitso doxygen eigen ffc fiat gtest hdf5 instant mpi - numpy pkgconfig six sphinx suitesparse sympy ufl vtk zlib - ] ++ stdenv.lib.optionals pythonBindings [ ply python numpy swig ]; - patches = [ ./unicode.patch ]; - cmakeFlags = [ "-DDOLFIN_CXX_FLAGS=-std=c++11" - "-DDOLFIN_AUTO_DETECT_MPI=OFF" - ("-DDOLFIN_ENABLE_CHOLMOD=" + (if suitesparse != null then "ON" else "OFF")) - ("-DDOLFIN_ENABLE_DOCS=" + (if docs then "ON" else "OFF")) - ("-DDOLFIN_ENABLE_GTEST=" + (if gtest != null then "ON" else "OFF")) - ("-DDOLFIN_ENABLE_HDF5=" + (if hdf5 != null then "ON" else "OFF")) - ("-DDOLFIN_ENABLE_MPI=" + (if mpi != null then "ON" else "OFF")) - "-DDOLFIN_ENABLE_PARMETIS=OFF" - "-DDOLFIN_ENABLE_PETSC4PY=OFF" - "-DDOLFIN_ENABLE_PETSC=OFF" - ("-DDOLFIN_ENABLE_PYTHON=" + (if pythonBindings then "ON" else "OFF")) - "-DDOLFIN_ENABLE_SCOTCH=OFF" - "-DDOLFIN_ENABLE_SLEPC4PY=OFF" - "-DDOLFIN_ENABLE_SLEPC=OFF" - ("-DDOLFIN_ENABLE_SPHINX=" + (if sphinx != null then "ON" else "OFF")) - ("-DDOLFIN_ENABLE_TESTING=" + (if doCheck then "ON" else "OFF")) - "-DDOLFIN_ENABLE_TRILINOS=OFF" - ("-DDOLFIN_ENABLE_UMFPACK=" + (if suitesparse != null then "ON" else "OFF")) - ("-DDOLFIN_ENABLE_VTK=" + (if vtk != null then "ON" else "OFF")) - ("-DDOLFIN_ENABLE_ZLIB=" + (if zlib != null then "ON" else "OFF")) - ]; - checkPhase = '' - make runtests - ''; - postInstall = "source $out/share/dolfin/dolfin.conf"; - meta = { - description = "The FEniCS Problem Solving Environment in Python and C++"; - homepage = https://fenicsproject.org/; - platforms = stdenv.lib.platforms.darwin; - license = stdenv.lib.licenses.lgpl3; + propagatedBuildInputs = [ + dijitso + ffc + mpi4py + numpy + ufl + pythonPackages.pkgconfig + pythonPackages.pybind11 + ]; + doCheck = false; # Tries to orte_ess_init and call ssh to localhost + meta = { + description = "Python bindings for the DOLFIN FEM compiler"; + homepage = https://fenicsproject.org/; + platforms = stdenv.lib.platforms.all; + license = stdenv.lib.licenses.lgpl3; + }; }; -} +in python-dolfin diff --git a/pkgs/development/libraries/science/math/fenics/unicode.patch b/pkgs/development/libraries/science/math/fenics/unicode.patch deleted file mode 100644 index 2ef2709263ab..000000000000 --- a/pkgs/development/libraries/science/math/fenics/unicode.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 0cc9e68de1181d950d4185bf3a87b69a87e4358f Mon Sep 17 00:00:00 2001 -From: "James D. Trotter" -Date: Mon, 14 Aug 2017 16:43:53 +0200 -Subject: [PATCH] Use a UTF-8 encoding to avoid errors with decoding non-ascii - characters - ---- - cmake/scripts/generate-swig-interface.py | 6 +++--- - utils/pylit/pylit.py | 10 +++++++--- - 2 files changed, 10 insertions(+), 6 deletions(-) - -diff --git a/cmake/scripts/generate-swig-interface.py b/cmake/scripts/generate-swig-interface.py -index 843a49229..7b85453d0 100644 ---- a/cmake/scripts/generate-swig-interface.py -+++ b/cmake/scripts/generate-swig-interface.py -@@ -212,10 +212,10 @@ def extract_swig_modules_dependencies(module_to_submodules, submodule_info): - continue - - # Read code -- with open(header_file) as f: -- code = f.read() -- - try: -+ with open(header_file, encoding='utf-8') as f: -+ code = f.read() -+ - # Extract type info - used_types, declared_types = parse_and_extract_type_info(code) - except Exception as e: -diff --git a/utils/pylit/pylit.py b/utils/pylit/pylit.py -index bcd8ec5e0..8c2964fbd 100755 ---- a/utils/pylit/pylit.py -+++ b/utils/pylit/pylit.py -@@ -1496,7 +1496,7 @@ def open_streams(infile = '-', outfile = '-', overwrite='update', **keyw): - if infile == '-': - in_stream = sys.stdin - else: -- in_stream = open(infile, 'r') -+ in_stream = open(infile, 'r', encoding='utf-8') - - if outfile == '-': - out_stream = sys.stdout -@@ -1505,7 +1505,7 @@ def open_streams(infile = '-', outfile = '-', overwrite='update', **keyw): - elif overwrite == 'update' and is_newer(outfile, infile): - raise IOError((1, "Output file is newer than input file!", outfile)) - else: -- out_stream = open(outfile, 'w') -+ out_stream = open(outfile, 'w', encoding='utf-8') - return (in_stream, out_stream) - - # is_newer -@@ -1731,7 +1731,11 @@ def main(args=sys.argv[1:], **defaults): - - # Convert and write to out_stream:: - -- out_stream.write(str(converter)) -+ try: -+ out_stream.write(str(converter)) -+ except Exception as e: -+ print("Failed to write extract to", out_stream.name) -+ raise - - if out_stream is not sys.stdout: - print("extract written to", out_stream.name) --- -2.14.0 - -- cgit 1.4.1