Refactor function _copy_data().

feature/documentation-builds-html
Isis Lovecruft 2013-04-15 00:42:39 +00:00
parent 0a19ba201c
commit 0b54d68e6a
No known key found for this signature in database
GPG Key ID: A3ADB67A2CDB8B35
1 changed files with 7 additions and 14 deletions

View File

@ -181,20 +181,13 @@ def _threaded_copy_data(instream, outstream):
:param instream: A byte stream to read from. :param instream: A byte stream to read from.
:param file outstream: The file descriptor of a tmpfile to write to. :param file outstream: The file descriptor of a tmpfile to write to.
""" """
result = [] copy_thread = threading.Thread(target=_copy_data,
exts = filter(None, os.environ.get('PATHEXT', '').split(os.pathsep)) args=(instream, outstream))
path = os.environ.get('PATH', None) copy_thread.setDaemon(True)
if path is None: logger.debug('_threaded_copy_data(): %r, %r, %r', copy_thread,
return [] instream, outstream)
for p in os.environ.get('PATH', '').split(os.pathsep): copy_thread.start()
p = os.path.join(p, executable) return copy_thread
if os.access(p, flags):
result.append(p)
for e in exts:
pext = p + e
if os.access(pext, flags):
result.append(pext)
return result
def _write_passphrase(stream, passphrase, encoding): def _write_passphrase(stream, passphrase, encoding):
passphrase = '%s\n' % passphrase passphrase = '%s\n' % passphrase