-#! /usr/bin/env python3
-
-# Copyright (C) 2013-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2013-2019 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
callPython = True
afterArgs = False
else:
+ file_extension = os.path.splitext(elt)[-1]
if not os.path.isfile(elt) and not os.path.isfile(elt+".py"):
eltInSearchPath = __getScriptPath(elt, searchPathList)
if eltInSearchPath is None or (not os.path.isfile(eltInSearchPath) and not os.path.isfile(eltInSearchPath+".py")):
- if elt[-3:] == ".py":
+ if file_extension == ".py":
raise SalomeContextException("Script not found: %s"%elt)
scriptArgs.append(ScriptAndArgs(script=elt))
continue
elt = eltInSearchPath
- if elt[-4:] != ".hdf":
- if elt[-3:] == ".py" or isDriver:
+ if file_extension != ".hdf":
+ if file_extension == ".py" or isDriver:
currentScript = os.path.abspath(elt)
elif os.path.isfile(elt+".py"):
currentScript = os.path.abspath(elt+".py")
scriptArgs.append(ScriptAndArgs(script=currentKey))
callPython = False
elif currentScript:
+ script_extension = os.path.splitext(currentScript)[-1]
if isDriver:
currentKey = currentScript
scriptArgs.append(ScriptAndArgs(script=currentKey))
fn.close()
except:
pass
- if not ispython and currentScript[-3:] == ".py":
+ if not ispython and script_extension == ".py":
currentKey = "@PYTHONBIN@ "+currentScript
else:
currentKey = currentScript