[gnome-commander/gcmd-1-8] Remove python support



commit de92a261ed1b35ab86089eaf454c3e33532d30ed
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Mon Jan 8 19:50:21 2018 +0100

    Remove python support

 configure.ac                              |   76 ------
 data/gnome-commander.ebuild.in            |   15 +-
 doc/C/index.docbook                       |  153 +------------
 plugins/Makefile.am                       |    4 -
 plugins/python/Makefile.am                |    5 -
 plugins/python/apply-patch/Makefile.am    |    7 -
 plugins/python/apply-patch/apply_patch.py |   42 ----
 plugins/python/md5sum/Makefile.am         |    7 -
 plugins/python/md5sum/md5sum.py           |   48 ----
 plugins/python/sha1sum/Makefile.am        |    7 -
 plugins/python/sha1sum/sha1sum.py         |   48 ----
 src/Makefile.am                           |    5 -
 src/gnome-cmd-file-popmenu.cc             |   46 +----
 src/gnome-cmd-python-plugin.cc            |  367 -----------------------------
 src/gnome-cmd-python-plugin.h             |   38 ---
 src/gnome-cmd-user-actions.cc             |   31 ---
 src/main.cc                               |    7 -
 src/utils.cc                              |    1 -
 18 files changed, 4 insertions(+), 903 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 45b7efe..4acedce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -217,78 +217,6 @@ dnl =============================
 
 AC_FUNC_MMAP
 
-dnl ================================================================
-dnl Python
-dnl ================================================================
-
-AC_MSG_CHECKING([whether Python support is requested])
-AC_ARG_ENABLE([python],
-    AS_HELP_STRING([--enable-python],[Enable python support]),
-    [enable_python=$enableval have_python=$enableval],
-    [enable_python=autodetect have_python=yes])
-AC_MSG_RESULT([$enable_python])
-
-if test "x$have_python" != "xno"; then
-    AM_PATH_PYTHON([$PYTHON_REQ],[],[no])
-    if test "x$PYTHON" = "x:"; then
-        have_python=no
-    fi
-fi
-
-if test "x$have_python" != "xno"; then
-    AM_CHECK_PYTHON_HEADERS([],[have_python=no])
-fi
-
-if test "x$have_python" != "xno"; then
-    PY_PREFIX=`$PYTHON -c 'import sys ; print(sys.prefix)'`
-    PY_EXEC_PREFIX=`$PYTHON -c 'import sys ; print(sys.exec_prefix)'`
-    dnl PYTHON_LIBS="-lpython$PYTHON_VERSION"
-    PYTHON_LIBS=`$PYTHON-config --ldflags`
-    dnl PYTHON_CFLAGS="-I$PY_PREFIX/include/python$PYTHON_VERSION"
-    PYTHON_CFLAGS=`$PYTHON-config --cflags`
-    AC_SUBST([PYTHON_LIBS])
-    AC_SUBST([PYTHON_CFLAGS])
-
-    dnl FIXME: do we really need this test?
-    AC_MSG_CHECKING([whether we can build a shared library depending on libpython])
-    rm -rf testpython
-    mkdir testpython
-    cd testpython
-    cat > testpython.c <<EOF
-#include <Python.h>
-int testpython (void)
-{
-Py_Exit (0);
-}
-EOF
-
-    if ${CC} $PYTHON_CFLAGS $PYTHON_LIBS -fPIC -shared -o testpython.so testpython.c 
-Wl,-soname,testpython.so >/dev/null 2>&1 && \
-        ( objdump --headers --private-headers testpython.so | grep 'testpython' ) >/dev/null 2>&1; then
-        result=yes
-    else
-        result=no
-        have_python=no
-    fi
-    cd ..
-    rm -rf testpython
-    AC_MSG_RESULT([$result])
-fi
-
-if test "x$have_python" != "xyes"; then
-    if test "x$enable_python" = "xyes"; then
-        AC_MSG_ERROR([Python not found])
-    elif test "x$enable_python" = "xautodetect"; then
-        enable_python=no
-        AC_MSG_WARN([Python not found, disabling python support])
-    fi
-elif test "x$enable_python" != "xno"; then
-    enable_python=yes
-    AC_DEFINE([HAVE_PYTHON],[1],[Define to compile with python support])
-fi
-
-AM_CONDITIONAL([HAVE_PYTHON],[test "x$enable_python" = "xyes"])
-
-
 dnl =====================
 dnl Set stuff in config.h
 dnl =====================
@@ -341,10 +269,6 @@ pixmaps/file-type-icons/Makefile
 pixmaps/mime-icons/Makefile
 plugins/Makefile
 plugins/fileroller/Makefile
-plugins/python/Makefile
-plugins/python/md5sum/Makefile
-plugins/python/sha1sum/Makefile
-plugins/python/apply-patch/Makefile
 plugins/test/Makefile
 po/Makefile.in
 src/Makefile
diff --git a/data/gnome-commander.ebuild.in b/data/gnome-commander.ebuild.in
index be66bd7..0cff1e8 100644
--- a/data/gnome-commander.ebuild.in
+++ b/data/gnome-commander.ebuild.in
@@ -3,10 +3,9 @@
 
 EAPI=6
 
-PYTHON_COMPAT=( python{2_7,3_4} )
 GNOME2_LA_PUNT="yes"
 
-inherit eutils gnome2 python-single-r1
+inherit eutils gnome2
 
 DESCRIPTION="A graphical, full featured, twin-panel file manager"
 HOMEPAGE="http://gcmd.github.io/";
@@ -14,8 +13,7 @@ HOMEPAGE="http://gcmd.github.io/";
 LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS="~amd64 ~x86"
-IUSE="chm exif gsf pdf python taglib samba test +unique"
-REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+IUSE="chm exif gsf pdf taglib samba test +unique"
 
 RDEPEND="
        app-text/yelp-tools
@@ -31,10 +29,6 @@ RDEPEND="
        gsf? ( >=gnome-extra/libgsf-@LIBGSF_REQ@ )
        samba? ( >=gnome-base/gnome-vfs-@GNOMEVFS_REQ@[samba] )
        pdf? ( >=app-text/poppler-@POPPLER_REQ@ )
-       python? (
-            ${PYTHON_DEPS}
-            >=dev-python/gnome-vfs-python-@GNOMEVFS_REQ@
-       )
        taglib? ( >=media-libs/taglib-@TAGLIB_REQ@ )
 "
 DEPEND="
@@ -45,14 +39,9 @@ DEPEND="
        test? ( >=dev-cpp/gtest-@GTEST_REQ@ )
 "
 
