From: <pj...@us...> - 2009-06-06 21:41:50
|
Revision: 6462 http://jython.svn.sourceforge.net/jython/?rev=6462&view=rev Author: pjenvey Date: 2009-06-06 21:40:48 +0000 (Sat, 06 Jun 2009) Log Message: ----------- revert the standalone jar workaround for now, we'll revisit this post 2.5 Modified Paths: -------------- trunk/jython/Lib/subprocess.py trunk/jython/src/org/python/core/PySystemState.java Modified: trunk/jython/Lib/subprocess.py =================================================================== --- trunk/jython/Lib/subprocess.py 2009-06-06 20:56:01 UTC (rev 6461) +++ trunk/jython/Lib/subprocess.py 2009-06-06 21:40:48 UTC (rev 6462) @@ -547,9 +547,7 @@ # Parse command line arguments for Windows _win_oses = ['nt'] - _JYTHON_JAR = 'jython.jar' _cmdline2list = None - _forcecmdline2list = None _escape_args = None _shell_command = None @@ -613,19 +611,13 @@ """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) @@ -1225,28 +1217,6 @@ 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, @@ -1255,10 +1225,7 @@ 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) @@ -1267,8 +1234,6 @@ # 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: Modified: trunk/jython/src/org/python/core/PySystemState.java =================================================================== --- trunk/jython/src/org/python/core/PySystemState.java 2009-06-06 20:56:01 UTC (rev 6461) +++ trunk/jython/src/org/python/core/PySystemState.java 2009-06-06 21:40:48 UTC (rev 6462) @@ -858,7 +858,7 @@ // 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... @@ -961,23 +961,16 @@ } /** - * 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); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |