| Index: third_party/grpc/tools/buildgen/plugins/transitive_dependencies.py
|
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/stream.py b/third_party/grpc/tools/buildgen/plugins/transitive_dependencies.py
|
| similarity index 52%
|
| copy from third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/stream.py
|
| copy to third_party/grpc/tools/buildgen/plugins/transitive_dependencies.py
|
| index edc5332797497b580e3b7eff2f88d188d7041f13..01e7f61ea9d630c4537cb4201d1f78bd9330f215 100644
|
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/stream.py
|
| +++ b/third_party/grpc/tools/buildgen/plugins/transitive_dependencies.py
|
| @@ -1,4 +1,4 @@
|
| -# Copyright 2011, Google Inc.
|
| +# Copyright 2015-2016, Google Inc.
|
| # All rights reserved.
|
| #
|
| # Redistribution and use in source and binary forms, with or without
|
| @@ -27,31 +27,44 @@
|
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| +"""Buildgen transitive dependencies
|
| +
|
| +This takes the list of libs, node_modules, and targets from our
|
| +yaml dictionary, and adds to each the transitive closure
|
| +of the list of dependencies.
|
|
|
| -"""This file exports public symbols.
|
| """
|
|
|
| +def get_lib(libs, name):
|
| + try:
|
| + return next(lib for lib in libs if lib['name']==name)
|
| + except StopIteration:
|
| + return None
|
| +
|
| +def transitive_deps(lib, libs):
|
| + if lib is not None and 'deps' in lib:
|
| + # Recursively call transitive_deps on each dependency, and take the union
|
| + return set.union(set(lib['deps']),
|
| + *[set(transitive_deps(get_lib(libs, dep), libs))
|
| + for dep in lib['deps']])
|
| + else:
|
| + return set()
|
| +
|
| +def mako_plugin(dictionary):
|
| + """The exported plugin code for transitive_dependencies.
|
| +
|
| + Each item in libs, node_modules, and targets can have a deps list.
|
| + We add a transitive_deps property to each with the transitive closure
|
| + of those dependency lists.
|
| + """
|
| + libs = dictionary.get('libs')
|
| + node_modules = dictionary.get('node_modules')
|
| + targets = dictionary.get('targets')
|
| +
|
| + for target_list in (libs, targets, node_modules):
|
| + for target in target_list:
|
| + target['transitive_deps'] = transitive_deps(target, libs)
|
|
|
| -from mod_pywebsocket._stream_base import BadOperationException
|
| -from mod_pywebsocket._stream_base import ConnectionTerminatedException
|
| -from mod_pywebsocket._stream_base import InvalidFrameException
|
| -from mod_pywebsocket._stream_base import InvalidUTF8Exception
|
| -from mod_pywebsocket._stream_base import UnsupportedFrameException
|
| -from mod_pywebsocket._stream_hixie75 import StreamHixie75
|
| -from mod_pywebsocket._stream_hybi import Frame
|
| -from mod_pywebsocket._stream_hybi import Stream
|
| -from mod_pywebsocket._stream_hybi import StreamOptions
|
| -
|
| -# These methods are intended to be used by WebSocket client developers to have
|
| -# their implementations receive broken data in tests.
|
| -from mod_pywebsocket._stream_hybi import create_close_frame
|
| -from mod_pywebsocket._stream_hybi import create_header
|
| -from mod_pywebsocket._stream_hybi import create_length_header
|
| -from mod_pywebsocket._stream_hybi import create_ping_frame
|
| -from mod_pywebsocket._stream_hybi import create_pong_frame
|
| -from mod_pywebsocket._stream_hybi import create_binary_frame
|
| -from mod_pywebsocket._stream_hybi import create_text_frame
|
| -from mod_pywebsocket._stream_hybi import create_closing_handshake_body
|
| -
|
| -
|
| -# vi:sts=4 sw=4 et
|
| + python_dependencies = dictionary.get('python_dependencies')
|
| + python_dependencies['transitive_deps'] = (
|
| + transitive_deps(python_dependencies, libs))
|
|
|