Chromium Code Reviews| Index: Source/bindings/scripts/utilities.py |
| diff --git a/Source/bindings/scripts/utilities.py b/Source/bindings/scripts/utilities.py |
| index 4d80ca7d1b3dc7df5f5e0b01676a68ec943456b6..eeb6d220328478e31752058cd6c77fbda7bfb5a3 100644 |
| --- a/Source/bindings/scripts/utilities.py |
| +++ b/Source/bindings/scripts/utilities.py |
| @@ -31,10 +31,27 @@ def idl_filename_to_component(idl_filename): |
| path = os.path.dirname(os.path.realpath(idl_filename)) |
| while path: |
| dirname, basename = os.path.split(path) |
| + if not basename: |
|
bashi
2014/10/15 05:29:23
Why is this required? As far as I tested,
os.path
tasak
2014/10/15 11:24:18
os.path.split('/') => ('/', '')
A given path is "r
bashi
2014/10/17 02:23:24
Then, "while path:" looks wrong to me... But it's
|
| + break |
| if basename.lower() in KNOWN_COMPONENTS: |
| return basename.lower() |
| path = dirname |
| - raise 'Unknown component type for %s' % idl_filename |
| + raise Exception('Unknown component type for %s' % idl_filename) |
| + |
| + |
| +# See whether "component" can depend on "referred_component" or not: |
| +# Suppose that we have interface X and Y: |
| +# - if X is a partial interface and Y is the original interface, |
| +# use is_valid_component_dependency(X, Y). |
| +# - if X implements Y, use is_valid_component_dependency(X, Y) |
| +# Suppose that X is a cpp file and Y is a header file: |
| +# - if X includes Y, use is_valid_component_dependency(X, Y) |
| +def is_valid_component_dependency(component, referred_component): |
| + assert component in KNOWN_COMPONENTS |
| + assert referred_component in KNOWN_COMPONENTS |
| + if component == 'core' and referred_component == 'modules': |
| + return False |
| + return True |
| ################################################################################ |