From 366c89aa5932c683bd086980d51ff0a60bdb8682 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Tue, 24 Sep 2019 15:40:53 +0200 Subject: [PATCH 01/16] [REM] cmd example, use cmd wrapper instead --- examples/cmd.py | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 examples/cmd.py diff --git a/examples/cmd.py b/examples/cmd.py deleted file mode 100644 index d3c2c12..0000000 --- a/examples/cmd.py +++ /dev/null @@ -1,36 +0,0 @@ -# A simple example code for wexpect - -from __future__ import print_function - -import sys -import os - -here = os.path.dirname(os.path.abspath(__file__)) -wexpectPath = os.path.dirname(here) -#sys.path.insert(0, wexpectPath) - -import wexpect - -# Path of cmd executable: -cmdPathes = ['C:\Windows\System32\cmd.exe', 'cmd.exe', 'cmd'] -cmdPrompt = '>' - -for cmdPath in cmdPathes: - # Start the child process - p = wexpect.spawn(cmdPath) - - # Wait for prompt - p.expect(cmdPrompt) - - # print the texts - print(p.before, end='') - print(p.match.group(0), end='') - - # Send a command - p.sendline('ls') - p.expect(cmdPrompt) - - # print the texts - print(p.before, end='') - print(p.match.group(0), end='') - From 2cca9aa5f284ffdd6b254c7a1739c396a9a44842 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Tue, 1 Oct 2019 17:19:05 +0200 Subject: [PATCH 02/16] [CLN] Add deprecation warning to tell the end of linux support --- wexpect.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/wexpect.py b/wexpect.py index 55a220a..aafa756 100644 --- a/wexpect.py +++ b/wexpect.py @@ -75,6 +75,7 @@ Pexpect is intended for UNIX-like operating systems.""") # # Import built in modules # +import warnings import logging import os import time @@ -110,6 +111,13 @@ except ImportError as e: screenbufferfillchar = '\4' maxconsoleY = 8000 +warnings.simplefilter("always", category=DeprecationWarning) +no_unix_deprecation_warning = ''' +################################## WARNING ################################## +{} is deprecated, and will be removed soon. +Please contact me and report it at github.com/raczben/wexpect if you use it. +################################## WARNING ################################## +''' # The version is handled by the package: pbr, which derives the version from the git tags. try: @@ -534,8 +542,10 @@ class spawn_unix (object): s.append('delayafterterminate: ' + str(self.delayafterterminate)) return '\n'.join(s) - def _spawn(self,command,args=[]): + def _spawn(self,command,args=[]): + warnings.warn(no_unix_deprecation_warning.format("spawn_unix::_spawn"), DeprecationWarning) + """This starts the given command in a child process. This does all the fork/exec type of stuff for a pty. This is called by __init__. If args is empty then command will be parsed (split on spaces) and args will be From a338f1fad751eba43a28b04852feebc62fa7a986 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Fri, 4 Oct 2019 11:18:52 +0200 Subject: [PATCH 03/16] [CLN] ADD more deprecation warning; [ADD] readline testcase --- README.md | 13 +++++++ tests/lines_printer.py | 15 ++++++++ tests/test_readline.py | 83 ++++++++++++++++++++++++++++++++++++++++++ wexpect.py | 8 ++++ 4 files changed, 119 insertions(+) create mode 100644 tests/lines_printer.py create mode 100644 tests/test_readline.py diff --git a/README.md b/README.md index 36ac63a..1d2420a 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,19 @@ child.sendline('exit') For more information see [examples](./examples) folder. +## Code Clean up! + +Wexpect works only on Windows platforms. There are handy tools for other platforms. Therefore I will +remove any non-windows code. If you see following warning in your console please contact me to +prevent the removal of that function. + +``` +################################## WARNING ################################## + is deprecated, and will be removed soon. +Please contact me and report it at github.com/raczben/wexpect if you use it. +################################## WARNING ################################## +``` + --- ## What is it? diff --git a/tests/lines_printer.py b/tests/lines_printer.py new file mode 100644 index 0000000..6e7f051 --- /dev/null +++ b/tests/lines_printer.py @@ -0,0 +1,15 @@ +''' +This is is a very basic stdio handler script. This is used by python.py example. +''' + +import time + +# Read an integer from the user: +print('Give a small integer: ', end='') +num = input() + +# Wait the given time +for i in range(int(num)): + print('waiter ' + str(i)) + time.sleep(0.2) +print('Bye!') \ No newline at end of file diff --git a/tests/test_readline.py b/tests/test_readline.py new file mode 100644 index 0000000..583dc8c --- /dev/null +++ b/tests/test_readline.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python +''' +MIT License + +Copyright (c) 2008 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, Benedek Racz + +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. +''' +import wexpect +import time +import sys +import os +import unittest +from . import PexpectTestCase + +here = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, here) + +print(wexpect.__version__) + +# With quotes (C:\Program Files\Python37\python.exe needs quotes) +python_executable = '"' + sys.executable + '" ' +child_script = here + '\\lines_printer.py' + +class ReadLineTestCase(PexpectTestCase.PexpectTestCase): + def testReadline(self): + fooPath = python_executable + ' ' + child_script + prompt = ': ' + num = 5 + + # Start the child process + p = wexpect.spawn(fooPath) + # Wait for prompt + p.expect(prompt) + p.sendline(str(num)) + p.expect('Bye!\r\n') + expected_lines = p.before.splitlines(True) # Keep the line end + expected_lines += [p.match.group()] + + # Start the child process + p = wexpect.spawn(fooPath) + # Wait for prompt + p.expect(prompt) + + p.sendline(str(num)) + for i in range(num +2): # +1 the line of sendline +1: Bye + line = p.readline() + self.assertEqual(expected_lines[i], line) + + # Start the child process + p = wexpect.spawn(fooPath) + # Wait for prompt + p.expect(prompt) + + p.sendline(str(num)) + readlines_lines = p.readlines() + self.assertEqual(expected_lines, readlines_lines) + + +if __name__ == '__main__': + unittest.main() + +suite = unittest.makeSuite(ReadLineTestCase,'test') diff --git a/wexpect.py b/wexpect.py index aafa756..916851a 100644 --- a/wexpect.py +++ b/wexpect.py @@ -633,6 +633,8 @@ class spawn_unix (object): self.closed = False def __fork_pty(self): + warnings.warn(no_unix_deprecation_warning.format("spawn_unix::__fork_pty"), DeprecationWarning) + """This implements a substitute for the forkpty system call. This should be more portable than the pty.fork() function. Specifically, @@ -672,6 +674,7 @@ class spawn_unix (object): return pid, parent_fd def __pty_make_controlling_tty(self, tty_fd): + warnings.warn(no_unix_deprecation_warning.format("spawn_unix::__pty_make_controlling_tty"), DeprecationWarning) """This makes the pseudo-terminal the controlling tty. This should be more portable than the pty.fork() function. Specifically, this should @@ -738,6 +741,7 @@ class spawn_unix (object): def flush (self): # File-like object. + warnings.warn(no_unix_deprecation_warning.format("spawn_unix::flush"), DeprecationWarning) """This does nothing. It is here to support the interface for a File-like object. """ @@ -835,6 +839,7 @@ class spawn_unix (object): termios.tcsetattr(self.child_fd, termios.TCSANOW, attr) def read_nonblocking (self, size = 1, timeout = -1): + warnings.warn(no_unix_deprecation_warning.format("spawn_unix::read_nonblocking"), DeprecationWarning) """This reads at most size characters from the child application. It includes a timeout. If the read does not complete within the timeout @@ -1006,6 +1011,8 @@ class spawn_unix (object): self.write (s) def send(self, s): + warnings.warn(no_unix_deprecation_warning.format("spawn_unix::send"), DeprecationWarning) + """This sends a string to the child process. This returns the number of bytes written. If a log file was set then the data is also written to @@ -1178,6 +1185,7 @@ class spawn_unix (object): return self.exitstatus def isalive(self): + warnings.warn(no_unix_deprecation_warning.format("spawn_unix::isalive"), DeprecationWarning) """This tests if the child process is running or not. This is non-blocking. If the child was terminated then this will read the From 2c978c65643314e0bf96ce3ecc145d6b8bc0c5f4 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Fri, 4 Oct 2019 13:26:36 +0200 Subject: [PATCH 04/16] [ADD] more tests, and more deprecated warnings --- codecov.yml | 4 ++++ tests/test_constructor.py | 4 ++++ wexpect.py | 17 +++++++++-------- 3 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..d7b35c5 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,4 @@ +# Settings for https://codecov.io/gh/raczben/wexpect/ + +ignore: + - tests/* # ignore folders and all its contents diff --git a/tests/test_constructor.py b/tests/test_constructor.py index eea217f..227abff 100644 --- a/tests/test_constructor.py +++ b/tests/test_constructor.py @@ -33,6 +33,10 @@ class TestCaseConstructor(PexpectTestCase.PexpectTestCase): p2 = wexpect.spawn('uname', ['-m', '-n', '-p', '-r', '-s', '-v']) p2.expect(wexpect.EOF) self.assertEqual(p1.before, p2.before) + self.assertEqual(str(p1).splitlines()[1:9], str(p2).splitlines()[1:9]) + + run_result = wexpect.run('uname -m -n -p -r -s -v') + self.assertEqual(run_result, p2.before) def test_named_parameters (self): '''This tests that named parameters work. diff --git a/wexpect.py b/wexpect.py index 916851a..c48e810 100644 --- a/wexpect.py +++ b/wexpect.py @@ -543,7 +543,7 @@ class spawn_unix (object): return '\n'.join(s) - def _spawn(self,command,args=[]): + def _spawn(self,command,args=[]): # pragma: no cover warnings.warn(no_unix_deprecation_warning.format("spawn_unix::_spawn"), DeprecationWarning) """This starts the given command in a child process. This does all the @@ -632,7 +632,7 @@ class spawn_unix (object): self.terminated = False self.closed = False - def __fork_pty(self): + def __fork_pty(self): # pragma: no cover warnings.warn(no_unix_deprecation_warning.format("spawn_unix::__fork_pty"), DeprecationWarning) @@ -673,7 +673,7 @@ class spawn_unix (object): return pid, parent_fd - def __pty_make_controlling_tty(self, tty_fd): + def __pty_make_controlling_tty(self, tty_fd): # pragma: no cover warnings.warn(no_unix_deprecation_warning.format("spawn_unix::__pty_make_controlling_tty"), DeprecationWarning) """This makes the pseudo-terminal the controlling tty. This should be @@ -739,7 +739,7 @@ class spawn_unix (object): self.closed = True #self.pid = None - def flush (self): # File-like object. + def flush (self): # pragma: no cover # File-like object. warnings.warn(no_unix_deprecation_warning.format("spawn_unix::flush"), DeprecationWarning) """This does nothing. It is here to support the interface for a @@ -838,7 +838,7 @@ class spawn_unix (object): # and blocked on some platforms. TCSADRAIN is probably ideal if it worked. termios.tcsetattr(self.child_fd, termios.TCSANOW, attr) - def read_nonblocking (self, size = 1, timeout = -1): + def read_nonblocking (self, size = 1, timeout = -1): # pragma: no cover warnings.warn(no_unix_deprecation_warning.format("spawn_unix::read_nonblocking"), DeprecationWarning) """This reads at most size characters from the child application. It @@ -1010,7 +1010,7 @@ class spawn_unix (object): for s in sequence: self.write (s) - def send(self, s): + def send(self, s): # pragma: no cover warnings.warn(no_unix_deprecation_warning.format("spawn_unix::send"), DeprecationWarning) @@ -1184,7 +1184,7 @@ class spawn_unix (object): raise ExceptionPexpect ('Wait was called for a child process that is stopped. This is not supported. Is some other process attempting job control with our child pid?') return self.exitstatus - def isalive(self): + def isalive(self): # pragma: no cover warnings.warn(no_unix_deprecation_warning.format("spawn_unix::isalive"), DeprecationWarning) """This tests if the child process is running or not. This is @@ -1523,7 +1523,8 @@ class spawn_unix (object): s = struct.pack('HHHH', r, c, 0, 0) fcntl.ioctl(self.fileno(), TIOCSWINSZ, s) - def interact(self, escape_character = chr(29), input_filter = None, output_filter = None): + def interact(self, escape_character = chr(29), input_filter = None, output_filter = None): # pragma: no cover + warnings.warn(no_unix_deprecation_warning.format("spawn_unix::interact"), DeprecationWarning) """This gives control of the child process to the interactive user (the human at the keyboard). Keystrokes are sent to the child process, and From 8f1aeb7da8719165b01d19657222d33681cf77e2 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Mon, 7 Oct 2019 16:43:10 +0200 Subject: [PATCH 05/16] starting new branch for issue #8; [FIX] removing handling of non-handled exception from switchTo() --- wexpect.py | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/wexpect.py b/wexpect.py index c48e810..ee4967d 100644 --- a/wexpect.py +++ b/wexpect.py @@ -2064,22 +2064,13 @@ class Wtty: win32console.AttachConsole(self.conpid) self.__consin = win32console.GetStdHandle(win32console.STD_INPUT_HANDLE) self.__consout = self.getConsoleOut() - except Exception as e: - #e = traceback.format_exc() - try: - win32console.AttachConsole(self.__parentPid) - except Exception as ex: - pass - #log(e) - #log(ex) - return - #self.__consin = None - #self.__consout = None - #raise e - - - - + except: + # In case of any error: We "switch back" (attach) our original console, then raise the + # error. + win32console.AttachConsole(self.__parentPid) + raise + + def switchBack(self): """Releases from the current console and attaches to the parents.""" From 0b1dec9535fd5aea6cf17b05dd99b0ea2b537520 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Tue, 8 Oct 2019 11:32:09 +0200 Subject: [PATCH 06/16] [FIX] add EOF exception into switchto --- appveyor.yml | 13 +++++++------ wexpect.py | 13 +++++++++++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 41f7141..8c00947 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -39,9 +39,10 @@ after_test: # Create source distribution. - python -m setup sdist - # Upload to test pypi - - twine upload -r testpypi dist\\wexpect*.tar.gz - - # Upload to offitial pypi - - twine upload -r pypi dist\\wexpect*.tar.gz - \ No newline at end of file + # Upload to pypi. + # More precisely. Upload pypi the master builds, and to test-pypi any other builds. + - git branch | find "* master" > NUL & IF ERRORLEVEL 1 ( \ + twine upload -r testpypi dist\\wexpect*.tar.gz \ + ) ELSE ( \ + twine upload -r pypi dist\\wexpect*.tar.gz ) + \ No newline at end of file diff --git a/wexpect.py b/wexpect.py index ee4967d..429f0f6 100644 --- a/wexpect.py +++ b/wexpect.py @@ -2064,13 +2064,22 @@ class Wtty: win32console.AttachConsole(self.conpid) self.__consin = win32console.GetStdHandle(win32console.STD_INPUT_HANDLE) self.__consout = self.getConsoleOut() + + except pywintypes.error as e: + # pywintypes.error: (5, 'AttachConsole', 'Access is denied.') + # When child has finished... + logging.info(e) + # In case of any error: We "switch back" (attach) our original console, then raise the + # error. + win32console.AttachConsole(self.__parentPid) + raise EOF('End Of File (EOF) in switchTo().') except: # In case of any error: We "switch back" (attach) our original console, then raise the # error. win32console.AttachConsole(self.__parentPid) raise - - + + def switchBack(self): """Releases from the current console and attaches to the parents.""" From 0f2467f30c2c331464ecd4c254268d40ad73cbf3 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Tue, 8 Oct 2019 11:40:47 +0200 Subject: [PATCH 07/16] [FIX] switchTo and add swithcBack --- appveyor.yml | 1 + wexpect.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 8c00947..bcc1a4e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -41,6 +41,7 @@ after_test: # Upload to pypi. # More precisely. Upload pypi the master builds, and to test-pypi any other builds. + # See more at https://stackoverflow.com/a/33662275/2506522 - git branch | find "* master" > NUL & IF ERRORLEVEL 1 ( \ twine upload -r testpypi dist\\wexpect*.tar.gz \ ) ELSE ( \ diff --git a/wexpect.py b/wexpect.py index 429f0f6..78454da 100644 --- a/wexpect.py +++ b/wexpect.py @@ -2071,12 +2071,12 @@ class Wtty: logging.info(e) # In case of any error: We "switch back" (attach) our original console, then raise the # error. - win32console.AttachConsole(self.__parentPid) + self.switchBack() raise EOF('End Of File (EOF) in switchTo().') except: # In case of any error: We "switch back" (attach) our original console, then raise the # error. - win32console.AttachConsole(self.__parentPid) + self.switchBack() raise From 406115ce98ad69470f947476b66ce12aa58fc190 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Tue, 8 Oct 2019 11:47:54 +0200 Subject: [PATCH 08/16] [FIX] appveyor config --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index bcc1a4e..96b0cb8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -42,8 +42,8 @@ after_test: # Upload to pypi. # More precisely. Upload pypi the master builds, and to test-pypi any other builds. # See more at https://stackoverflow.com/a/33662275/2506522 - - git branch | find "* master" > NUL & IF ERRORLEVEL 1 ( \ - twine upload -r testpypi dist\\wexpect*.tar.gz \ - ) ELSE ( \ + - git branch | find "* master" > NUL & IF ERRORLEVEL 1 ( + twine upload -r testpypi dist\\wexpect*.tar.gz + ) ELSE ( twine upload -r pypi dist\\wexpect*.tar.gz ) \ No newline at end of file From 8c05f4344b3aeb8f06ffbe104bd82e24bc745062 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Wed, 30 Oct 2019 16:36:28 +0100 Subject: [PATCH 09/16] [FIX] appeyor config, use APPVEYOR_REPO_BRANCH envirnoment variable --- appveyor.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 96b0cb8..2ef4c3a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -42,8 +42,9 @@ after_test: # Upload to pypi. # More precisely. Upload pypi the master builds, and to test-pypi any other builds. # See more at https://stackoverflow.com/a/33662275/2506522 - - git branch | find "* master" > NUL & IF ERRORLEVEL 1 ( - twine upload -r testpypi dist\\wexpect*.tar.gz - ) ELSE ( - twine upload -r pypi dist\\wexpect*.tar.gz ) + - IF %APPVEYOR_REPO_BRANCH%==master ( + twine upload -r pypi dist\\wexpect*.tar.gz + ) ELSE ( + twine upload -r testpypi dist\\wexpect*.tar.gz + ) \ No newline at end of file From a341fa5becf2319c203f1aaf82a4854607a27ca0 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Wed, 30 Oct 2019 16:42:34 +0100 Subject: [PATCH 10/16] [FIX] appveyor link --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 2ef4c3a..d13b768 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -41,10 +41,10 @@ after_test: # Upload to pypi. # More precisely. Upload pypi the master builds, and to test-pypi any other builds. - # See more at https://stackoverflow.com/a/33662275/2506522 + # See more at https://stackoverflow.com/a/39155147/2506522 - IF %APPVEYOR_REPO_BRANCH%==master ( twine upload -r pypi dist\\wexpect*.tar.gz ) ELSE ( twine upload -r testpypi dist\\wexpect*.tar.gz - ) + ) \ No newline at end of file From 3f6a0301f263c9877b6a94b2dfd4ca33e115af42 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Wed, 30 Oct 2019 16:56:09 +0100 Subject: [PATCH 11/16] debug appveyor --- appveyor.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index d13b768..311102d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,6 +10,7 @@ environment: secure: N+tYP6JrVCZ12LX7MUmHYJ8kx07F4A1hXtmEW01RmhrrQBdylIf0SO/eEfW5f4ox3S4xG/lgGSzNlZckvgifrsYeeBkWwoSH5/AJ3SnOJ7HBVojVt2t3bAznS6x3aPT7WDpwGN7piwus9aHSmpKaOzRoEOBKfgHv3aUzb907C0d0Yr12LU/4cIoTAn7jMziifSq45Z50lsQwzYic/VkarxTh+GXuCCm1Mb8F686H8i6Smm1Q1n9BsXowYnzwdrTZSBVOUtpd48Mh9JKgSNhfmQ== testpypipw: secure: CcyBI8e/2LdIT2aYIytTAgR4795DNBDM/ztsz1kqZYYOeNc3zlJWLdYWrnjCHn5W6/ZcAHrsxCdCMHvtr6PIVgBRpl2RR3fk2jKTzKqJJsLW871q30BsE0kws32f1IiqfjVtLn8BUC91IJ2xBBXtOYktf1tCMi3zJMSF9+MIOQKIu298bIRnD1Lc+4lzcSZJOn4I7dOMdzlcCMRqhtO58TGwR/hD+22FHjyWVB8nLL18AO+XXS9lHSOUrH6rD5NYvVFZD68oV/RrCGAjRmfMnw== + git_branch : $(APPVEYOR_REPO_BRANCH) build: off @@ -42,6 +43,8 @@ after_test: # Upload to pypi. # More precisely. Upload pypi the master builds, and to test-pypi any other builds. # See more at https://stackoverflow.com/a/39155147/2506522 + - echo %APPVEYOR_REPO_BRANCH% + - echo %git_branch% - IF %APPVEYOR_REPO_BRANCH%==master ( twine upload -r pypi dist\\wexpect*.tar.gz ) ELSE ( From 1152aaff1ea332ac15f997d1737f29339e9ac7bb Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Thu, 31 Oct 2019 09:03:46 +0100 Subject: [PATCH 12/16] [FIX] appveyor config. Test branch -> testpypi; master -> pypi --- appveyor.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 311102d..6a5a927 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,8 +10,6 @@ environment: secure: N+tYP6JrVCZ12LX7MUmHYJ8kx07F4A1hXtmEW01RmhrrQBdylIf0SO/eEfW5f4ox3S4xG/lgGSzNlZckvgifrsYeeBkWwoSH5/AJ3SnOJ7HBVojVt2t3bAznS6x3aPT7WDpwGN7piwus9aHSmpKaOzRoEOBKfgHv3aUzb907C0d0Yr12LU/4cIoTAn7jMziifSq45Z50lsQwzYic/VkarxTh+GXuCCm1Mb8F686H8i6Smm1Q1n9BsXowYnzwdrTZSBVOUtpd48Mh9JKgSNhfmQ== testpypipw: secure: CcyBI8e/2LdIT2aYIytTAgR4795DNBDM/ztsz1kqZYYOeNc3zlJWLdYWrnjCHn5W6/ZcAHrsxCdCMHvtr6PIVgBRpl2RR3fk2jKTzKqJJsLW871q30BsE0kws32f1IiqfjVtLn8BUC91IJ2xBBXtOYktf1tCMi3zJMSF9+MIOQKIu298bIRnD1Lc+4lzcSZJOn4I7dOMdzlcCMRqhtO58TGwR/hD+22FHjyWVB8nLL18AO+XXS9lHSOUrH6rD5NYvVFZD68oV/RrCGAjRmfMnw== - git_branch : $(APPVEYOR_REPO_BRANCH) - build: off @@ -43,11 +41,10 @@ after_test: # Upload to pypi. # More precisely. Upload pypi the master builds, and to test-pypi any other builds. # See more at https://stackoverflow.com/a/39155147/2506522 - - echo %APPVEYOR_REPO_BRANCH% - - echo %git_branch% - IF %APPVEYOR_REPO_BRANCH%==master ( twine upload -r pypi dist\\wexpect*.tar.gz - ) ELSE ( + ) + IF %APPVEYOR_REPO_BRANCH%==test ( twine upload -r testpypi dist\\wexpect*.tar.gz ) \ No newline at end of file From 3e9d3526e7cc6c2eae8f4d76ea301445cecf5533 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Thu, 31 Oct 2019 09:13:30 +0100 Subject: [PATCH 13/16] [FIX] appveyor config. separete if-s --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6a5a927..8f35fd3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -39,12 +39,12 @@ after_test: - python -m setup sdist # Upload to pypi. - # More precisely. Upload pypi the master builds, and to test-pypi any other builds. + # More precisely. Upload pypi the master builds, and to test-pypi the test builds. # See more at https://stackoverflow.com/a/39155147/2506522 - IF %APPVEYOR_REPO_BRANCH%==master ( twine upload -r pypi dist\\wexpect*.tar.gz ) - IF %APPVEYOR_REPO_BRANCH%==test ( + - IF %APPVEYOR_REPO_BRANCH%==test ( twine upload -r testpypi dist\\wexpect*.tar.gz ) \ No newline at end of file From 9b298815c95f386ddd54dbd95420d39803052f81 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Thu, 31 Oct 2019 10:14:29 +0100 Subject: [PATCH 14/16] [FIX] First fix of #i10: Using Floor division in getPoint() --- appveyor.yml | 6 +++++- wexpect.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 8f35fd3..303d14c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -39,11 +39,15 @@ after_test: - python -m setup sdist # Upload to pypi. - # More precisely. Upload pypi the master builds, and to test-pypi the test builds. + # More precisely. The master and release builds will be uploaded to pypi. Test branch will be + # uploaded to test-pypi the test builds. # See more at https://stackoverflow.com/a/39155147/2506522 - IF %APPVEYOR_REPO_BRANCH%==master ( twine upload -r pypi dist\\wexpect*.tar.gz ) + - IF %APPVEYOR_REPO_TAG% ( + twine upload -r pypi dist\\wexpect*.tar.gz + ) - IF %APPVEYOR_REPO_BRANCH%==test ( twine upload -r testpypi dist\\wexpect*.tar.gz ) diff --git a/wexpect.py b/wexpect.py index 78454da..f2bdfaa 100644 --- a/wexpect.py +++ b/wexpect.py @@ -2165,7 +2165,7 @@ class Wtty: """Converts an offset to a point represented as a tuple.""" x = offset % self.__consSize[0] - y = offset / self.__consSize[0] + y = offset // self.__consSize[0] return (x, y) def getOffset(self, x, y): From 7cd3383fa3d94b6047165b534f791c22e888390d Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Thu, 31 Oct 2019 10:18:03 +0100 Subject: [PATCH 15/16] [FIX] appveyor APPVEYOR_REPO_TAG --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 303d14c..4cc1b98 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -45,7 +45,7 @@ after_test: - IF %APPVEYOR_REPO_BRANCH%==master ( twine upload -r pypi dist\\wexpect*.tar.gz ) - - IF %APPVEYOR_REPO_TAG% ( + - IF %APPVEYOR_REPO_TAG%=="true" ( twine upload -r pypi dist\\wexpect*.tar.gz ) - IF %APPVEYOR_REPO_BRANCH%==test ( From b69c3c69bbbccd65d3b09b306ff828a8de9a82fe Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Thu, 31 Oct 2019 10:39:22 +0100 Subject: [PATCH 16/16] [FIX] appveyor config --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 4cc1b98..37eeab6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -42,10 +42,11 @@ after_test: # More precisely. The master and release builds will be uploaded to pypi. Test branch will be # uploaded to test-pypi the test builds. # See more at https://stackoverflow.com/a/39155147/2506522 + - IF %APPVEYOR_REPO_BRANCH%==master ( twine upload -r pypi dist\\wexpect*.tar.gz ) - - IF %APPVEYOR_REPO_TAG%=="true" ( + - IF %APPVEYOR_REPO_TAG%==true ( twine upload -r pypi dist\\wexpect*.tar.gz ) - IF %APPVEYOR_REPO_BRANCH%==test (