Added scripts to just install the eric6 debug clients in an eric6DebugClients package 6_1_x

Sun, 24 Jul 2016 16:50:04 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 24 Jul 2016 16:50:04 +0200
branch
6_1_x
changeset 5056
ba04754da6a4
parent 5052
6803b3fcc4c9
child 5057
6911444f5b9b

Added scripts to just install the eric6 debug clients in an eric6DebugClients package
(grafted from dac4920b55ad65a9c5b16534e8264708ca17c464)

Documentation/Source/eric6.install-debugclients.html file | annotate | diff | comparison | revisions
Documentation/Source/eric6.uninstall-debugclients.html file | annotate | diff | comparison | revisions
eric6.e4p file | annotate | diff | comparison | revisions
install-debugclients.py file | annotate | diff | comparison | revisions
uninstall-debugclients.py file | annotate | diff | comparison | revisions
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Documentation/Source/eric6.install-debugclients.html	Sun Jul 24 16:50:04 2016 +0200
@@ -0,0 +1,194 @@
+<!DOCTYPE html>
+<html><head>
+<title>eric6.install-debugclients</title>
+<meta charset="UTF-8">
+<style>
+body {
+    background: #EDECE6;
+    margin: 0em 1em 10em 1em;
+    color: black;
+}
+
+h1 { color: white; background: #85774A; }
+h2 { color: white; background: #85774A; }
+h3 { color: white; background: #9D936E; }
+h4 { color: white; background: #9D936E; }
+    
+a { color: #BA6D36; }
+
+</style>
+</head>
+<body><a NAME="top" ID="top"></a>
+<h1>eric6.install-debugclients</h1>
+<p>
+Installation script for the eric6 debug clients.
+</p>
+<h3>Global Attributes</h3>
+<table>
+<tr><td>currDir</td></tr><tr><td>distDir</td></tr><tr><td>doCleanup</td></tr><tr><td>doCompile</td></tr><tr><td>installPackage</td></tr><tr><td>modDir</td></tr><tr><td>progName</td></tr><tr><td>pyModDir</td></tr><tr><td>sourceDir</td></tr>
+</table>
+<h3>Classes</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<h3>Functions</h3>
+<table>
+<tr>
+<td><a href="#cleanUp">cleanUp</a></td>
+<td>Uninstall the old eric debug client files.</td>
+</tr><tr>
+<td><a href="#cleanupSource">cleanupSource</a></td>
+<td>Cleanup the sources directory to get rid of leftover files and directories.</td>
+</tr><tr>
+<td><a href="#copyTree">copyTree</a></td>
+<td>Copy files of a directory tree.</td>
+</tr><tr>
+<td><a href="#exit">exit</a></td>
+<td>Exit the install script.</td>
+</tr><tr>
+<td><a href="#initGlobals">initGlobals</a></td>
+<td>Module function to set the values of globals that need more than a simple assignment.</td>
+</tr><tr>
+<td><a href="#installEricDebugClients">installEricDebugClients</a></td>
+<td>Actually perform the installation steps.</td>
+</tr><tr>
+<td><a href="#main">main</a></td>
+<td>The main function of the script.</td>
+</tr><tr>
+<td><a href="#shutilCopy">shutilCopy</a></td>
+<td>Wrapper function around shutil.copy() to ensure the permissions.</td>
+</tr><tr>
+<td><a href="#usage">usage</a></td>
+<td>Display a usage message and exit.</td>
+</tr>
+</table>
+<hr /><hr />
+<a NAME="cleanUp" ID="cleanUp"></a>
+<h2>cleanUp</h2>
+<b>cleanUp</b>(<i></i>)
+<p>
+    Uninstall the old eric debug client files.
+</p>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
+<a NAME="cleanupSource" ID="cleanupSource"></a>
+<h2>cleanupSource</h2>
+<b>cleanupSource</b>(<i>dirName</i>)
+<p>
+    Cleanup the sources directory to get rid of leftover files
+    and directories.
+</p><dl>
+<dt><i>dirName</i></dt>
+<dd>
+name of the directory to prune (string)
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
+<a NAME="copyTree" ID="copyTree"></a>
+<h2>copyTree</h2>
+<b>copyTree</b>(<i>src, dst, filters, excludeDirs=[], excludePatterns=[]</i>)
+<p>
+    Copy files of a directory tree.
+</p><dl>
+<dt><i>src</i></dt>
+<dd>
+name of the source directory
+</dd><dt><i>dst</i></dt>
+<dd>
+name of the destination directory
+</dd><dt><i>filters</i></dt>
+<dd>
+list of filter pattern determining the files to be copied
+</dd><dt><i>excludeDirs</i></dt>
+<dd>
+list of (sub)directories to exclude from copying
+</dd><dt><i>excludePatterns=</i></dt>
+<dd>
+list of filter pattern determining the files to
+        be skipped
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
+<a NAME="exit" ID="exit"></a>
+<h2>exit</h2>
+<b>exit</b>(<i>rcode=0</i>)
+<p>
+    Exit the install script.
+</p><dl>
+<dt><i>rcode</i></dt>
+<dd>
+result code to report back (integer)
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
+<a NAME="initGlobals" ID="initGlobals"></a>
+<h2>initGlobals</h2>
+<b>initGlobals</b>(<i></i>)
+<p>
+    Module function to set the values of globals that need more than a
+    simple assignment.
+</p>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
+<a NAME="installEricDebugClients" ID="installEricDebugClients"></a>
+<h2>installEricDebugClients</h2>
+<b>installEricDebugClients</b>(<i></i>)
+<p>
+    Actually perform the installation steps.
+</p><dl>
+<dt>Returns:</dt>
+<dd>
+result code (integer)
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
+<a NAME="main" ID="main"></a>
+<h2>main</h2>
+<b>main</b>(<i>argv</i>)
+<p>
+    The main function of the script.
+</p><dl>
+<dt><i>argv</i></dt>
+<dd>
+the list of command line arguments.
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
+<a NAME="shutilCopy" ID="shutilCopy"></a>
+<h2>shutilCopy</h2>
+<b>shutilCopy</b>(<i>src, dst, perm=0o644</i>)
+<p>
+    Wrapper function around shutil.copy() to ensure the permissions.
+</p><dl>
+<dt><i>src</i></dt>
+<dd>
+source file name (string)
+</dd><dt><i>dst</i></dt>
+<dd>
+destination file name or directory name (string)
+</dd><dt><i>perm=</i></dt>
+<dd>
+permissions to be set (integer)
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
+<a NAME="usage" ID="usage"></a>
+<h2>usage</h2>
+<b>usage</b>(<i>rcode=2</i>)
+<p>
+    Display a usage message and exit.
+</p><dl>
+<dt><i>rcode</i></dt>
+<dd>
+the return code passed back to the calling process.
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr />
+</body></html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Documentation/Source/eric6.uninstall-debugclients.html	Sun Jul 24 16:50:04 2016 +0200
@@ -0,0 +1,110 @@
+<!DOCTYPE html>
+<html><head>
+<title>eric6.uninstall-debugclients</title>
+<meta charset="UTF-8">
+<style>
+body {
+    background: #EDECE6;
+    margin: 0em 1em 10em 1em;
+    color: black;
+}
+
+h1 { color: white; background: #85774A; }
+h2 { color: white; background: #85774A; }
+h3 { color: white; background: #9D936E; }
+h4 { color: white; background: #9D936E; }
+    
+a { color: #BA6D36; }
+
+</style>
+</head>
+<body><a NAME="top" ID="top"></a>
+<h1>eric6.uninstall-debugclients</h1>
+<p>
+Unnstallation script for the eric6 debug clients.
+</p>
+<h3>Global Attributes</h3>
+<table>
+<tr><td>currDir</td></tr><tr><td>installPackage</td></tr><tr><td>modDir</td></tr><tr><td>progName</td></tr><tr><td>pyModDir</td></tr>
+</table>
+<h3>Classes</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<h3>Functions</h3>
+<table>
+<tr>
+<td><a href="#exit">exit</a></td>
+<td>Exit the install script.</td>
+</tr><tr>
+<td><a href="#initGlobals">initGlobals</a></td>
+<td>Module function to set the values of globals that need more than a simple assignment.</td>
+</tr><tr>
+<td><a href="#main">main</a></td>
+<td>The main function of the script.</td>
+</tr><tr>
+<td><a href="#uninstallEricDebugClients">uninstallEricDebugClients</a></td>
+<td>Uninstall the old eric debug client files.</td>
+</tr><tr>
+<td><a href="#usage">usage</a></td>
+<td>Display a usage message and exit.</td>
+</tr>
+</table>
+<hr /><hr />
+<a NAME="exit" ID="exit"></a>
+<h2>exit</h2>
+<b>exit</b>(<i>rcode=0</i>)
+<p>
+    Exit the install script.
+</p><dl>
+<dt><i>rcode</i></dt>
+<dd>
+result code to report back (integer)
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
+<a NAME="initGlobals" ID="initGlobals"></a>
+<h2>initGlobals</h2>
+<b>initGlobals</b>(<i></i>)
+<p>
+    Module function to set the values of globals that need more than a
+    simple assignment.
+</p>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
+<a NAME="main" ID="main"></a>
+<h2>main</h2>
+<b>main</b>(<i>argv</i>)
+<p>
+    The main function of the script.
+</p><dl>
+<dt><i>argv</i></dt>
+<dd>
+the list of command line arguments.
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
+<a NAME="uninstallEricDebugClients" ID="uninstallEricDebugClients"></a>
+<h2>uninstallEricDebugClients</h2>
+<b>uninstallEricDebugClients</b>(<i></i>)
+<p>
+    Uninstall the old eric debug client files.
+</p>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
+<a NAME="usage" ID="usage"></a>
+<h2>usage</h2>
+<b>usage</b>(<i>rcode=2</i>)
+<p>
+    Display a usage message and exit.
+</p><dl>
+<dt><i>rcode</i></dt>
+<dd>
+return code passed back to the calling process (integer)
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr />
+</body></html>
\ No newline at end of file
--- a/eric6.e4p	Sun Jul 24 15:57:47 2016 +0200
+++ b/eric6.e4p	Sun Jul 24 16:50:04 2016 +0200
@@ -1283,9 +1283,11 @@
     <Source>eric6_webbrowser.py</Source>
     <Source>eric6_webbrowser.pyw</Source>
     <Source>eric6config.py</Source>
+    <Source>install-debugclients.py</Source>
     <Source>install-i18n.py</Source>
     <Source>install.py</Source>
     <Source>patch_modpython.py</Source>
+    <Source>uninstall-debugclients.py</Source>
     <Source>uninstall.py</Source>
   </Sources>
   <Forms>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/install-debugclients.py	Sun Jul 24 16:50:04 2016 +0200
@@ -0,0 +1,350 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2016 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+# This is the install script for the eric6 debug client. It may be used
+# to just install the debug clients for remote debugging.
+#
+
+"""
+Installation script for the eric6 debug clients.
+"""
+
+from __future__ import unicode_literals, print_function
+try:
+    import cStringIO as io
+    import sip
+    sip.setapi('QString', 2)
+    sip.setapi('QVariant', 2)
+    sip.setapi('QTextStream', 2)
+except (ImportError):
+    import io    # __IGNORE_WARNING__
+
+import sys
+import os
+import re
+import compileall
+import shutil
+import fnmatch
+import distutils.sysconfig
+
+# Define the globals.
+progName = None
+currDir = os.getcwd()
+modDir = None
+pyModDir = None
+distDir = None
+installPackage = "eric6DebugClients"
+doCleanup = True
+doCompile = True
+sourceDir = "eric"
+
+
+def exit(rcode=0):
+    """
+    Exit the install script.
+    
+    @param rcode result code to report back (integer)
+    """
+    global currDir
+    
+    if sys.platform.startswith("win"):
+        # different meaning of input between Py2 and Py3
+        try:
+            input("Press enter to continue...")
+        except (EOFError, SyntaxError):
+            pass
+    
+    os.chdir(currDir)
+    
+    sys.exit(rcode)
+
+
+def usage(rcode=2):
+    """
+    Display a usage message and exit.
+
+    @param rcode the return code passed back to the calling process.
+    """
+    global progName, modDir, distDir
+
+    print()
+    print("Usage:")
+    if sys.platform == "darwin":
+        print("    {0} [-chz] [-d dir] [-i dir]".format(progName))
+    elif sys.platform.startswith("win"):
+        print("    {0} [-chz] [-d dir]".format(progName))
+    else:
+        print("    {0} [-chz][-d dir] [-i dir]".format(progName))
+    print("where:")
+    print("    -h, --help display this help message")
+    print("    -d dir     where eric6 debug client files will be installed")
+    print("               (default: {0})".format(modDir))
+    if not sys.platform.startswith("win"):
+        print("    -i dir     temporary install prefix")
+        print("               (default: {0})".format(distDir))
+    print("    -c         don't cleanup old installation first")
+    print("    -z         don't compile the installed python files")
+
+    exit(rcode)
+
+
+def initGlobals():
+    """
+    Module function to set the values of globals that need more than a
+    simple assignment.
+    """
+    global modDir, pyModDir
+
+    modDir = distutils.sysconfig.get_python_lib(True)
+    pyModDir = modDir
+
+
+def copyTree(src, dst, filters, excludeDirs=[], excludePatterns=[]):
+    """
+    Copy files of a directory tree.
+    
+    @param src name of the source directory
+    @param dst name of the destination directory
+    @param filters list of filter pattern determining the files to be copied
+    @param excludeDirs list of (sub)directories to exclude from copying
+    @keyparam excludePatterns list of filter pattern determining the files to
+        be skipped
+    """
+    try:
+        names = os.listdir(src)
+    except OSError:
+        # ignore missing directories
+        return
+    
+    for name in names:
+        skipIt = False
+        for excludePattern in excludePatterns:
+            if fnmatch.fnmatch(name, excludePattern):
+                skipIt = True
+                break
+        if not skipIt:
+            srcname = os.path.join(src, name)
+            dstname = os.path.join(dst, name)
+            for filter in filters:
+                if fnmatch.fnmatch(srcname, filter):
+                    if not os.path.isdir(dst):
+                        os.makedirs(dst)
+                    shutil.copy2(srcname, dstname)
+                    os.chmod(dstname, 0o644)
+                    break
+            else:
+                if os.path.isdir(srcname) and srcname not in excludeDirs:
+                    copyTree(srcname, dstname, filters,
+                             excludePatterns=excludePatterns)
+
+
+def cleanupSource(dirName):
+    """
+    Cleanup the sources directory to get rid of leftover files
+    and directories.
+    
+    @param dirName name of the directory to prune (string)
+    """
+    # step 1: delete the __pycache__ directory and all *.pyc files
+    if os.path.exists(os.path.join(dirName, "__pycache__")):
+        shutil.rmtree(os.path.join(dirName, "__pycache__"))
+    for name in [f for f in os.listdir(dirName)
+                 if fnmatch.fnmatch(f, "*.pyc")]:
+        os.remove(os.path.join(dirName, name))
+    
+    # step 2: descent into subdirectories and delete them if empty
+    for name in os.listdir(dirName):
+        name = os.path.join(dirName, name)
+        if os.path.isdir(name):
+            cleanupSource(name)
+            if len(os.listdir(name)) == 0:
+                os.rmdir(name)
+
+
+def cleanUp():
+    """
+    Uninstall the old eric debug client files.
+    """
+    global pyModDir
+    
+    try:
+        # Cleanup the install directories
+        dirname = os.path.join(pyModDir, installPackage)
+        if os.path.exists(dirname):
+            shutil.rmtree(dirname, True)
+    except (IOError, OSError) as msg:
+        sys.stderr.write(
+            'Error: {0}\nTry install with admin rights.\n'.format(msg))
+        exit(7)
+
+
+def shutilCopy(src, dst, perm=0o644):
+    """
+    Wrapper function around shutil.copy() to ensure the permissions.
+    
+    @param src source file name (string)
+    @param dst destination file name or directory name (string)
+    @keyparam perm permissions to be set (integer)
+    """
+    shutil.copy(src, dst)
+    if os.path.isdir(dst):
+        dst = os.path.join(dst, os.path.basename(src))
+    os.chmod(dst, perm)
+
+
+def installEricDebugClients():
+    """
+    Actually perform the installation steps.
+    
+    @return result code (integer)
+    """
+    global distDir, doCleanup, sourceDir, modDir
+    
+    # set install prefix, if not None
+    if distDir:
+        targetDir = os.path.normpath(os.path.join(distDir, installPackage))
+    else:
+        targetDir = os.path.join(modDir, installPackage)
+    
+    try:
+        # Install the files
+        # copy the various parts of eric6 debug clients
+        copyTree(
+            os.path.join(sourceDir, "DebugClients"), targetDir,
+            ['*.py', '*.pyc', '*.pyo', '*.pyw'],
+            ['{1}{0}.ropeproject'.format(os.sep, sourceDir)],
+            excludePatterns=["eric6config.py*"])
+        copyTree(
+            os.path.join(sourceDir, "DebugClients"), targetDir,
+            ['*.rb'],
+            ['{1}{0}Examples'.format(os.sep, sourceDir)])
+        
+        # copy the license file
+        shutilCopy(
+            '{1}{0}LICENSE.GPL3'.format(os.sep, sourceDir), targetDir)
+        
+    except (IOError, OSError) as msg:
+        sys.stderr.write(
+            'Error: {0}\nTry install with admin rights.\n'.format(msg))
+        return(7)
+    
+    return 0
+
+
+def main(argv):
+    """
+    The main function of the script.
+
+    @param argv the list of command line arguments.
+    """
+    import getopt
+
+    # Parse the command line.
+    global progName, modDir, doCleanup, doCompile, distDir
+    global sourceDir
+    
+    if sys.version_info < (2, 7, 0) or sys.version_info > (3, 9, 9):
+        print('Sorry, eric6 requires at least Python 2.7 or '
+              'Python 3 for running.')
+        exit(5)
+    
+    progName = os.path.basename(argv[0])
+    
+    if os.path.dirname(argv[0]):
+        os.chdir(os.path.dirname(argv[0]))
+    
+    initGlobals()
+
+    try:
+        if sys.platform.startswith("win"):
+            optlist, args = getopt.getopt(
+                argv[1:], "chzd:", ["help"])
+        elif sys.platform == "darwin":
+            optlist, args = getopt.getopt(
+                argv[1:], "chzd:i:", ["help"])
+        else:
+            optlist, args = getopt.getopt(
+                argv[1:], "chzd:i:", ["help"])
+    except getopt.GetoptError as err:
+        print(err)
+        usage()
+
+    for opt, arg in optlist:
+        if opt in ["-h", "--help"]:
+            usage(0)
+        elif opt == "-d":
+            modDir = arg
+        elif opt == "-i":
+            distDir = os.path.normpath(arg)
+        elif opt == "-c":
+            doCleanup = False
+        elif opt == "-z":
+            doCompile = False
+    
+    installFromSource = not os.path.isdir(sourceDir)
+    if installFromSource:
+        sourceDir = os.path.dirname(__file__) or "."
+    
+    # cleanup source if installing from source
+    if installFromSource:
+        print("Cleaning up source ...")
+        cleanupSource(os.path.join(sourceDir, "DebugClients"))
+        print()
+    
+    # cleanup old installation
+    try:
+        if doCleanup:
+            print("Cleaning up old installation ...")
+            if distDir:
+                shutil.rmtree(distDir, True)
+            else:
+                cleanUp()
+    except (IOError, OSError) as msg:
+        sys.stderr.write('Error: {0}\nTry install as root.\n'.format(msg))
+        exit(7)
+
+    if doCompile:
+        print("\nCompiling source files ...")
+        if sys.version_info[0] == 3:
+            skipRe = re.compile(r"DebugClients[\\/]Python[\\/]")
+        else:
+            skipRe = re.compile(r"DebugClients[\\/]Python3[\\/]")
+        # Hide compile errors (mainly because of Py2/Py3 differences)
+        sys.stdout = io.StringIO()
+        if distDir:
+            compileall.compile_dir(
+                os.path.join(sourceDir, "DebugClients"),
+                ddir=os.path.join(distDir, modDir, installPackage),
+                rx=skipRe,
+                quiet=True)
+        else:
+            compileall.compile_dir(
+                os.path.join(sourceDir, "DebugClients"),
+                ddir=os.path.join(modDir, installPackage),
+                rx=skipRe,
+                quiet=True)
+        sys.stdout = sys.__stdout__
+    print("\nInstalling eric6 debug clients ...")
+    res = installEricDebugClients()
+    
+    print("\nInstallation complete.")
+    print()
+    
+    exit(res)
+    
+    
+if __name__ == "__main__":
+    try:
+        main(sys.argv)
+    except SystemExit:
+        raise
+    except Exception:
+        print("""An internal error occured.  Please report all the output"""
+              """ of the program,\nincluding the following traceback, to"""
+              """ eric-bugs@eric-ide.python-projects.org.\n""")
+        raise
+
+#
+# eflag: noqa = M801
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uninstall-debugclients.py	Sun Jul 24 16:50:04 2016 +0200
@@ -0,0 +1,139 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2016 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+# This is the uninstall script for the eric6 debug client.
+#
+
+"""
+Unnstallation script for the eric6 debug clients.
+"""
+
+from __future__ import unicode_literals, print_function
+
+import sys
+import os
+import shutil
+import distutils.sysconfig
+
+if sys.version_info[0] == 2:
+    import sip
+    sip.setapi('QString', 2)
+
+# Define the globals.
+progName = None
+currDir = os.getcwd()
+modDir = None
+pyModDir = None
+installPackage = "eric6DebugClients"
+
+
+def exit(rcode=0):
+    """
+    Exit the install script.
+    
+    @param rcode result code to report back (integer)
+    """
+    global currDir
+    
+    if sys.platform.startswith("win"):
+        # different meaning of input between Py2 and Py3
+        try:
+            input("Press enter to continue...")
+        except (EOFError, SyntaxError):
+            pass
+    
+    os.chdir(currDir)
+    
+    sys.exit(rcode)
+
+
+def usage(rcode=2):
+    """
+    Display a usage message and exit.
+
+    @param rcode return code passed back to the calling process (integer)
+    """
+    global progName
+
+    print("Usage:")
+    print("    {0} [-h]".format(progName))
+    print("where:")
+    print("    -h             display this help message")
+
+    exit(rcode)
+
+
+def initGlobals():
+    """
+    Module function to set the values of globals that need more than a
+    simple assignment.
+    """
+    global modDir, pyModDir
+
+    modDir = distutils.sysconfig.get_python_lib(True)
+    pyModDir = modDir
+
+
+def uninstallEricDebugClients():
+    """
+    Uninstall the old eric debug client files.
+    """
+    global pyModDir
+    
+    try:
+        # Cleanup the install directories
+        dirname = os.path.join(pyModDir, installPackage)
+        if os.path.exists(dirname):
+            shutil.rmtree(dirname, True)
+    except (IOError, OSError) as msg:
+        sys.stderr.write(
+            'Error: {0}\nTry uninstall with admin rights.\n'.format(msg))
+        exit(7)
+
+
+def main(argv):
+    """
+    The main function of the script.
+
+    @param argv the list of command line arguments.
+    """
+    import getopt
+
+    initGlobals()
+
+    # Parse the command line.
+    global progName
+    progName = os.path.basename(argv[0])
+    
+    try:
+        optlist, args = getopt.getopt(argv[1:], "hy")
+    except getopt.GetoptError:
+        usage()
+
+    for opt, arg in optlist:
+        if opt in ["-h", "--help"]:
+            usage(0)
+    
+    print("\nUninstalling eric6 debug clients ...")
+    uninstallEricDebugClients()
+    print("\nUninstallation complete.")
+    print()
+    
+    exit(0)
+    
+    
+if __name__ == "__main__":
+    try:
+        main(sys.argv)
+    except SystemExit:
+        raise
+    except Exception:
+        print("""An internal error occured.  Please report all the output"""
+              """ of the program,\nincluding the following traceback, to"""
+              """ eric-bugs@eric-ide.python-projects.org.\n""")
+        raise
+
+#
+# eflag: noqa = M801

eric ide

mercurial