]> git.neil.brown.name Git - edlib.git/commitdiff
python: discard python-load
authorNeilBrown <neil@brown.name>
Fri, 2 Jun 2023 06:24:25 +0000 (16:24 +1000)
committerNeilBrown <neil@brown.name>
Thu, 8 Jun 2023 10:38:58 +0000 (20:38 +1000)
The "python-load" command has never been used, and might not work.
Discard it until I have a reason to resurrect it.

Signed-off-by: NeilBrown <neil@brown.name>
lang-python.c

index fb2eb7bfbf639c0b9c00a2233738ac5a03e3cd6a..2c91355cf31c7b90ea3c4d407d3e3ec950000528 100644 (file)
@@ -3,10 +3,10 @@
  * May be distributed under terms of GPLv2 - see file:COPYING
  *
  * Python3 bindings for edlib.
- * An edlib command "python-load" will read and execute a python
- * script.
- * It can use "edlib.editor" to get the editor instance, and can
- * use "edlib.call()" to issue edlib commands.
+ * An edlib command "global-load-modules:python" will read and execute
+ * a python module.
+ * It must "import edlib" and it can use "edlib.editor" to get the editor
+ * instance.
  *
  * Types available are:
  *  edlib.pane  - a generic pane.  These form a tree of which edlib.editor
@@ -331,34 +331,6 @@ out:
        Py_XDECREF(exc_tb);
 }
 
-DEF_CMD(python_load)
-{
-       const char *fname = ci->str;
-       FILE *fp;
-       PyObject *globals, *main_mod;
-       PyObject *Ed;
-
-       if (!fname)
-               return Enoarg;
-       fp = fopen(fname, "r");
-       if (!fp)
-               return Efail;
-
-       main_mod = PyImport_AddModule("__main__");
-       if (main_mod == NULL)
-               return Einval;
-       globals = PyModule_GetDict(main_mod);
-
-       Ed = Pane_Frompane(ci->home);
-       PyDict_SetItemString(globals, "editor", Ed);
-       PyDict_SetItemString(globals, "edlib", EdlibModule);
-       PyRun_FileExFlags(fp, fname, Py_file_input, globals, globals, 0, NULL);
-       PyErr_LOG();
-       Py_DECREF(Ed);
-       fclose(fp);
-       return 1;
-}
-
 DEF_CMD(python_load_module)
 {
        const char *name = ci->str;
@@ -3005,7 +2977,6 @@ void edlib_init(struct pane *ed safe)
        PyModule_AddIntMacro(m, MARK_POINT);
 
        PyModule_AddIntConstant(m, "WEOF", 0x3FFFFF);
-       call_comm("global-set-command", ed, &python_load, 0, NULL, "python-load");
        call_comm("global-set-command", ed, &python_load_module,
                  0, NULL, "global-load-modules:python");