From 73ed353d271f2f49dc258aa906a7e58321d196a2 Mon Sep 17 00:00:00 2001 From: Adam Washington Date: Fri, 9 Mar 2018 12:08:34 +0000 Subject: [PATCH] sasview: init at 4.1.2 Sasview is a data fitting and analysis package for small angle scattering data. More information can be found at https://www.sasview.org. There is some unfortunate cruft to this commit. SasView uses the xhtml2pdf python package, which has a specific version of html5lib as a dependency. This module manually loads that version into sasview. I haven't made xhtml2pdf available as its own package due to these circumstances. --- .../science/misc/sasview/default.nix | 51 +++++++++++++++++++ .../science/misc/sasview/local_config.patch | 10 ++++ .../science/misc/sasview/myHtml5.nix | 20 ++++++++ .../science/misc/sasview/pyparsing-fix.patch | 8 +++ .../science/misc/sasview/xhtml2pdf.nix | 15 ++++++ pkgs/top-level/all-packages.nix | 2 + 6 files changed, 106 insertions(+) create mode 100644 pkgs/applications/science/misc/sasview/default.nix create mode 100644 pkgs/applications/science/misc/sasview/local_config.patch create mode 100644 pkgs/applications/science/misc/sasview/myHtml5.nix create mode 100644 pkgs/applications/science/misc/sasview/pyparsing-fix.patch create mode 100644 pkgs/applications/science/misc/sasview/xhtml2pdf.nix diff --git a/pkgs/applications/science/misc/sasview/default.nix b/pkgs/applications/science/misc/sasview/default.nix new file mode 100644 index 00000000000..45bdeef92bc --- /dev/null +++ b/pkgs/applications/science/misc/sasview/default.nix @@ -0,0 +1,51 @@ +{lib, fetchgit, gcc, python}: + +let + html5 = import ./myHtml5.nix {inherit python;}; + xhtml2pdf = import ./xhtml2pdf.nix {inherit python html5;}; +in + +python.pkgs.buildPythonApplication rec { + name = "sasview-${version}"; + version = "4.1.2"; + + propagatedBuildInputs = with python.pkgs; [ + bumps + gcc + h5py + html5 + libxslt + lxml + matplotlib + numpy + pyparsing + periodictable + pillow + pylint + pyopencl + pytest + reportlab + sasmodels + scipy + six + sphinx + unittest-xml-reporting + wxPython + xhtml2pdf]; + + src = fetchgit { + url = "https://github.com/SasView/sasview.git"; + rev = "v${version}"; + sha256 ="05la54wwzzlkhmj8vkr0bvzagyib6z6mgwqbddzjs5y1wd48vpcx"; + }; + + patches = [./pyparsing-fix.patch ./local_config.patch]; + sandbox = true; + + 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 00000000000..91972a913bc --- /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/myHtml5.nix b/pkgs/applications/science/misc/sasview/myHtml5.nix new file mode 100644 index 00000000000..17e6a6d52e2 --- /dev/null +++ b/pkgs/applications/science/misc/sasview/myHtml5.nix @@ -0,0 +1,20 @@ +{python}: + +python.pkgs.buildPythonPackage (rec{ + buildInputs = with python.pkgs; [ flake8 pytest pytest-expect mock ]; + propagatedBuildInputs = with python.pkgs; [ + six webencodings + ]; + + checkPhase = '' + py.test + ''; + pname = "html5lib"; + name = "html5lib-${version}"; + version = "1.0b10"; + src = python.pkgs.fetchPypi { + pname = "html5lib"; + inherit version; + sha256 = "1yd068a5c00wd0ajq0hqimv7fd82lhrw0w3s01vbhy9bbd6xapqd"; + }; +}) 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 00000000000..7729292cb34 --- /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 00000000000..9f2b8e01a27 --- /dev/null +++ b/pkgs/applications/science/misc/sasview/xhtml2pdf.nix @@ -0,0 +1,15 @@ +{python, html5}: + +python.pkgs.buildPythonPackage rec { + name = "${pname}-${version}"; + pname = "xhtml2pdf"; + version = "0.2.1"; + + buildInputs = [html5]; + propagatedBuildInputs = with python.pkgs; [httplib2 pillow pypdf2 reportlab html5]; + + src = python.pkgs.fetchPypi { + inherit pname version; + sha256 = "1n9r8zdk9gc2x539fq60bhszmd421ipj8g78zmsn3njvma1az9k1"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b83424eabba..ce5fb12c38f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4633,6 +4633,8 @@ with pkgs; samplicator = callPackage ../tools/networking/samplicator { }; + sasview = callPackage ../applications/science/misc/sasview {}; + scanbd = callPackage ../tools/graphics/scanbd { }; screen = callPackage ../tools/misc/screen {