Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: third_party/grpc/tools/buildgen/plugins/transitive_dependencies.py

Issue 1932353002: Initial checkin of gRPC to third_party/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2011, Google Inc. 1 # Copyright 2015-2016, Google Inc.
2 # All rights reserved. 2 # All rights reserved.
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
11 # copyright notice, this list of conditions and the following disclaimer 11 # copyright notice, this list of conditions and the following disclaimer
12 # in the documentation and/or other materials provided with the 12 # in the documentation and/or other materials provided with the
13 # distribution. 13 # distribution.
14 # * Neither the name of Google Inc. nor the names of its 14 # * Neither the name of Google Inc. nor the names of its
15 # contributors may be used to endorse or promote products derived from 15 # contributors may be used to endorse or promote products derived from
16 # this software without specific prior written permission. 16 # this software without specific prior written permission.
17 # 17 #
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
30 """Buildgen transitive dependencies
30 31
31 """This file exports public symbols. 32 This takes the list of libs, node_modules, and targets from our
33 yaml dictionary, and adds to each the transitive closure
34 of the list of dependencies.
35
32 """ 36 """
33 37
38 def get_lib(libs, name):
39 try:
40 return next(lib for lib in libs if lib['name']==name)
41 except StopIteration:
42 return None
34 43
35 from mod_pywebsocket._stream_base import BadOperationException 44 def transitive_deps(lib, libs):
36 from mod_pywebsocket._stream_base import ConnectionTerminatedException 45 if lib is not None and 'deps' in lib:
37 from mod_pywebsocket._stream_base import InvalidFrameException 46 # Recursively call transitive_deps on each dependency, and take the union
38 from mod_pywebsocket._stream_base import InvalidUTF8Exception 47 return set.union(set(lib['deps']),
39 from mod_pywebsocket._stream_base import UnsupportedFrameException 48 *[set(transitive_deps(get_lib(libs, dep), libs))
40 from mod_pywebsocket._stream_hixie75 import StreamHixie75 49 for dep in lib['deps']])
41 from mod_pywebsocket._stream_hybi import Frame 50 else:
42 from mod_pywebsocket._stream_hybi import Stream 51 return set()
43 from mod_pywebsocket._stream_hybi import StreamOptions
44 52
45 # These methods are intended to be used by WebSocket client developers to have 53 def mako_plugin(dictionary):
46 # their implementations receive broken data in tests. 54 """The exported plugin code for transitive_dependencies.
47 from mod_pywebsocket._stream_hybi import create_close_frame
48 from mod_pywebsocket._stream_hybi import create_header
49 from mod_pywebsocket._stream_hybi import create_length_header
50 from mod_pywebsocket._stream_hybi import create_ping_frame
51 from mod_pywebsocket._stream_hybi import create_pong_frame
52 from mod_pywebsocket._stream_hybi import create_binary_frame
53 from mod_pywebsocket._stream_hybi import create_text_frame
54 from mod_pywebsocket._stream_hybi import create_closing_handshake_body
55 55
56 Each item in libs, node_modules, and targets can have a deps list.
57 We add a transitive_deps property to each with the transitive closure
58 of those dependency lists.
59 """
60 libs = dictionary.get('libs')
61 node_modules = dictionary.get('node_modules')
62 targets = dictionary.get('targets')
56 63
57 # vi:sts=4 sw=4 et 64 for target_list in (libs, targets, node_modules):
65 for target in target_list:
66 target['transitive_deps'] = transitive_deps(target, libs)
67
68 python_dependencies = dictionary.get('python_dependencies')
69 python_dependencies['transitive_deps'] = (
70 transitive_deps(python_dependencies, libs))
OLDNEW
« no previous file with comments | « third_party/grpc/tools/buildgen/plugins/list_protos.py ('k') | third_party/grpc/tools/codegen/core/gen_header_frame.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698