-pkg_setup() {
-       use python && python-single-r1_pkg_setup
-}
-
 src_configure() {
        gnome2_src_configure \
                --disable-static \
-               $(use_enable python) \
                $(use_with chm libchm) \
                $(use_with exif exiv2) \
                $(use_with gsf libgsf) \
diff --git a/doc/C/index.docbook b/doc/C/index.docbook
index 6b98b26..e29abb6 100644
--- a/doc/C/index.docbook
+++ b/doc/C/index.docbook
@@ -514,9 +514,6 @@
         <para>User defined keyboard shortcuts</para>
       </listitem>
       <listitem>
-        <para>Python scripting</para>
-      </listitem>
-      <listitem>
         <para>Plugin support</para>
       </listitem>
       <listitem>
@@ -7089,10 +7086,6 @@
                                     </note></entry>
                     </row>
                     <row valign="top">
-                        <entry><para>Execute Python plugin</para></entry>
-                        <entry><para>Execute python plugin with the given name.</para></entry>
-                    </row>
-                    <row valign="top">
                         <entry><para>Forward one directory</para></entry>
                         <entry><para>Go forward to the next visited directory</para></entry>
                     </row>
@@ -7359,150 +7352,6 @@
     </sect2>
   </sect1>
 
-<!-- ============= Python Plugins ================================ -->
-<!-- This section contains info about the python plugins.-->
-  <sect1 id="gnome-commander-python-plugins">
-    <title>Python Plugins</title>
-        <para>&app; is capable of executing python plugins. A Python plugin is a normal python application 
containing a predefined entry function.</para>
-    <para>&app; comes with built-in plugins:</para>
-    <itemizedlist>
-      <listitem>
-        <para><filename>md5sum</filename> - MD5 (128-bit) checksums of the selected files</para>
-      </listitem>
-      <listitem>
-        <para><filename>sha1sum</filename> - SHA-1 (160-bit) checksums of the selected files</para>
-      </listitem>
-      <listitem>
-        <para><filename>apply_patch</filename> - The plugin applies selected patches to the opposite pane 
using <command>patch -p1</command></para>
-      </listitem>
-    </itemizedlist>
-    <sect2 id="gnome-commander-python-plugins-working-with">
-      <title>Working with plugins</title>
-      <para>To start - simply place your plugin in <filename>~/.gnome-commander/plugins/</filename> 
directory.
-            If the plugin is meant to be accessed system widely, use alternate location: 
<filename>$(libdir)/$(PACKAGE)/plugins/</filename>.</para>
-      <para>Plugins will be added as new entries to the &app; context menus.</para>
-      <note>
-        <para>Keyboard shortcuts can be assigned to execute specific python plugins
-                     (eg. <keycombo><keycap>CTRL</keycap><keycap>5</keycap></keycombo> &#x2192; 
<filename>md5sum</filename>).</para>
-      </note>
-      <para>
-        <variablelist>
-          <title>Python plugins requirements</title>
-          <varlistentry>
-            <term>build</term>
-            <listitem>
-              <para>python-devel &#x2a7e; 2.4</para>
-            </listitem>
-          </varlistentry>
-          <varlistentry>
-            <term>run</term>
-            <listitem>
-              <para>python &#x2a7e; 2.4</para>
-              <para>gnome-python2-gnomevfs</para>
-              <para>pygtk (for GUI)</para>
-            </listitem>
-          </varlistentry>
-        </variablelist>
-      </para>
-    </sect2>
-    <sect2 id="gnome-commander-python-plugins-api">
-      <title>Plugins API</title>
-      <para>The entry (start) point for plugin is always main() function:</para>
-      <programlisting>
-    def main(main_wnd_xid, active_cwd, inactive_cwd, selected_files)
-            </programlisting>
-
-            <para>where parameters are:</para>
-
-            <informaltable frame="topbot">
-                <tgroup cols='2'>
-                    <colspec colname="col1"/>
-                    <colspec colname="col2"/>
-                    <tbody>
-                        <row valign="top">
-                            <entry><para>main_wnd_xid</para></entry>
-                            <entry><para>XID of &app; main toplevel window</para></entry>
-                        </row>
-                        <row valign="top">
-                            <entry><para>active_cwd</para></entry>
-                            <entry><para>full path of current dir of active pane</para></entry>
-                        </row>
-                        <row valign="top">
-                            <entry><para>inactive_cwd</para></entry>
-                            <entry><para>full path of current dir of inactive pane</para></entry>
-                        </row>
-                        <row valign="top">
-                            <entry><para>selected_files</para></entry>
-                            <entry><para>list of selected <ulink 
url="http://www.pygtk.org/pygnomevfs/class-gnomevfs-uri.html"; type="http">file uris</ulink> in active 
pane</para></entry>
-                        </row>
-                    </tbody>
-                </tgroup>
-            </informaltable>
-        </sect2>
-
-        <sect2 id="gnome-commander-python-plugins-md5sum">
-            <title>Sample plugin: md5sum</title>
-      <para>
-        <programlisting>
-    #!/usr/bin/env python
-
-    try:
-        import gnomevfs
-    except ImportError:
-        import gnome.vfs as gnomevfs
-
-    import os
-    import string
-    import hashlib
-
-    def main(main_wnd_xid, active_cwd, inactive_cwd, selected_files):
-
-       parent_dir = string.split(active_cwd, os.sep)[-1]
-        if parent_dir=='':
-            parent_dir = 'root'
-        f_md5sum = file(inactive_cwd+os.sep+parent_dir+'.md5sum', 'w')
-        for uri in selected_files:
-            if gnomevfs.get_file_info(uri).type==gnomevfs.FILE_TYPE_REGULAR:
-                f = file(active_cwd+os.sep+uri.short_name, 'rb')
-                file_content = f.read()
-                f.close()
-                md5sum = hashlib.md5(file_content).hexdigest()
-                f_md5sum.write('%s  %s\n' % (md5sum, uri.short_name))
-        f_md5sum.close()
- 
-       return True
-             </programlisting>
-      </para>
-      <note>
-        <para>The latest version of md5sum code can be found in
-              <ulink type="http" 
url="http://git.gnome.org/cgit/gnome-commander/plain/plugins/python/md5sum/md5sum.py";>git &app; 
repository.</ulink></para>
-      </note>
-    </sect2>
-
-        <sect2 id="gnome-commander-python-plugins-resources">
-            <title>Python resources</title>
-            <para>
-                <itemizedlist>
-                    <listitem>
-                        <para><ulink url="http://www.python.org/doc/"; type="http">Python 
documentation</ulink></para>
-                    </listitem>
-                    <listitem>
-                        <para><ulink url="http://www.pygtk.org/pygnomevfs/"; type="http">Python gnomevfs 
reference manual</ulink></para>
-                    </listitem>
-                    <listitem>
-                        <para><ulink url="http://www.pygtk.org/"; type="http">PyGTK: GTK+ for 
Python</ulink></para>
-                    </listitem>
-                    <listitem>
-                        <para><ulink 
url="http://www.learningpython.com/2006/05/07/creating-a-gui-using-pygtk-and-glade/"; type="http">Creating a 
GUI using PyGTK and Glade</ulink></para>
-                    </listitem>
-                    <listitem>
-                        <para><ulink url="http://sebsauvage.net/python/snyppets/"; type="http">Python code 
snippets</ulink></para>
-                    </listitem>
-                </itemizedlist>
-            </para>
-        </sect2>
-      </sect1>
-      
       <!-- ============= Tips and tricks ======================== -->
       <!-- This section contains info some very simple tips and tricks.-->
       <sect1 id="gnome-commander-tips-and-tricks">
@@ -7753,7 +7602,7 @@
         all in the spirit of free and open source software.</para>
     <para>Known limitation:
     <itemizedlist>
-    <listitem><para>&app; is still lacking on GVFS/GIO support. Instead it uses GnomeVFS. This might be the 
cause that some Python plugins won't run on your system.</para></listitem>
+    <listitem><para>&app; is still lacking on GVFS/GIO support. Instead it uses GnomeVFS.</para></listitem>
     <listitem><para>Configuration of default application depending on the files MIME type is broken and was 
finally removed in v1.4. See section <xref linkend="gnome-commander-mime-types"></xref> for more 
information.</para></listitem>
     </itemizedlist></para>
   <para><emphasis>Given enough eyeballs, all bugs are shallow.</emphasis></para>
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 1bf34a8..ea7c4d6 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -2,8 +2,4 @@
 
 SUBDIRS = test fileroller
 
-if HAVE_PYTHON
-SUBDIRS += python
-endif
-
 -include $(top_srcdir)/git.mk
diff --git a/src/Makefile.am b/src/Makefile.am
index 33226fb..1474a82 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -84,11 +84,6 @@ gnome_commander_SOURCES = \
        utils-no-dependencies.h utils-no-dependencies.cc \
        widget-factory.h
 
-if HAVE_PYTHON
-gnome_commander_SOURCES += \
-       gnome-cmd-python-plugin.h gnome-cmd-python-plugin.cc
-endif
-
 if HAVE_SAMBA
 gnome_commander_SOURCES += \
        gnome-cmd-con-smb.h gnome-cmd-con-smb.cc \
diff --git a/src/gnome-cmd-file-popmenu.cc b/src/gnome-cmd-file-popmenu.cc
index 97bb11f..252b8b4 100644
--- a/src/gnome-cmd-file-popmenu.cc
+++ b/src/gnome-cmd-file-popmenu.cc
@@ -28,7 +28,6 @@
 #include "gnome-cmd-data.h"
 #include "gnome-cmd-main-win.h"
 #include "plugin_manager.h"
-#include "gnome-cmd-python-plugin.h"
 #include "gnome-cmd-user-actions.h"
 #include "utils.h"
 #include "cap.h"
@@ -295,14 +294,6 @@ static void on_execute (GtkMenuItem *menu_item, GList *files)
 }
 
 
