MultiProcessDebugExtension: commented out the support for os.exec, os.spawn and os.posix_spawn. multi_processing

Sun, 13 Dec 2020 19:54:19 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 13 Dec 2020 19:54:19 +0100
branch
multi_processing
changeset 7873
cb2badbdf26c
parent 7872
433dacbfa456
child 7874
8dcb77600690

MultiProcessDebugExtension: commented out the support for os.exec, os.spawn and os.posix_spawn.

eric6/DebugClients/Python/DebugUtilities.py file | annotate | diff | comparison | revisions
eric6/DebugClients/Python/MultiProcessDebugExtension.py file | annotate | diff | comparison | revisions
eric6/DebugClients/Python/SubprocessExtension.py file | annotate | diff | comparison | revisions
--- a/eric6/DebugClients/Python/DebugUtilities.py	Sat Dec 12 15:30:05 2020 +0100
+++ b/eric6/DebugClients/Python/DebugUtilities.py	Sun Dec 13 19:54:19 2020 +0100
@@ -195,6 +195,8 @@
                     for name in PYTHON_NAMES:
                         if line.startswith('#!/usr/bin/env {0}'.format(name)):
                             return True
+                        elif line.startswith('#!') and name in line:
+                            return True
                     return False
     except UnicodeDecodeError:
         return False
@@ -287,6 +289,12 @@
     @return modified argument list
     @rtype list of str
     """
+    debugClientScript = os.path.join(
+        os.path.dirname(__file__), "DebugClient.py")
+    if debugClientScript in arguments:
+        # it is already patched
+        return arguments
+    
     args = list(arguments[:])    # create a copy of the arguments list
     args = removeQuotesFromArgs(args)
     
@@ -299,6 +307,9 @@
         if not isWindowsPlatform() and startsWithShebang(args[0]):
             # insert our interpreter as first argument
             args.insert(0, sys.executable)
+        elif isWindowsPlatform() and args[0].lower().endswith(".py"):
+            # 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:
@@ -346,7 +357,7 @@
     modifiedArguments = [interpreter]
     modifiedArguments.extend(interpreterArgs)
     modifiedArguments.extend([
-        os.path.join(os.path.dirname(__file__), "DebugClient.py"),
+        debugClientScript,
         "-h", host,
         "-p", str(port),
         "--no-passive",
--- a/eric6/DebugClients/Python/MultiProcessDebugExtension.py	Sat Dec 12 15:30:05 2020 +0100
+++ b/eric6/DebugClients/Python/MultiProcessDebugExtension.py	Sun Dec 13 19:54:19 2020 +0100
@@ -366,32 +366,32 @@
         return
     
     import os
-    import sys
+##    import sys
     
     # patch 'os.exec...()' functions
-    patchModule(os, "execl", createExecl)
-    patchModule(os, "execle", createExecl)
-    patchModule(os, "execlp", createExecl)
-    patchModule(os, "execlpe", createExecl)
-    patchModule(os, "execv", createExecv)
-    patchModule(os, "execve", createExecve)
-    patchModule(os, "execvp", createExecv)
-    patchModule(os, "execvpe", createExecve)
+##    patchModule(os, "execl", createExecl)
+##    patchModule(os, "execle", createExecl)
+##    patchModule(os, "execlp", createExecl)
+##    patchModule(os, "execlpe", createExecl)
+##    patchModule(os, "execv", createExecv)
+##    patchModule(os, "execve", createExecve)
+##    patchModule(os, "execvp", createExecv)
+##    patchModule(os, "execvpe", createExecve)
     
     # patch 'os.spawn...()' functions
-    patchModule(os, "spawnl", createSpawnl)
-    patchModule(os, "spawnle", createSpawnl)
-    patchModule(os, "spawnlp", createSpawnl)
-    patchModule(os, "spawnlpe", createSpawnl)
-    patchModule(os, "spawnv", createSpawnv)
-    patchModule(os, "spawnve", createSpawnve)
-    patchModule(os, "spawnvp", createSpawnv)
-    patchModule(os, "spawnvpe", createSpawnve)
+##    patchModule(os, "spawnl", createSpawnl)
+##    patchModule(os, "spawnle", createSpawnl)
+##    patchModule(os, "spawnlp", createSpawnl)
+##    patchModule(os, "spawnlpe", createSpawnl)
+##    patchModule(os, "spawnv", createSpawnv)
+##    patchModule(os, "spawnve", createSpawnve)
+##    patchModule(os, "spawnvp", createSpawnv)
+##    patchModule(os, "spawnvpe", createSpawnve)
     
     # patch 'os.posix_spawn...()' functions
-    if sys.version_info >= (3, 8) and not isWindowsPlatform():
-        patchModule(os, "posix_spawn", createPosixSpawn)
-        patchModule(os, "posix_spawnp", createPosixSpawn)
+##    if sys.version_info >= (3, 8) and not isWindowsPlatform():
+##        patchModule(os, "posix_spawn", createPosixSpawn)
+##        patchModule(os, "posix_spawnp", createPosixSpawn)
     
     if isWindowsPlatform():
         try:
--- a/eric6/DebugClients/Python/SubprocessExtension.py	Sat Dec 12 15:30:05 2020 +0100
+++ b/eric6/DebugClients/Python/SubprocessExtension.py	Sun Dec 13 19:54:19 2020 +0100
@@ -60,6 +60,7 @@
                     if startsWithShebang(arguments[0]):
                         scriptName = os.path.basename(arguments[0])
                     else:
+                        # TODO: this seems to be weird
                         scriptName = os.path.basename(arguments[0])
                     if scriptName not in _debugClient.noDebugList:
                         arguments = patchArguments(

eric ide

mercurial