forked from mirrors/gecko-dev
		
	Backed out changeset aaabe6d53de2 (bug 1428713) for causing Bug 1483850 a=backout
This commit is contained in:
		
							parent
							
								
									1fc4333268
								
							
						
					
					
						commit
						fffda63981
					
				
					 8 changed files with 27 additions and 31 deletions
				
			
		|  | @ -13,10 +13,7 @@ import threading | ||||||
| import time | import time | ||||||
| import traceback | import traceback | ||||||
| 
 | 
 | ||||||
| try: | from Queue import Queue, Empty | ||||||
|     from queue import Queue, Empty |  | ||||||
| except ImportError: |  | ||||||
|     from Queue import Queue, Empty |  | ||||||
| from datetime import datetime | from datetime import datetime | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -127,14 +124,14 @@ class ProcessHandlerMixin(object): | ||||||
|             thread = threading.current_thread().name |             thread = threading.current_thread().name | ||||||
|             print("DBG::MOZPROC PID:{} ({}) | {}".format(self.pid, thread, msg)) |             print("DBG::MOZPROC PID:{} ({}) | {}".format(self.pid, thread, msg)) | ||||||
| 
 | 
 | ||||||
|         def __del__(self, _maxint=sys.maxsize): |         def __del__(self, _maxint=sys.maxint): | ||||||
|             if isWin: |             if isWin: | ||||||
|                 handle = getattr(self, '_handle', None) |                 handle = getattr(self, '_handle', None) | ||||||
|                 if handle: |                 if handle: | ||||||
|                     if hasattr(self, '_internal_poll'): |                     if hasattr(self, '_internal_poll'): | ||||||
|                         self._internal_poll(_deadstate=_maxint) |                         self._internal_poll(_deadstate=_maxint) | ||||||
|                     else: |                     else: | ||||||
|                         self.poll(_deadstate=sys.maxsize) |                         self.poll(_deadstate=sys.maxint) | ||||||
|                 if handle or self._job or self._io_port: |                 if handle or self._job or self._io_port: | ||||||
|                     self._cleanup() |                     self._cleanup() | ||||||
|             else: |             else: | ||||||
|  | @ -1072,7 +1069,7 @@ class StreamOutput(object): | ||||||
| 
 | 
 | ||||||
|     def __call__(self, line): |     def __call__(self, line): | ||||||
|         try: |         try: | ||||||
|             self.stream.write(line.decode() + '\n') |             self.stream.write(line + '\n') | ||||||
|         except UnicodeDecodeError: |         except UnicodeDecodeError: | ||||||
|             # TODO: Workaround for bug #991866 to make sure we can display when |             # TODO: Workaround for bug #991866 to make sure we can display when | ||||||
|             # when normal UTF-8 display is failing |             # when normal UTF-8 display is failing | ||||||
|  |  | ||||||
|  | @ -6,7 +6,7 @@ from __future__ import absolute_import | ||||||
| 
 | 
 | ||||||
| from setuptools import setup | from setuptools import setup | ||||||
| 
 | 
 | ||||||
| PACKAGE_VERSION = '1.0.0' | PACKAGE_VERSION = '0.26' | ||||||
| 
 | 
 | ||||||
