eric6/DebugClients/Python/DebugUtilities.py

changeset 7895
554fdb07c856
parent 7892
bd6b9e401166
child 7900
72b88fb20261
diff -r 4370a8b30648 -r 554fdb07c856 eric6/DebugClients/Python/DebugUtilities.py
--- a/eric6/DebugClients/Python/DebugUtilities.py	Fri Dec 18 12:44:31 2020 +0100
+++ b/eric6/DebugClients/Python/DebugUtilities.py	Fri Dec 18 16:48:14 2020 +0100
@@ -316,29 +316,12 @@
             # it is a Python script; insert our interpreter as first argument
             args.insert(0, sys.executable)
     
-    # check for -m invocation => debugging not supported yet
-    if "-m" in args:
-        cm_position = args.index("-m")
-    else:
-        cm_position = 0
-    if cm_position > 0:
-        # check if it belongs to the interpreter or program
-        for pos in range(1, len(args)):
-            if not args[pos].startswith("-"):
-                # first argument not starting with '-' is the program
-                found = True
-                break
-        else:
-            found = False
-        if found and cm_position < pos:
-            # it belongs to the interpreter
-            return quoteArgs(arguments)
-    
     # extract list of interpreter arguments, i.e. all arguments before the
     # first one not starting with '-'.
     interpreter = args.pop(0)
     interpreterArgs = []
     hasCode = False
+    hasScriptModule = False
     while args:
         if args[0].startswith("-"):
             if args[0] in ("-W", "-X"):
@@ -351,6 +334,12 @@
                 args.pop(0)
                 hasCode = True
                 break
+            elif args[0] == "-m":
+                # -m indicates a module to be executed as a script
+                # and ends the arguments list
+                args.pop(0)
+                hasScriptModule = True
+                break
             else:
                 interpreterArgs.append(args.pop(0))
         else:
@@ -382,6 +371,10 @@
         modifiedArguments.append("--multiprocess")
     if hasCode:
         modifiedArguments.append("--code")
+        modifiedArguments.append(args.pop(0))
+    if hasScriptModule:
+        modifiedArguments.append("--module")
+        modifiedArguments.append(args.pop(0))
     modifiedArguments.append("--")
     # end the arguments for DebugClient
     

eric ide

mercurial