Added basic implementation for Python code evaluation
This commit is contained in:
@@ -28,6 +28,8 @@ def sysarg_to_string(argv):
|
||||
result += '"' + s + '"' if " " in s else s
|
||||
first = False
|
||||
|
||||
if result[0] in ('"', "'"):
|
||||
result = result[1:-1] # strip quotes
|
||||
return result
|
||||
|
||||
|
||||
@@ -53,15 +55,17 @@ def main(argv):
|
||||
if o in ('-d', "--debug"):
|
||||
debug = True
|
||||
|
||||
init_logging(debug)
|
||||
sheerka = Sheerka()
|
||||
# init_logging(debug)
|
||||
sheerka = Sheerka(debug=debug)
|
||||
sheerka.initialize()
|
||||
|
||||
_in = sysarg_to_string(args)
|
||||
result = sheerka.eval(_in)
|
||||
|
||||
logging.info(result)
|
||||
return result[-1].status
|
||||
for res in result:
|
||||
logging.info(res)
|
||||
|
||||
return result[-1].status if len(result) > 0 else 1
|
||||
except getopt.GetoptError:
|
||||
usage()
|
||||
sys.exit(2)
|
||||
|
||||
Reference in New Issue
Block a user