2022-01-19 04:54:49 +00:00
|
|
|
var SHELL = require("lib/shell");
|
|
|
|
|
2023-09-07 11:14:06 +00:00
|
|
|
function PythonObject(platform) {
|
2022-01-19 04:54:49 +00:00
|
|
|
this.version = "3.10.2-embed";
|
2023-09-07 11:14:06 +00:00
|
|
|
this.platform = platform;
|
|
|
|
|
2022-01-19 04:54:49 +00:00
|
|
|
this.setVersion = function(version) {
|
|
|
|
this.version = version;
|
|
|
|
};
|
|
|
|
|
2022-01-25 07:49:36 +00:00
|
|
|
this.execScript = function(scriptName, args) {
|
2022-01-19 04:54:49 +00:00
|
|
|
return SHELL.exec([
|
|
|
|
"bin\\python-" + this.version + "\\" + this.platform + "\\python",
|
|
|
|
scriptName
|
|
|
|
].concat(args));
|
|
|
|
};
|
2023-09-07 11:14:06 +00:00
|
|
|
|
|
|
|
this.runScript = function(scriptName, args) {
|
|
|
|
return SHELL.show([
|
|
|
|
"bin\\python-" + this.version + "\\" + this.platform + "\\python",
|
|
|
|
scriptName
|
|
|
|
].concat(args));
|
|
|
|
};
|
2022-01-19 04:54:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
exports.PythonObject = PythonObject;
|
2022-01-25 07:49:36 +00:00
|
|
|
|
2023-09-07 11:14:06 +00:00
|
|
|
exports.create = function(platform) {
|
|
|
|
var platform = (typeof platform !== "undefined" ? platform : "amd64");
|
|
|
|
return new PythonObject(platform);
|
2022-01-19 04:54:49 +00:00
|
|
|
};
|
|
|
|
|
2022-01-25 07:49:36 +00:00
|
|
|
exports.execScript = function(scriptName, args) {
|
|
|
|
return (new PythonObject()).execScript(scriptName, args);
|
|
|
|
};
|
|
|
|
|
2023-09-07 11:14:06 +00:00
|
|
|
exports.VERSIONINFO = "Python Interface (python3.js) version 0.2";
|
2022-01-19 04:54:49 +00:00
|
|
|
exports.global = global;
|
|
|
|
exports.require = global.require;
|