| setup(name='mozprocess', | setup(name='mozprocess', | ||||||
|       version=PACKAGE_VERSION, |       version=PACKAGE_VERSION, | ||||||
|  | @ -17,8 +17,7 @@ setup(name='mozprocess', | ||||||
|                    'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)', |                    'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)', | ||||||
|                    'Natural Language :: English', |                    'Natural Language :: English', | ||||||
|                    'Operating System :: OS Independent', |                    'Operating System :: OS Independent', | ||||||
|                    'Programming Language :: Python :: 2.7', |                    'Programming Language :: Python', | ||||||
|                    'Programming Language :: Python :: 3.5' |  | ||||||
|                    'Topic :: Software Development :: Libraries :: Python Modules', |                    'Topic :: Software Development :: Libraries :: Python Modules', | ||||||
|                    ], |                    ], | ||||||
|       keywords='mozilla', |       keywords='mozilla', | ||||||
|  |  | ||||||
|  | @ -1,5 +1,6 @@ | ||||||
| [DEFAULT] | [DEFAULT] | ||||||
| subsuite = mozbase, os == "linux" | subsuite = mozbase, os == "linux" | ||||||
|  | skip-if = python == 3 | ||||||
| [test_kill.py] | [test_kill.py] | ||||||
| [test_misc.py] | [test_misc.py] | ||||||
| [test_poll.py] | [test_poll.py] | ||||||
|  |  | ||||||
|  | @ -4,10 +4,7 @@ from __future__ import absolute_import, print_function | ||||||
| 
 | 
 | ||||||
| import argparse | import argparse | ||||||
| import collections | import collections | ||||||
| try: | import ConfigParser | ||||||
|     import configparser as ConfigParser |  | ||||||
| except ImportError: |  | ||||||
|     import ConfigParser |  | ||||||
| import multiprocessing | import multiprocessing | ||||||
| import time | import time | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2,13 +2,13 @@ | ||||||
| 
 | 
 | ||||||
| from __future__ import absolute_import | from __future__ import absolute_import | ||||||
| 
 | 
 | ||||||
|  | import io | ||||||
| import os | import os | ||||||
| 
 | 
 | ||||||
| import mozunit | import mozunit | ||||||
| 
 | 
 | ||||||
| import proctest | import proctest | ||||||
| from mozprocess import processhandler | from mozprocess import processhandler | ||||||
| import six |  | ||||||
| 
 | 
 | ||||||
| here = os.path.dirname(os.path.abspath(__file__)) | here = os.path.dirname(os.path.abspath(__file__)) | ||||||
| 
 | 
 | ||||||
|  | @ -49,24 +49,26 @@ class ProcTestOutput(proctest.ProcTest): | ||||||
|         """ |         """ | ||||||
|         expected = '\n'.join([str(n) for n in range(0, 10)]) |         expected = '\n'.join([str(n) for n in range(0, 10)]) | ||||||
| 
 | 
 | ||||||
|         stream = six.StringIO() |         stream = io.BytesIO() | ||||||
|  |         buf = io.BufferedRandom(stream) | ||||||
| 
 | 
 | ||||||
|         p = processhandler.ProcessHandler([self.python, |         p = processhandler.ProcessHandler([self.python, | ||||||
|                                            os.path.join("scripts", "proccountfive.py")], |                                            os.path.join("scripts", "proccountfive.py")], | ||||||
|                                           cwd=here, |                                           cwd=here, | ||||||
|                                           stream=stream) |                                           stream=buf) | ||||||
| 
 | 
 | ||||||
|         p.run() |         p.run() | ||||||
|         p.wait() |         p.wait() | ||||||
|         for i in range(5, 10): |         for i in range(5, 10): | ||||||
|             stream.write(str(i) + '\n') |             stream.write(str(i) + '\n') | ||||||
| 
 | 
 | ||||||
|  |         buf.flush() | ||||||
|         self.assertEquals(stream.getvalue().strip(), expected) |         self.assertEquals(stream.getvalue().strip(), expected) | ||||||
| 
 | 
 | ||||||
|         # make sure mozprocess doesn't close the stream |         # make sure mozprocess doesn't close the stream | ||||||
|         # since mozprocess didn't create it |         # since mozprocess didn't create it | ||||||
|         self.assertFalse(stream.closed) |         self.assertFalse(buf.closed) | ||||||
|         stream.close() |         buf.close() | ||||||
| 
 | 
 | ||||||
|         self.determine_status(p, False, ()) |         self.determine_status(p, False, ()) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -33,11 +33,11 @@ class TestProcessReader(unittest.TestCase): | ||||||
|                                     timeout_callback=on_timeout) |                                     timeout_callback=on_timeout) | ||||||
| 
 | 
 | ||||||
|     def test_stdout_callback(self): |     def test_stdout_callback(self): | ||||||
|         proc = run_python('print(1); print(2)') |         proc = run_python('print 1; print 2') | ||||||
|         self.reader.start(proc) |         self.reader.start(proc) | ||||||
|         self.reader.thread.join() |         self.reader.thread.join() | ||||||
| 
 | 
 | ||||||
|         self.assertEqual(self.out.output, [b'1', b'2']) |         self.assertEqual(self.out.output, ['1', '2']) | ||||||
|         self.assertEqual(self.err.output, []) |         self.assertEqual(self.err.output, []) | ||||||
| 
 | 
 | ||||||
|     def test_stderr_callback(self): |     def test_stderr_callback(self): | ||||||
|  | @ -46,15 +46,15 @@ class TestProcessReader(unittest.TestCase): | ||||||
|         self.reader.thread.join() |         self.reader.thread.join() | ||||||
| 
 | 
 | ||||||
|         self.assertEqual(self.out.output, []) |         self.assertEqual(self.out.output, []) | ||||||
|         self.assertEqual(self.err.output, [b'hello world']) |         self.assertEqual(self.err.output, ['hello world']) | ||||||
| 
 | 
 | ||||||
