Thu, 20 May 2021 19:18:19 +0200
Removed some obsolete code.
Examples/modpython.py | file | annotate | diff | comparison | revisions | |
Examples/modpython_dbg.py | file | annotate | diff | comparison | revisions | |
eric7.epj | file | annotate | diff | comparison | revisions | |
eric7/DebugClients/Python/ThreadExtension.py | file | annotate | diff | comparison | revisions | |
eric7/QScintilla/Editor.py | file | annotate | diff | comparison | revisions | |
eric7/VirtualEnv/VirtualenvManager.py | file | annotate | diff | comparison | revisions | |
scripts/patch_modpython.py | file | annotate | diff | comparison | revisions |
--- a/Examples/modpython.py Thu May 20 19:16:58 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -from mod_python import apache - -def handler(req): - req.content_type = "text/plain" - req.send_http_header() - req.write("Hello World!\n") - - return apache.OK
--- a/Examples/modpython_dbg.py Thu May 20 19:16:58 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -from mod_python import apache - -apache.initDebugger('/Path/To/modpython_dbg.py') - -def handler(req): - req.content_type = "text/plain" - req.send_http_header() - req.write("Hello World!\n") - - return apache.OK
--- a/eric7.epj Thu May 20 19:16:58 2021 +0200 +++ b/eric7.epj Thu May 20 19:18:19 2021 +0200 @@ -954,8 +954,6 @@ "RESOURCES": [], "SOURCES": [ "Examples/hallo.py", - "Examples/modpython.py", - "Examples/modpython_dbg.py", "Examples/rhallo.py", "scripts/cleanupSource.py", "scripts/compileUiFiles.py", @@ -963,7 +961,6 @@ "scripts/install-debugclients.py", "scripts/install-i18n.py", "scripts/install.py", - "scripts/patch_modpython.py", "scripts/uninstall-debugclients.py", "scripts/uninstall.py", "setup.py",
--- a/eric7/DebugClients/Python/ThreadExtension.py Thu May 20 19:16:58 2021 +0200 +++ b/eric7/DebugClients/Python/ThreadExtension.py Thu May 20 19:18:19 2021 +0200 @@ -224,8 +224,7 @@ def patchPyThread(self, module): """ - Public method to patch Python _thread (Python3) and thread (Python2) - modules. + Public method to patch Python _thread module. @param module reference to the imported module to be patched @type module
--- a/eric7/QScintilla/Editor.py Thu May 20 19:16:58 2021 +0200 +++ b/eric7/QScintilla/Editor.py Thu May 20 19:18:19 2021 +0200 @@ -2080,16 +2080,6 @@ """ return self.__getPyVersion() == 3 - def isPy2File(self): - """ - Public method to return a flag indicating a Python2 file. - - @return flag reporting always False - @rtype bool - """ - # kept to keep the API compatible for plugins - return False - def isPy3File(self): """ Public method to return a flag indicating a Python3 file.
--- a/eric7/VirtualEnv/VirtualenvManager.py Thu May 20 19:16:58 2021 +0200 +++ b/eric7/VirtualEnv/VirtualenvManager.py Thu May 20 19:18:19 2021 +0200 @@ -80,11 +80,6 @@ envsToDelete = [] for venvName in environments: environment = environments[venvName] - if environment["variant"] == 2: - # Python2 environment are not supported anymore, delete them - envsToDelete.append(venvName) - continue - if ( ("is_remote" in environment and environment["is_remote"]) or os.access(environment["interpreter"], os.X_OK)
--- a/scripts/patch_modpython.py Thu May 20 19:16:58 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright (c) 2003 - 2021 Detlev Offenbach <detlev@die-offenbachs.de> -# -# This is a script to patch mod_python for eric. - -""" -Script to patch mod_python for usage with the eric IDE. -""" - -import sys -import os -import shutil -import py_compile -import distutils.sysconfig - -# Define the globals. -progName = None -modDir = None - - -def usage(rcode=2): - """ - Display a usage message and exit. - - @param rcode return code passed back to the calling process (integer) - """ - global progName, modDir - - print("Usage:") - print(" {0} [-h] [-d dir]".format(progName)) - print("where:") - print(" -h display this help message") - print(" -d dir where Mod_python files are installed" - " [default {0}]".format(modDir)) - print() - print("This script patches the file apache.py of the Mod_python" - " distribution") - print("so that it will work with the eric debugger instead of pdb.") - print("Please see mod_python.html for more details.") - print() - - sys.exit(rcode) - - -def initGlobals(): - """ - Module function to set the values of globals that need more than a - simple assignment. - """ - global modDir - - modDir = os.path.join(distutils.sysconfig.get_python_lib(True), - "mod_python") - - -def main(argv): - """ - The main function of the script. - - @param argv list of command line arguments (list of strings) - """ - import getopt - - # Parse the command line. - global progName, modDir - progName = os.path.basename(argv[0]) - - initGlobals() - - try: - optlist, args = getopt.getopt(argv[1:], "hd:") - except getopt.GetoptError: - usage() - - for opt, arg in optlist: - if opt == "-h": - usage(0) - elif opt == "-d": - global modDir - modDir = arg - - try: - filename = os.path.join(modDir, "apache.py") - with open(filename, "r", encoding="utf-8") as f: - lines = f.readlines() - except OSError: - print("The file {0} does not exist. Aborting.".format(filename)) - sys.exit(1) - - pdbFound = False - ericFound = False - - sn = "apache.py" - with open(sn, "w", encoding="utf-8") as s: - for line in lines: - if not pdbFound and line.startswith("import pdb"): - s.write("import eric7.DebugClients.Python.eric7dbgstub as" - " pdb\n") - pdbFound = True - else: - s.write(line) - if line.startswith("import eric7"): - ericFound = True - - if not ericFound: - s.write("\n") - s.write('def initDebugger(name):\n') - s.write(' """\n') - s.write(' Initialize the debugger and set the script name to be' - ' reported \n') - s.write(' by the debugger. This is a patch for eric.\n') - s.write(' """\n') - s.write(' if not pdb.initDebugger("standard"):\n') - s.write(' raise ImportError("Could not initialize' - ' debugger")\n') - s.write(' pdb.setScriptname(name)\n') - s.write("\n") - - if ericFound: - print("Mod_python is already patched for eric.") - os.remove(sn) - else: - try: - py_compile.compile(sn) - except py_compile.PyCompileError as e: - print("Error compiling {0}. Aborting".format(sn)) - print(e) - os.remove(sn) - sys.exit(1) - except SyntaxError as e: - print("Error compiling {0}. Aborting".format(sn)) - print(e) - os.remove(sn) - sys.exit(1) - - shutil.copy(os.path.join(modDir, "apache.py"), - os.path.join(modDir, "apache.py.orig")) - shutil.copy(sn, modDir) - os.remove(sn) - if os.path.exists("{0}c".format(sn)): - shutil.copy("{0}c".format(sn), modDir) - os.remove("{0}c".format(sn)) - if os.path.exists("{0}o".format(sn)): - shutil.copy("{0}o".format(sn), modDir) - os.remove("{0}o".format(sn)) - - print("Mod_python patched successfully.") - print("Unpatched file copied to {0}.".format( - os.path.join(modDir, "apache.py.orig"))) - - -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@die-offenbachs.de.\n""") - raise - -# -# eflag: noqa = M801