scripts/patch_modpython.py

changeset 7960
e8fc383322f7
parent 7923
91e843545d9a
child 8314
e3642a6a1e71
equal deleted inserted replaced
7959:44e15eda6506 7960:e8fc383322f7
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 2
3 # Copyright (c) 2003 - 2021 Detlev Offenbach <detlev@die-offenbachs.de> 3 # Copyright (c) 2003 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
4 # 4 #
5 # This is a script to patch mod_python for eric6. 5 # This is a script to patch mod_python for eric.
6 6
7 """ 7 """
8 Script to patch mod_python for usage with the eric6 IDE. 8 Script to patch mod_python for usage with the eric IDE.
9 """ 9 """
10 10
11 import sys 11 import sys
12 import os 12 import os
13 import shutil 13 import shutil
34 print(" -d dir where Mod_python files are installed" 34 print(" -d dir where Mod_python files are installed"
35 " [default {0}]".format(modDir)) 35 " [default {0}]".format(modDir))
36 print() 36 print()
37 print("This script patches the file apache.py of the Mod_python" 37 print("This script patches the file apache.py of the Mod_python"
38 " distribution") 38 " distribution")
39 print("so that it will work with the eric6 debugger instead of pdb.") 39 print("so that it will work with the eric debugger instead of pdb.")
40 print("Please see mod_python.html for more details.") 40 print("Please see mod_python.html for more details.")
41 print() 41 print()
42 42
43 sys.exit(rcode) 43 sys.exit(rcode)
44 44
107 s.write("\n") 107 s.write("\n")
108 s.write('def initDebugger(name):\n') 108 s.write('def initDebugger(name):\n')
109 s.write(' """\n') 109 s.write(' """\n')
110 s.write(' Initialize the debugger and set the script name to be' 110 s.write(' Initialize the debugger and set the script name to be'
111 ' reported \n') 111 ' reported \n')
112 s.write(' by the debugger. This is a patch for eric6.\n') 112 s.write(' by the debugger. This is a patch for eric.\n')
113 s.write(' """\n') 113 s.write(' """\n')
114 s.write(' if not pdb.initDebugger("standard"):\n') 114 s.write(' if not pdb.initDebugger("standard"):\n')
115 s.write(' raise ImportError("Could not initialize' 115 s.write(' raise ImportError("Could not initialize'
116 ' debugger")\n') 116 ' debugger")\n')
117 s.write(' pdb.setScriptname(name)\n') 117 s.write(' pdb.setScriptname(name)\n')
118 s.write("\n") 118 s.write("\n")
119 119
120 if ericFound: 120 if ericFound:
121 print("Mod_python is already patched for eric6.") 121 print("Mod_python is already patched for eric.")
122 os.remove(sn) 122 os.remove(sn)
123 else: 123 else:
124 try: 124 try:
125 py_compile.compile(sn) 125 py_compile.compile(sn)
126 except py_compile.PyCompileError as e: 126 except py_compile.PyCompileError as e:

eric ide

mercurial