about summary refs log tree commit diff
path: root/pkgs/applications/science
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/science')
-rw-r--r--pkgs/applications/science/misc/sasview/default.nix60
-rw-r--r--pkgs/applications/science/misc/sasview/local_config.patch10
-rw-r--r--pkgs/applications/science/misc/sasview/pyparsing-fix.patch8
-rw-r--r--pkgs/applications/science/misc/sasview/xhtml2pdf.nix32
4 files changed, 110 insertions, 0 deletions
diff --git a/pkgs/applications/science/misc/sasview/default.nix b/pkgs/applications/science/misc/sasview/default.nix
new file mode 100644
index 000000000000..d0a4f74924c5
--- /dev/null
+++ b/pkgs/applications/science/misc/sasview/default.nix
@@ -0,0 +1,60 @@
+{lib, fetchgit, gcc, python}:
+
+let
+  xhtml2pdf = import ./xhtml2pdf.nix { inherit lib;
+    fetchPypi = python.pkgs.fetchPypi;
+    buildPythonPackage = python.pkgs.buildPythonPackage;
+    html5lib = python.pkgs.html5lib;
+    httplib2 = python.pkgs.httplib2;
+    nose = python.pkgs.nose;
+    pillow = python.pkgs.pillow;
+    pypdf2 = python.pkgs.pypdf2;
+    reportlab = python.pkgs.reportlab;
+};
+
+in
+
+python.pkgs.buildPythonApplication rec {
+  pname = "sasview";
+  version = "4.1.2";
+
+  buildInputs = with python.pkgs; [
+    pytest
+    unittest-xml-reporting];
+
+  propagatedBuildInputs = with python.pkgs; [
+    bumps
+    gcc
+    h5py
+    libxslt
+    lxml
+    matplotlib
+    numpy
+    pyparsing
+    periodictable
+    pillow
+    pylint
+    pyopencl
+    reportlab
+    sasmodels
+    scipy
+    six
+    sphinx
+    wxPython
+    xhtml2pdf];
+
+  src = fetchgit {
+    url = "https://github.com/SasView/sasview.git";
+    rev = "v${version}";
+    sha256 ="05la54wwzzlkhmj8vkr0bvzagyib6z6mgwqbddzjs5y1wd48vpcx";
+  };
+
+  patches = [./pyparsing-fix.patch ./local_config.patch];
+
+  meta = {
+    homepage = https://www.sasview.org;
+    description = "Fitting and data analysis for small angle scattering data";
+    maintainers = with lib.maintainers; [ rprospero ];
+    license = lib.licenses.bsd3;
+  };
+}
diff --git a/pkgs/applications/science/misc/sasview/local_config.patch b/pkgs/applications/science/misc/sasview/local_config.patch
new file mode 100644
index 000000000000..91972a913bc4
--- /dev/null
+++ b/pkgs/applications/science/misc/sasview/local_config.patch
@@ -0,0 +1,10 @@
+--- a/src/sas/_config.py
++++ b/src/sas/_config.py
+@@ -70,2 +70,2 @@
+-        logger.critical("Error loading %s: %s", path, exc)
+-        sys.exit()
++        import sas.sasview.local_config
++        return sas.sasview.local_config
+-- 
+2.15.0
+
diff --git a/pkgs/applications/science/misc/sasview/pyparsing-fix.patch b/pkgs/applications/science/misc/sasview/pyparsing-fix.patch
new file mode 100644
index 000000000000..7729292cb344
--- /dev/null
+++ b/pkgs/applications/science/misc/sasview/pyparsing-fix.patch
@@ -0,0 +1,8 @@
+--- a/setup.py
++++ b/setup.py
+@@ -5,1 +5,1 @@
+-    'bumps>=0.7.5.9', 'periodictable>=1.5.0', 'pyparsing<2.0.0',
++    'bumps>=0.7.5.9', 'periodictable>=1.5.0',
+-- 
+2.15.0
+
diff --git a/pkgs/applications/science/misc/sasview/xhtml2pdf.nix b/pkgs/applications/science/misc/sasview/xhtml2pdf.nix
new file mode 100644
index 000000000000..0b3d438843da
--- /dev/null
+++ b/pkgs/applications/science/misc/sasview/xhtml2pdf.nix
@@ -0,0 +1,32 @@
+{lib, fetchPypi, buildPythonPackage, html5lib, httplib2, nose, pillow, pypdf2, reportlab}:
+
+let
+  #xhtml2pdf specifically requires version "1.0b10" of html5lib
+  html5 = html5lib.overrideAttrs( oldAttrs: rec{
+    version = "1.0b10";
+    src = oldAttrs.src.override {
+      inherit version;
+      sha256 = "1yd068a5c00wd0ajq0hqimv7fd82lhrw0w3s01vbhy9bbd6xapqd";
+    };
+  });
+in
+
+buildPythonPackage rec {
+  pname = "xhtml2pdf";
+  version = "0.2.1";
+
+  buildInputs = [html5];
+  propagatedBuildInputs = [httplib2 nose pillow pypdf2 reportlab html5];
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1n9r8zdk9gc2x539fq60bhszmd421ipj8g78zmsn3njvma1az9k1";
+  };
+
+  meta = {
+    description = "A pdf converter for the ReportLab Toolkit";
+    homepage = https://github.com/xhtml2pdf/xhtml2pdf;
+    license = lib.licenses.asl20;
+    maintainers = with lib.maintainers; [ rprospero ];
+  };
+}