-static void on_execute_py_plugin (GtkMenuItem *menu_item, PythonPluginData *data)
-{
-#ifdef HAVE_PYTHON
-    gnome_cmd_python_plugin_execute(data, main_win);
-#endif
-}
-
-
 static void on_execute_script (GtkMenuItem *menu_item, ScriptData *data)
 {
     GdkModifierType mask;
@@ -740,41 +731,6 @@ GtkWidget *gnome_cmd_file_popmenu_new (GnomeCmdFileList *fl)
     if (match_count > 0)
         gnome_app_fill_menu (GTK_MENU_SHELL (menu), sep_uiinfo, NULL, FALSE, pos++);
 
-    GList *py_plugins = NULL;
-#ifdef HAVE_PYTHON
-    py_plugins = gnome_cmd_python_plugin_get_list();
-#endif
-    guint n = g_list_length (py_plugins);
-
-    if (n)
-    {
-        GnomeUIInfo *py_uiinfo = g_new0 (GnomeUIInfo, n+1);
-        GnomeUIInfo *tmp = py_uiinfo;
-
-        for (; py_plugins; py_plugins = py_plugins->next, ++tmp)
-        {
-            PythonPluginData *data = (PythonPluginData *) py_plugins->data;
-
-            if (data)
-            {
-                tmp->type = GNOME_APP_UI_ITEM;
-                tmp->label = _(data->name);
-                tmp->moreinfo = (gpointer) on_execute_py_plugin;
-                tmp->user_data = data;
-                tmp->pixmap_type = GNOME_APP_PIXMAP_NONE; // GNOME_APP_PIXMAP_FILENAME;
-                // tmp->pixmap_info = "pixmaps/python-plugin.svg";
-            }
-        }
-
-        tmp->type = GNOME_APP_UI_ENDOFINFO;
-
-        gnome_app_fill_menu (GTK_MENU_SHELL (menu), py_uiinfo, NULL, FALSE, pos);
-        pos += n;
-        gnome_app_fill_menu (GTK_MENU_SHELL (menu), sep_uiinfo, NULL, FALSE, pos++);
-
-        g_free (py_uiinfo);
-    }
-       
     // Script actions
     gchar *user_dir = g_build_filename (g_get_home_dir (), "." PACKAGE "/scripts", NULL);
     DIR *dp = opendir (user_dir);
@@ -798,7 +754,7 @@ GtkWidget *gnome_cmd_file_popmenu_new (GnomeCmdFileList *fl)
         closedir (dp);
     }
 