|     def test_stdout_and_stderr_callbacks(self): |     def test_stdout_and_stderr_callbacks(self): | ||||||
|         proc = run_python('import sys; sys.stderr.write("hello world\\n"); print(1); print(2)') |         proc = run_python('import sys; sys.stderr.write("hello world\\n"); print 1; print 2') | ||||||
|         self.reader.start(proc) |         self.reader.start(proc) | ||||||
|         self.reader.thread.join() |         self.reader.thread.join() | ||||||
| 
 | 
 | ||||||
|         self.assertEqual(self.out.output, [b'1', b'2']) |         self.assertEqual(self.out.output, ['1', '2']) | ||||||
|         self.assertEqual(self.err.output, [b'hello world']) |         self.assertEqual(self.err.output, ['hello world']) | ||||||
| 
 | 
 | ||||||
|     def test_finished_callback(self): |     def test_finished_callback(self): | ||||||
|         self.assertFalse(self.finished) |         self.assertFalse(self.finished) | ||||||
|  | @ -85,21 +85,21 @@ class TestProcessReader(unittest.TestCase): | ||||||
|         proc = run_python('import sys; sys.stdout.write("1")') |         proc = run_python('import sys; sys.stdout.write("1")') | ||||||
|         self.reader.start(proc) |         self.reader.start(proc) | ||||||
|         self.reader.thread.join() |         self.reader.thread.join() | ||||||
|         self.assertEqual(self.out.output, [b'1']) |         self.assertEqual(self.out.output, ['1']) | ||||||
| 
 | 
 | ||||||
|     def test_read_with_strange_eol(self): |     def test_read_with_strange_eol(self): | ||||||
|         proc = run_python('import sys; sys.stdout.write("1\\r\\r\\r\\n")') |         proc = run_python('import sys; sys.stdout.write("1\\r\\r\\r\\n")') | ||||||
|         self.reader.start(proc) |         self.reader.start(proc) | ||||||
|         self.reader.thread.join() |         self.reader.thread.join() | ||||||
|         self.assertEqual(self.out.output, [b'1']) |         self.assertEqual(self.out.output, ['1']) | ||||||
| 
 | 
 | ||||||
|     def test_mixed_stdout_stderr(self): |     def test_mixed_stdout_stderr(self): | ||||||
|         proc = run_python('import sys; sys.stderr.write("hello world\\n"); print(1); print(2)', |         proc = run_python('import sys; sys.stderr.write("hello world\\n"); print 1; print 2', | ||||||
|                           stderr=subprocess.STDOUT) |                           stderr=subprocess.STDOUT) | ||||||
|         self.reader.start(proc) |         self.reader.start(proc) | ||||||
|         self.reader.thread.join() |         self.reader.thread.join() | ||||||
| 
 | 
 | ||||||
|         self.assertEqual(sorted(self.out.output), sorted([b'1', b'2', b'hello world'])) |         self.assertEqual(sorted(self.out.output), sorted(['1', '2', 'hello world'])) | ||||||
|         self.assertEqual(self.err.output, []) |         self.assertEqual(self.err.output, []) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ deps = [ | ||||||
|     'mozfile==1.*', |     'mozfile==1.*', | ||||||
|     'mozinfo>=0.7,<2', |     'mozinfo>=0.7,<2', | ||||||
|     'mozlog==3.*', |     'mozlog==3.*', | ||||||
|     'mozprocess>=0.23,<2', |     'mozprocess>=0.23,<1', | ||||||
|     'mozprofile>=1.1.0,<2', |     'mozprofile>=1.1.0,<2', | ||||||
|     'six>=1.10.0,<2', |     'six>=1.10.0,<2', | ||||||
| ] | ] | ||||||
|  |  | ||||||
|  | @ -13,7 +13,7 @@ deps = ['httplib2 == 0.9.2', | ||||||
|         'mozhttpd == 0.7', |         'mozhttpd == 0.7', | ||||||
|         'mozinfo >= 0.10', |         'mozinfo >= 0.10', | ||||||
|         'mozinstall == 1.16', |         'mozinstall == 1.16', | ||||||
|         'mozprocess == 1.0.0', |         'mozprocess == 0.26', | ||||||
|         'mozprofile == 1.1.0', |         'mozprofile == 1.1.0', | ||||||
|         'mozrunner == 7.0.1', |         'mozrunner == 7.0.1', | ||||||
|         'mozversion == 1.5', |         'mozversion == 1.5', | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Tiberius Oros
						Tiberius Oros