23 |
23 |
24 def usage(rcode=2): |
24 def usage(rcode=2): |
25 """ |
25 """ |
26 Display a usage message and exit. |
26 Display a usage message and exit. |
27 |
27 |
28 rcode is the return code passed back to the calling process. |
28 @param rcode return code passed back to the calling process (integer) |
29 """ |
29 """ |
30 global progName, modDir |
30 global progName, modDir |
31 |
31 |
32 print("Usage:") |
32 print("Usage:") |
33 print(" {0} [-h] [-d dir]".format(progName)) |
33 print(" {0} [-h] [-d dir]".format(progName)) |
34 print("where:") |
34 print("where:") |
35 print(" -h display this help message") |
35 print(" -h display this help message") |
36 print(" -d dir where Mod_python files are installed [default {0}]".format( |
36 print(" -d dir where Mod_python files are installed" |
37 modDir)) |
37 " [default {0}]".format(modDir)) |
38 print() |
38 print() |
39 print("This script patches the file apache.py of the Mod_python distribution") |
39 print("This script patches the file apache.py of the Mod_python" |
|
40 " distribution") |
40 print("so that it will work with the eric5 debugger instead of pdb.") |
41 print("so that it will work with the eric5 debugger instead of pdb.") |
41 print("Please see mod_python.html for more details.") |
42 print("Please see mod_python.html for more details.") |
42 print() |
43 print() |
43 |
44 |
44 sys.exit(rcode) |
45 sys.exit(rcode) |
45 |
46 |
46 |
47 |
47 def initGlobals(): |
48 def initGlobals(): |
48 """ |
49 """ |
49 Sets the values of globals that need more than a simple assignment. |
50 Module function to set the values of globals that need more than a |
|
51 simple assignment. |
50 """ |
52 """ |
51 global modDir |
53 global modDir |
52 |
54 |
53 modDir = os.path.join(distutils.sysconfig.get_python_lib(True), "mod_python") |
55 modDir = os.path.join(distutils.sysconfig.get_python_lib(True), |
|
56 "mod_python") |
54 |
57 |
55 |
58 |
56 def main(argv): |
59 def main(argv): |
57 """The main function of the script. |
60 """ |
|
61 The main function of the script. |
58 |
62 |
59 argv is the list of command line arguments. |
63 @param argv list of command line arguments (list of strings) |
60 """ |
64 """ |
61 import getopt |
65 import getopt |
62 |
66 |
63 # Parse the command line. |
67 # Parse the command line. |
64 global progName, modDir |
68 global progName, modDir |
104 |
108 |
105 if not ericFound: |
109 if not ericFound: |
106 s.write("\n") |
110 s.write("\n") |
107 s.write('def initDebugger(name):\n') |
111 s.write('def initDebugger(name):\n') |
108 s.write(' """\n') |
112 s.write(' """\n') |
109 s.write(' Initialize the debugger and set the script name to be reported \n') |
113 s.write(' Initialize the debugger and set the script name to be' |
|
114 ' reported \n') |
110 s.write(' by the debugger. This is a patch for eric5.\n') |
115 s.write(' by the debugger. This is a patch for eric5.\n') |
111 s.write(' """\n') |
116 s.write(' """\n') |
112 s.write(' if not pdb.initDebugger("standard"):\n') |
117 s.write(' if not pdb.initDebugger("standard"):\n') |
113 s.write(' raise ImportError("Could not initialize debugger")\n') |
118 s.write(' raise ImportError("Could not initialize debugger")\n') |
114 s.write(' pdb.setScriptname(name)\n') |
119 s.write(' pdb.setScriptname(name)\n') |