-    n = g_list_length(slist);
+    guint n = g_list_length(slist);
     if (n)
     {
         GnomeUIInfo *py_uiinfo = g_new0 (GnomeUIInfo, n+1);
diff --git a/src/gnome-cmd-user-actions.cc b/src/gnome-cmd-user-actions.cc
index bd44d10..e67c178 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -32,7 +32,6 @@
 #include "gnome-cmd-file-list.h"
 #include "gnome-cmd-file-selector.h"
 #include "gnome-cmd-main-win.h"
-#include "gnome-cmd-python-plugin.h"
 #include "gnome-cmd-user-actions.h"
 #include "gnome-cmd-dir-indicator.h"
 #include "gnome-cmd-style.h"
@@ -251,7 +250,6 @@ static UserActionData user_actions_data[] = {
                                              {options_edit, "options.edit", N_("Options")},
                                              {options_edit_shortcuts, "options.shortcuts", N_("Keyboard 
shortcuts")},
                                              {plugins_configure, "plugins.configure", N_("Configure 
plugins")},
-                                             {plugins_execute_python, "plugins.execute_python", N_("Execute 
Python plugin")},
                                              {view_back, "view.back", N_("Back one directory")},
                                              {view_close_tab, "view.close_tab", N_("Close the current tab")},
                                              {view_close_all_tabs, "view.close_all_tabs", N_("Close all 
tabs")},
@@ -387,13 +385,6 @@ void GnomeCmdUserActions::init()
     if (!registered("options.edit"))
         register_action(GDK_CONTROL_MASK, GDK_O, "options.edit");
 
-    if (!registered("plugins.execute_python"))
-    {
-        register_action(GDK_CONTROL_MASK, GDK_5, "plugins.execute_python", "md5sum");
-        register_action(GDK_CONTROL_MASK, GDK_KP_5, "plugins.execute_python", "md5sum");
-        register_action(GDK_CONTROL_MASK, GDK_KP_Begin, "plugins.execute_python", "md5sum");
-    }
-
     if (!registered("dir_history"))
     {
         register_action(GDK_MOD1_MASK, GDK_Down, "view.dir_history");
@@ -1958,28 +1949,6 @@ void plugins_configure (GtkMenuItem *menuitem, gpointer not_used)
 }
 
 
-void plugins_execute_python (GtkMenuItem *menuitem, gpointer python_script)
-{
-    if (!python_script)
-        return;
-
-#ifdef HAVE_PYTHON
-    for (GList *py_plugins = gnome_cmd_python_plugin_get_list(); py_plugins; py_plugins = py_plugins->next)
-    {
-        PythonPluginData *py_plugin = (PythonPluginData *) py_plugins->data;
-
-        if (!g_ascii_strcasecmp (py_plugin->name, (gchar *) python_script))
-        {
-            gnome_cmd_python_plugin_execute (py_plugin, main_win);
-            return;
-        }
-    }
-#else
-    g_warning ("Python plugins not supported");
-#endif
-}
-
-
 /************** Help Menu **************/
 
 void help_help (GtkMenuItem *menuitem, gpointer not_used)
diff --git a/src/main.cc b/src/main.cc
index 6d1dfaa..b958d4b 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -44,7 +44,6 @@ extern "C"
 #include "ls_colors.h"
 #include "imageloader.h"
 #include "plugin_manager.h"
-#include "gnome-cmd-python-plugin.h"
 #include "tags/gnome-cmd-tags.h"
 
 using namespace std;
@@ -184,15 +183,9 @@ int main (int argc, char *argv[])
 
         gcmd_tags_init();
         plugin_manager_init ();
-#ifdef HAVE_PYTHON
-        python_plugin_manager_init ();
-#endif
 
         gtk_main ();
 
-#ifdef HAVE_PYTHON
-        python_plugin_manager_shutdown ();
-#endif
         plugin_manager_shutdown ();
         gcmd_tags_shutdown ();
         gcmd_user_actions.shutdown();
diff --git a/src/utils.cc b/src/utils.cc
index cba724e..547f946 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -56,7 +56,6 @@ static gchar *tmp_file_dir = NULL;
  * l: directory listings\n
  * m: connection debugging\n
  * n: directory monitoring\n
- * p: python plugins\n
  * s: smb network browser\n
  * t: metadata tags\n
  * u: user actions debugging\n


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]