Show More
@@ -22,6 +22,7 b' You should have received a copy of the G' | |||||
22 | along with git_http_backend.py Project. |
|
22 | along with git_http_backend.py Project. | |
23 | If not, see <http://www.gnu.org/licenses/>. |
|
23 | If not, see <http://www.gnu.org/licenses/>. | |
24 | ''' |
|
24 | ''' | |
|
25 | from __future__ import unicode_literals | |||
25 | import os |
|
26 | import os | |
26 | import subprocess |
|
27 | import subprocess | |
27 | import threading |
|
28 | import threading | |
@@ -40,22 +41,23 b' class StreamFeeder(threading.Thread):' | |||||
40 | self.daemon = True |
|
41 | self.daemon = True | |
41 | filelike = False |
|
42 | filelike = False | |
42 | self.bytes = b'' |
|
43 | self.bytes = b'' | |
43 | if type(source) in (type(''), bytes, bytearray): # string-like |
|
44 | if type(source) in (type(''), bytes, bytearray): # string-like | |
44 | self.bytes = bytes(source) |
|
45 | self.bytes = bytes(source) | |
45 | else: # can be either file pointer or file-like |
|
46 | else: # can be either file pointer or file-like | |
46 | if type(source) in (int, long): # file pointer it is |
|
47 | if type(source) in (int, long): # file pointer it is | |
47 | ## converting file descriptor (int) stdin into file-like |
|
48 | ## converting file descriptor (int) stdin into file-like | |
48 | try: |
|
49 | try: | |
49 | source = os.fdopen(source, 'rb', 16384) |
|
50 | source = os.fdopen(source, 'rb', 16384) | |
50 | except: |
|
51 | except Exception: | |
51 | pass |
|
52 | pass | |
52 | # let's see if source is file-like by now |
|
53 | # let's see if source is file-like by now | |
53 | try: |
|
54 | try: | |
54 | filelike = source.read |
|
55 | filelike = source.read | |
55 | except: |
|
56 | except Exception: | |
56 | pass |
|
57 | pass | |
57 | if not filelike and not self.bytes: |
|
58 | if not filelike and not self.bytes: | |
58 |
raise TypeError("StreamFeeder's source object must be a readable |
|
59 | raise TypeError("StreamFeeder's source object must be a readable " | |
|
60 | "file-like, a file descriptor, or a string-like.") | |||
59 | self.source = source |
|
61 | self.source = source | |
60 | self.readiface, self.writeiface = os.pipe() |
|
62 | self.readiface, self.writeiface = os.pipe() | |
61 |
|
63 | |||
@@ -325,11 +327,11 b' class SubprocessIOChunker(object):' | |||||
325 | ''' |
|
327 | ''' | |
326 | Initializes SubprocessIOChunker |
|
328 | Initializes SubprocessIOChunker | |
327 |
|
329 | |||
328 |
|
|
330 | :param cmd: A Subprocess.Popen style "cmd". Can be string or array of strings | |
329 |
|
|
331 | :param inputstream: (Default: None) A file-like, string, or file pointer. | |
330 |
|
|
332 | :param buffer_size: (Default: 65536) A size of total buffer per stream in bytes. | |
331 |
|
|
333 | :param chunk_size: (Default: 4096) A max size of a chunk. Actual chunk may be smaller. | |
332 |
|
|
334 | :param starting_values: (Default: []) An array of strings to put in front of output que. | |
333 | ''' |
|
335 | ''' | |
334 |
|
336 | |||
335 | if inputstream: |
|
337 | if inputstream: |
General Comments 0
You need to be logged in to leave comments.
Login now