[sasview] 05/07: Fix schema finding for cansas format

Stuart Prescott stuart at debian.org
Mon Jan 1 13:38:13 UTC 2018


This is an automated email from the git hooks/post-receive script.

stuart pushed a commit to branch master
in repository sasview.

commit 213562cd84c464a8881ecc56195313e656ae0875
Author: Stuart Prescott <stuart at debian.org>
Date:   Tue Jan 2 00:29:23 2018 +1100

    Fix schema finding for cansas format
---
 debian/patches/schema-path.patch | 35 +++++++++++++++++++++++++++++++++++
 debian/patches/series            |  1 +
 2 files changed, 36 insertions(+)

diff --git a/debian/patches/schema-path.patch b/debian/patches/schema-path.patch
new file mode 100644
index 0000000..e8edbc0
--- /dev/null
+++ b/debian/patches/schema-path.patch
@@ -0,0 +1,35 @@
+Description: Fix schema finding code for reading cansas files
+Author: Stuart Prescott <stuart at debian.org>
+--- a/src/sas/sascalc/dataloader/readers/cansas_reader.py
++++ b/src/sas/sascalc/dataloader/readers/cansas_reader.py
+@@ -1,5 +1,6 @@
+ import logging
+ import os
++import os.path
+ import sys
+ import datetime
+ import inspect
+@@ -150,10 +151,6 @@
+                 self.f_open.close()
+ 
+     def load_file_and_schema(self, xml_file, schema_path=""):
+-        base_name = xml_reader.__file__
+-        base_name = base_name.replace("\\", "/")
+-        base = base_name.split("/sas/")[0]
+-
+         # Try and parse the XML file
+         try:
+             self.set_xml_file(xml_file)
+@@ -165,8 +162,10 @@
+         self.cansas_defaults = CANSAS_NS.get(self.cansas_version, "1.0")
+ 
+         if schema_path == "":
+-            schema_path = "{}/sas/sascalc/dataloader/readers/schema/{}".format(
+-                base, self.cansas_defaults.get("schema").replace("\\", "/")
++            schema_path = os.path.join(
++                os.path.dirname(__file__),
++                "schema",
++                self.cansas_defaults.get("schema").replace("\\", "/")
+             )
+         self.set_schema(schema_path)
+ 
diff --git a/debian/patches/series b/debian/patches/series
index f78e8fa..b000fe3 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@ limit-docs-sasview.patch
 sphinx-local-mathjax.patch
 filereader-class.patch
 standalone-utests.patch
+schema-path.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sasview.git



More information about the debian-science-commits mailing list