diff --git a/src/ncc/Classes/PythonExtension/Python2Runner.php b/src/ncc/Classes/PythonExtension/Python2Runner.php new file mode 100644 index 0000000..0f8ca05 --- /dev/null +++ b/src/ncc/Classes/PythonExtension/Python2Runner.php @@ -0,0 +1,53 @@ +Execute->Target = null; + $execution_unit->ExecutionPolicy = $policy; + $execution_unit->Data = Base64::encode(IO::fread($path)); + + return $execution_unit; + } + + /** + * @inheritDoc + */ + public static function getFileExtension(): string + { + return '.py'; + } + + /** + * @inheritDoc + */ + public static function prepareProcess(ExecutionPointer $pointer): Process + { + $python_bin = PathFinder::findRunner(Runners::python2); + + if($pointer->ExecutionPolicy->Execute->Options !== null && count($pointer->ExecutionPolicy->Execute->Options) > 0) + return new Process(array_merge([$python_bin, $pointer->FilePointer], $pointer->ExecutionPolicy->Execute->Options)); + return new Process([$python_bin, $pointer->FilePointer]); + } + } \ No newline at end of file