# HG changeset patch
# Node ID 0a57e3883496
# Parent  20f8c9dcfbed
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -14,18 +14,19 @@
 
 To build, you will need [Meson](https://mesonbuild.com/),
 [GLib](https://wiki.gnome.org/Projects/GLib),
-[ncurses](https://www.gnu.org/software/ncurses/ncurses.html),
-[libxml2](http://xmlsoft.org/), and [Python 3](https://www.python.org/). Exact
-versions can be determined from the `meson.build` in the top-level directory.
+[ncurses](https://www.gnu.org/software/ncurses/ncurses.html), and
+[libxml2](http://xmlsoft.org/). Exact versions can be determined from the
+`meson.build` in the top-level directory.
 
 On Debian-based systems, install `meson` `ninja-build` `gobject-introspection`
 `libgirepository1.0-dev` `gtk-doc-tools` `libglib2.0-dev` `libxml2-dev`
-`libncurses-dev` `libpython3-dev`.
+`libncurses-dev`.
 
 On Fedora-based systems, install `meson` `ninja-build` `gobject-introspection`
-`gtk-doc` `glib2-devel` `libxml2-devel` `ncurses-devel` `python3-devel`.
+`gtk-doc` `glib2-devel` `libxml2-devel` `ncurses-devel`.
 
-You can then run Meson and Ninja as usual (passing any `-D` options if necessary):
+You can then run Meson and Ninja as usual (passing any `-D` options if
+necessary):
 
 ```bash
 $ meson build
diff --git a/convey.yml b/convey.yml
--- a/convey.yml
+++ b/convey.yml
@@ -28,7 +28,7 @@
     workdir: ${CONVEY_WORKSPACE}
     script:
       - set -ex
-      - meson setup build-docs -Ddoc=true -Dpython2=false
+      - meson setup build-docs -Ddoc=true
       - ninja -C build-docs libgnt-doc
       - cd build-docs/doc
       - mv html gnt2
diff --git a/gntwm.c b/gntwm.c
--- a/gntwm.c
+++ b/gntwm.c
@@ -22,12 +22,6 @@
 
 #include "gntconfig.h"
 
-#ifdef USE_PYTHON
-#include <Python.h>
-#endif
-
-/* Python.h may define _GNU_SOURCE and _XOPEN_SOURCE_EXTENDED, so protect
- * these checks with #ifndef/!defined() */
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
@@ -103,9 +97,6 @@
 static gboolean idle_update;
 static GList *act = NULL; /* list of WS with unseen activitiy */
 static gboolean ignore_keys = FALSE;
-#ifdef USE_PYTHON
-static gboolean started_python = FALSE;
-#endif
 
 static GList *
 g_list_bring_to_front(GList *list, gpointer data)
@@ -1280,49 +1271,6 @@
 	return TRUE;
 }
 
-#ifdef USE_PYTHON
-static void
-python_script_selected(GntFileSel *fs, const char *path, const char *f, gpointer n)
-{
-	char *dir = g_path_get_dirname(path);
-	FILE *file = fopen(path, "r");
-	PyObject *pp = PySys_GetObject("path");
-#if PY_MAJOR_VERSION >= 3
-	PyObject *dirobj = PyUnicode_FromString(dir);
-#else
-	PyObject *dirobj = PyString_FromString(dir);
-#endif
-
-	PyList_Insert(pp, 0, dirobj);
-	Py_DECREF(dirobj);
-	PyRun_SimpleFile(file, path);
-	fclose(file);
-
-	if (PyErr_Occurred()) {
-		PyErr_Print();
-	}
-	g_free(dir);
-
-	gnt_widget_destroy(GNT_WIDGET(fs));
-}
-
-static gboolean
-run_python(GntBindable *bindable, GList *n)
-{
-	GntWidget *window = gnt_file_sel_new();
-	GntFileSel *sel = GNT_FILE_SEL(window);
-
-	g_object_set(G_OBJECT(window), "vertical", TRUE, NULL);
-	gnt_box_add_widget(GNT_BOX(window), gnt_label_new("Please select the python script you want to run."));
-	gnt_box_set_title(GNT_BOX(window), "Select Python Script...");
-
-	g_signal_connect(G_OBJECT(sel), "file_selected", G_CALLBACK(python_script_selected), NULL);
-	g_signal_connect_swapped(G_OBJECT(sel->cancel), "activate", G_CALLBACK(gnt_widget_destroy), sel);
-	gnt_widget_show(window);
-	return TRUE;
-}
-#endif  /* USE_PYTHON */
-
 static gboolean
 help_for_bindable(GntWM *wm, GntBindable *bindable)
 {
@@ -1396,12 +1344,6 @@
 		g_object_unref(wm->workspaces->data);
 		wm->workspaces = g_list_delete_link(wm->workspaces, wm->workspaces);
 	}
-#ifdef USE_PYTHON
-	if (started_python) {
-		Py_Finalize();
-		started_python = FALSE;
-	}
-#endif
 }
 
 static void
@@ -1583,25 +1525,6 @@
 	snprintf(key, sizeof(key), "\033%s", GNT_KEY_BACK_TAB);
 	gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-prev-urgent", window_prev_urgent,
 				key[1] ? key : NULL, NULL);
-#ifdef USE_PYTHON
-	gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "run-python", run_python,
-				GNT_KEY_F3, NULL);
-	if (!Py_IsInitialized()) {
-#if PY_MAJOR_VERSION >= 3
-		wchar_t *name;
-		size_t len;
-		len = mbstowcs(NULL, "gnt", 0);
-		name = g_new(wchar_t, len + 1);
-		mbstowcs(name, "gnt", len + 1);
-		Py_SetProgramName(name);
-		g_free(name);
-#else
-		Py_SetProgramName("gnt");
-#endif
-		Py_Initialize();
-		started_python = TRUE;
-	}
-#endif
 
 	gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), GNT_BINDABLE_CLASS(klass));
 
diff --git a/meson.build b/meson.build
--- a/meson.build
+++ b/meson.build
@@ -190,20 +190,6 @@
 	'gnt.h'
 ]
 
-# Check for Python headers
-python_dep = disabler()
-if get_option('python2')
-	python_dep = dependency('python2', required : false)
-	if not python_dep.found()
-		python_dep = dependency('python-2.7', required : false)
-	endif
-
-	if not python_dep.found()
-		error('failed to find python')
-	endif
-endif
-gnt_config.set('USE_PYTHON', get_option('python2'))
-
 configure_file(output : 'gntconfig.h',
     configuration : gnt_config)
 
@@ -221,9 +207,6 @@
 
 libgnt_inc = include_directories('.')
 libgnt_dependencies= [ncurses, libxml, glib, gobject, gmodule]
-if get_option('python2')
-	libgnt_dependencies += python_dep
-endif
 libgnt = library('gnt',
                  libgnt_SOURCES + gntmarshal,
                  install : true,
diff --git a/meson_options.txt b/meson_options.txt
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,9 +1,3 @@
-option(
-	'python2',
-	type: 'boolean', value: true,
-	description: 'Whether or not to include python support.',
-)
-
 option(
 	'doc',
 	type: 'boolean', value: true,
