Closed FeralBytes closed 10 years ago
Thanks for this! Since you've made a fixed version (which is great), could you make this a pull request rather than an issue? That way it will be easy to see what has changed, and to comment and add further changes - and of course to merge it into the master branch.
OK, latter on today I will setup a pull request.
Just to confirm: This fix worked for me on Python 3.4, aswell. Buildozer now runs smoothly. Had the same errors before, after I replaced pexpect.py with your version there where no errors anymore.
This bug was created to specifically address the issues with the pexpect.py file included with Buildozer. Per the conversation held here: https://github.com/kivy/buildozer/issues/84 And Here: https://github.com/kivy/buildozer/issues/113 Below is an included corrected file to work with Python 3, although it has not been throughly tested. And has not been tested to work with Python 2. Updates will be posted to this Issue.
lib/pexpect.py Patch Below.
"""Pexpect is a Python module for spawning child applications and controlling them automatically. Pexpect can be used for automating interactive applications such as ssh, ftp, passwd, telnet, etc. It can be used to a automate setup scripts for duplicating software package installations on different servers. It can be used for automated software testing. Pexpect is in the spirit of Don Libes' Expect, but Pexpect is pure Python. Other Expect-like modules for Python require TCL and Expect or require C extensions to be compiled. Pexpect does not use C, Expect, or TCL extensions. It should work on any platform that supports the standard Python pty module. The Pexpect interface focuses on ease of use so that simple tasks are easy.
There are two main interfaces to Pexpect -- the function, run() and the class, spawn. You can call the run() function to execute a command and return the output. This is a handy replacement for os.system().
For example::
The more powerful interface is the spawn class. You can use this to spawn an external child command and then interact with the child by sending lines and expecting responses.
For example::
This works even for commands that ask for passwords or other input outside of the normal stdio streams.
Credits: Noah Spurrier, Richard Holden, Marco Molteni, Kimberley Burchett, Robert Stone, Hartmut Goebel, Chad Schroeder, Erick Tryzelaar, Dave Kirby, Ids vander Molen, George Todd, Noel Taylor, Nicolas D. Cesar, Alexander Gattin, Geoffrey Marshall, Francisco Lourenco, Glen Mabey, Karthik Gurusamy, Fernando Perez, Corey Minyard, Jon Cohen, Guillaume Chazarain, Andrew Ryan, Nick Craig-Wood, Andrew Stone, Jorgen Grahn (Let me know if I forgot anyone.)
Free, open source, and all that good stuff.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Pexpect Copyright (c) 2008 Noah Spurrier http://pexpect.sourceforge.net/
$Id: pexpect.py 507 2007-12-27 02:40:52Z noah $ """
try: import os, sys, time import select import string import re import struct import resource import types import pty import tty import termios import fcntl import errno import traceback import signal except ImportError as e: raise ImportError (str(e) + """
A critical module was not found. Probably this operating system does not support it. Pexpect is intended for UNIX-like operating systems.""")
version = '2.3' revision = '$Revision: 399 $' all = ['ExceptionPexpect', 'EOF', 'TIMEOUT', 'spawn', 'run', 'which', 'split_command_line', 'version', 'revision']
Exception classes used by this module.
class ExceptionPexpect(Exception):
class EOF(ExceptionPexpect):
class TIMEOUT(ExceptionPexpect):
class TIMEOUT_PATTERN(TIMEOUT):
"""Raised when the pattern match time exceeds the timeout.
This is different than a read TIMEOUT because the child process may
give output, thus never give a TIMEOUT, but the output
may never match a pattern.
"""
class MAXBUFFER(ExceptionPexpect):
"""Raised when a scan buffer fills before matching an expected pattern."""
def run (command, timeout=-1, withexitstatus=False, events=None, extra_args=None, logfile=None, cwd=None, env=None):
class spawn (object):
The following methods are no longer supported or allowed.
End of spawn class
class searcher_string (object):
class searcher_re (object):
def which (filename):
def split_command_line(command_line):
vi:ts=4:sw=4:expandtab:ft=python: