Commits

Philip Jenvey committed 3a0cd10

revert the standalone jar workaround for now, we'll revisit this post 2.5

Comments (0)

Files changed (2)

Lib/subprocess.py

     # Parse command line arguments for Windows
     _win_oses = ['nt']
 
-    _JYTHON_JAR = 'jython.jar'
     _cmdline2list = None
-    _forcecmdline2list = None
     _escape_args = None
     _shell_command = None
 
         """Setup the shell command and the command line argument escape
         function depending on the underlying platform
         """
-        global _cmdline2list, _forcecmdline2list, _escape_args, _shell_command
+        global _cmdline2list, _escape_args, _shell_command
 
         if os._name in _win_oses:
-            _cmdline2list = _forcecmdline2list = cmdline2list
+            _cmdline2list = cmdline2list
             _escape_args = lambda args: [list2cmdline([arg]) for arg in args]
         else:
-            _cmdline2list = lambda arg: [arg]
-            def _forcecmdline2list(arg):
-                import shlex
-                try:
-                    return shlex.split(arg)
-                except ValueError:
-                    return [arg]
+            _cmdline2list = lambda args: [args]
             _escape_args = lambda args: args
 
         os_info = os._os_map.get(os._name)
             builder_env.putAll(merge_env)
 
 
-        def _should_run_jar(self, args):
-            """Determine if command should be run via jar -jar.
-
-            When running the standalone Jython jar without the official
-            command line script runner (e.g. java -jar jython.jar)
-            sys.executable cannot be determined, so Jython sets it to
-            the path to jython.jar.
-
-            This detects when a subprocess command executable is that
-            special sys.executable value.
-            """
-            if not sys.executable or not sys.executable.endswith(_JYTHON_JAR):
-                # Not applicable
-                return False
-
-            args = (_forcecmdline2list(args)
-                    if isinstance(args, types.StringTypes) else list(args))
-            if not args:
-                return False
-            return args[0] == sys.executable
-
-
         def _execute_child(self, args, executable, preexec_fn, close_fds,
                            cwd, env, universal_newlines,
                            startupinfo, creationflags, shell,
                            errread, errwrite):
             """Execute program (Java version)"""
 
-            run_jar = self._should_run_jar(args)
             if isinstance(args, types.StringTypes):
-                if run_jar:
-                    args = 'java -jar ' + args
                 args = _cmdline2list(args)
             else:
                 args = list(args)
                 # posix. Windows passes unicode through, however
                 if any(not isinstance(arg, (str, unicode)) for arg in args):
                     raise TypeError('args must contain only strings')
-                if run_jar:
-                    args = ['java', '-jar'] + args
             args = _escape_args(args)
 
             if shell:

src/org/python/core/PySystemState.java

         // Initialize the path (and add system defaults)
         defaultPath = initPath(registry, standalone, jarFileName);
         defaultArgv = initArgv(argv);
-        defaultExecutable = initExecutable(registry, jarFileName);
+        defaultExecutable = initExecutable(registry);
         // Set up the known Java packages
         initPackages(registry);
         // Finish up standard Python initialization...
     }
 
     /**
-     * Determine the default sys.executable value from the registry. Returns Py.None is no
-     * executable can be found.
-     * 
-     * @param props
-     *            a Properties registry
-     * @param jarFileName
-     *            used as executable if python.executable not otherwise specified
+     * Determine the default sys.executable value from the
+     * registry. Returns Py.None is no executable can be found.
+     *
+     * @param props a Properties registry
      * @return a PyObject path string or Py.None
      */
-    private static PyObject initExecutable(Properties props, String jarFileName) {
+    private static PyObject initExecutable(Properties props) {
         String executable = props.getProperty("python.executable");
         if (executable == null) {
-            if (jarFileName != null) {
-                executable = jarFileName;
-            } else {
-                return Py.None;
-            }
+            return Py.None;
         }
 
         File executableFile = new File(executable);