From a13fe11c59b84a0e051098c074b89303003fcca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Sat, 29 Jan 2022 02:19:28 +0000 Subject: [PATCH] sasview: 4.2.0 -> 5.0.4 --- .../science/misc/sasview/default.nix | 103 ++++++++---------- .../science/misc/sasview/local_config.patch | 22 ---- .../science/misc/sasview/pyparsing-fix.patch | 13 --- pkgs/top-level/all-packages.nix | 2 +- 4 files changed, 46 insertions(+), 94 deletions(-) delete mode 100644 pkgs/applications/science/misc/sasview/local_config.patch delete mode 100644 pkgs/applications/science/misc/sasview/pyparsing-fix.patch diff --git a/pkgs/applications/science/misc/sasview/default.nix b/pkgs/applications/science/misc/sasview/default.nix index d12f9454ce7e..51dea2755785 100644 --- a/pkgs/applications/science/misc/sasview/default.nix +++ b/pkgs/applications/science/misc/sasview/default.nix @@ -1,70 +1,57 @@ -{ lib, fetchFromGitHub, gcc, python2 }: +{ lib +, python3 +, fetchFromGitHub +, which +, wrapQtAppsHook +}: -let - xhtml2pdf = import ./xhtml2pdf.nix { - inherit lib; - fetchPypi = python2.pkgs.fetchPypi; - buildPythonPackage = python2.pkgs.buildPythonPackage; - html5lib = python2.pkgs.html5lib; - httplib2 = python2.pkgs.httplib2; - nose = python2.pkgs.nose; - pillow = python2.pkgs.pillow; - pypdf2 = python2.pkgs.pypdf2; - reportlab = python2.pkgs.reportlab; - }; - -in - -python2.pkgs.buildPythonApplication rec { +python3.pkgs.buildPythonApplication rec { pname = "sasview"; - version = "4.2.0"; - - checkInputs = with python2.pkgs; [ - pytest - unittest-xml-reporting - ]; - - checkPhase = '' - # fix the following error: - # imported module 'sas.sascalc.data_util.uncertainty' has this __file__ attribute: - # /build/source/build/lib.linux-x86_64-2.7/sas/sascalc/data_util/uncertainty.py - # which is not the same as the test file we want to collect: - # /build/source/dist/tmpbuild/sasview/sas/sascalc/data_util/uncertainty.py - rm -r dist/tmpbuild - - HOME=$(mktemp -d) py.test - ''; - - propagatedBuildInputs = with python2.pkgs; [ - bumps - gcc - h5py - libxslt - lxml - matplotlib - numpy - pyparsing - periodictable - pillow - pylint - pyopencl - reportlab - sasmodels - scipy - six - sphinx - wxPython - xhtml2pdf - ]; + version = "5.0.4"; src = fetchFromGitHub { owner = "SasView"; repo = "sasview"; rev = "v${version}"; - sha256 = "0k3486h46k6406h0vla8h68fd78wh3dcaq5w6f12jh6g4cjxv9qa"; + hash = "sha256-TjcchqA6GCvkr59ZgDuGglan2RxLp+aMjJk28XhvoiY="; }; - patches = [ ./pyparsing-fix.patch ./local_config.patch ]; + nativeBuildInputs = [ + python3.pkgs.pyqt5 + wrapQtAppsHook + ]; + + propagatedBuildInputs = with python3.pkgs; [ + bumps + h5py + lxml + periodictable + pillow + pyparsing + pyqt5 + qt5reactor + sasmodels + scipy + setuptools + xhtml2pdf + ]; + + postBuild = '' + ${python3.interpreter} src/sas/qtgui/convertUI.py + ''; + + dontWrapQtApps = true; + + makeWrapperArgs = [ + "\${qtWrapperArgs[@]}" + ]; + + checkInputs = with python3.pkgs; [ + pytestCheckHook + unittest-xml-reporting + ]; + + pytestFlagsArray = [ "test" ]; meta = with lib; { homepage = "https://www.sasview.org"; diff --git a/pkgs/applications/science/misc/sasview/local_config.patch b/pkgs/applications/science/misc/sasview/local_config.patch deleted file mode 100644 index 5b6c3436494a..000000000000 --- a/pkgs/applications/science/misc/sasview/local_config.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/src/sas/_config.py b/src/sas/_config.py -index ece08fd4c..926768593 100644 ---- a/src/sas/_config.py -+++ b/src/sas/_config.py -@@ -67,8 +67,8 @@ def load_local_config(app_dir): - logger.info("GuiManager loaded %s", path) - return module - except Exception as exc: -- logger.critical("Error loading %s: %s", path, exc) -- sys.exit() -+ import sas.sasview.local_config -+ return sas.sasview.local_config - - def make_custom_config_path(user_dir): - """ -@@ -116,4 +116,4 @@ def load_custom_config(path): - - from sas.sasview import custom_config - logger.info("GuiManager custom_config defaults to sas.sasview.custom_config") -- return custom_config -\ No newline at end of file -+ return custom_config diff --git a/pkgs/applications/science/misc/sasview/pyparsing-fix.patch b/pkgs/applications/science/misc/sasview/pyparsing-fix.patch deleted file mode 100644 index c3cd164a899a..000000000000 --- a/pkgs/applications/science/misc/sasview/pyparsing-fix.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/setup.py b/setup.py -index 866ab7e36..78727b276 100755 ---- a/setup.py -+++ b/setup.py -@@ -401,7 +401,7 @@ package_data['sas.sasview'] = ['images/*', - packages.append("sas.sasview") - - required = [ -- 'bumps>=0.7.5.9', 'periodictable>=1.5.0', 'pyparsing>=2.0.0', -+ 'bumps>=0.7.5.9', 'periodictable>=1.5.0', - - # 'lxml>=2.2.2', - 'lxml', 'h5py', diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2a0093c939bf..8434166c2935 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9505,7 +9505,7 @@ with pkgs; sasquatch = callPackage ../tools/filesystems/sasquatch { }; - sasview = callPackage ../applications/science/misc/sasview {}; + sasview = libsForQt5.callPackage ../applications/science/misc/sasview {}; scallion = callPackage ../tools/security/scallion { };