[sasmodels] 03/04: Fix failures from trying to remove pyc files

Stuart Prescott stuart at debian.org
Wed Jan 3 14:09:04 UTC 2018


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

stuart pushed a commit to branch master
in repository sasmodels.

commit d1cb3d63b03298c5f59e62890d347cf7a35fac88
Author: Stuart Prescott <stuart at debian.org>
Date:   Thu Jan 4 00:47:49 2018 +1100

    Fix failures from trying to remove pyc files
---
 debian/patches/custom_model_pyc.patch | 19 +++++++++++++++++++
 debian/patches/series                 |  1 +
 2 files changed, 20 insertions(+)

diff --git a/debian/patches/custom_model_pyc.patch b/debian/patches/custom_model_pyc.patch
new file mode 100644
index 0000000..b26c8f2
--- /dev/null
+++ b/debian/patches/custom_model_pyc.patch
@@ -0,0 +1,19 @@
+Description: Don't fail when pyc files in /usr/lib can't be removed
+ sasview tries to open local_config.py using load_module_from_path() but
+ local_config.py(c) will be in a read-only location in /usr/lib so this
+ fails.
+Author: Stuart Prescott <stuart at debian.org>
+--- a/sasmodels/custom/__init__.py
++++ b/sasmodels/custom/__init__.py
+@@ -32,7 +32,10 @@
+             del sys.modules[fullname]
+         if path.endswith(".py") and os.path.exists(path) and os.path.exists(path+"c"):
+             # remove automatic pyc file before loading a py file
+-            os.unlink(path+"c")
++            try:
++                os.unlink(path+"c")
++            except:
++                pass
+         module = imp.load_source(fullname, os.path.expanduser(path))
+         return module
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 03ed24d..547555f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
+custom_model_pyc.patch
 disable-failing-test.patch
 sphinx-local-mathjax.patch
 precompiled_path.patch

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



More information about the debian-science-commits mailing list