We have used the following patch earlier on clusters with similar problems with swig:
diff --git a/instant/config.py b/instant/config.py
index 34dd0ee..a3f3822 100644
--- a/instant/config.py
+++ b/instant/config.py
@@ -12,6 +12,7 @@ _header_and_library_cache = {}
def check_and_set_swig_binary(binary="swig", path=""):
""" Check if a particular swig binary is available"""
+ return True
global _swig_binary_cache
if not isinstance(binary, str):
raise TypeError("expected a 'str' as first argument")
@@ -35,10 +36,12 @@ def check_and_set_swig_binary(binary="swig", path=""):
def get_swig_binary():
"Return any cached swig binary"
+ return "/usit/abel/u1/johannr/nobackup/fenics-deps-gcc/bin/swig"
return _swig_binary_cache if _swig_binary_cache else "swig"
def get_swig_version():
""" Return the current swig version in a 'str'"""
+ return "2.0.8"
global _swig_version_cache
if _swig_version_cache is None:
# Check for swig installation
@@ -65,6 +68,7 @@ def check_swig_version(version, same=False):
else:
print "Swig version is lower than 1.3.36"
"""
+ return True
assert isinstance(version,str), "Provide the first version number as a 'str'"
assert len(version.split("."))==3, "Provide the version number as three numbers seperated by '.'"
Make sure to change the path to the swig binary and the version string to match your setup.
You might also need to apply the following patch to Instant:
diff --git a/instant/output.py b/instant/output.py
index 34a3165..1b27651 100644
--- a/instant/output.py
+++ b/instant/output.py
@@ -90,29 +90,29 @@ def get_output(cmd):
return output
# Some HPC platforms does not work with the subprocess module and needs commands
-#import platform
-#if platform.system() == "Windows":
-# # Taken from http://ivory.idyll.org/blog/mar-07/replacing-commands-with-subprocess
-# from subprocess import Popen, PIPE, STDOUT
-# def get_status_output(cmd, input=None, cwd=None, env=None):
-# "Replacement for commands.getstatusoutput which does not work on Windows."
-# pipe = Popen(cmd, shell=True, cwd=cwd, env=env, stdout=PIPE, stderr=STDOUT)
-#
-# (output, errout) = pipe.communicate(input=input)
-# assert not errout
-#
-# status = pipe.returncode
-#
-# return (status, output)
-#
-# def get_output(cmd):
-# "Replacement for commands.getoutput which does not work on Windows."
-# pipe = Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, bufsize=-1)
-# r = pipe.wait()
-# output, error = pipe.communicate()
-# return output
-#
-#else:
-# import commands
-# get_status_output = commands.getstatusoutput
-# get_output = commands.getoutput
+import platform
+if platform.system() == "Windows":
+ # Taken from http://ivory.idyll.org/blog/mar-07/replacing-commands-with-subprocess
+ from subprocess import Popen, PIPE, STDOUT
+ def get_status_output(cmd, input=None, cwd=None, env=None):
+ "Replacement for commands.getstatusoutput which does not work on Windows."
+ pipe = Popen(cmd, shell=True, cwd=cwd, env=env, stdout=PIPE, stderr=STDOUT)
+
+ (output, errout) = pipe.communicate(input=input)
+ assert not errout
+
+ status = pipe.returncode
+
+ return (status, output)
+
+ def get_output(cmd):
+ "Replacement for commands.getoutput which does not work on Windows."
+ pipe = Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, bufsize=-1)
+ r = pipe.wait()
+ output, error = pipe.communicate()
+ return output
+
+else:
+ import commands
+ get_status_output = commands.getstatusoutput
+ get_output = commands.getoutput