Commit ea7f16b8 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

add_path is now a set (prevent duplicates)

parent aa33296e
......@@ -572,12 +572,11 @@ class Component(object):
return new_ios,includes
def add_python_execution(self, function, inputs=[], outputs=[], arguments=[], includes=[],
add_path=list(), collect=False, local=False, map=False, cmd_format=""):
add_path=set(), collect=False, local=False, map=False, cmd_format=""):
workflow_dir = Path(os.path.dirname(inspect.getfile(self.__class__))).parent
lib_dir = str(workflow_dir) + os.path.sep + "lib"
if not lib_dir in add_path:
add_path.append(lib_dir)
add_path.add(lib_dir)
if map:
if not issubclass(inputs.__class__, list) or not issubclass(outputs.__class__, list):
......
......@@ -276,11 +276,11 @@ if __name__ == '__main__':
pass
if add_path:
add_path += [os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'),
os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..')]
add_path.update([os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'),
os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..')])
else:
add_path = [os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'),
os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..')]
add_path = {os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'),
os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..')}
path = ""
for apath in add_path:
path += "sys.path.insert(0, '" + apath + "')\n"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment