Commit 2b00e219 authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

IDL compiler: Add a hack to work with pydeps

Fixes pydeps settings and makes web_idl module work without
user-side settings of PYTHONPATH.

This hack workarounds an issue that action_with_pydeps and
print_python_deps.py don't provide a chance to set up
PYTHONPATH.

Bug: 839389
Change-Id: I342e3dbd5b6d23a555e3ee253c362e6a82ff6f60
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1751423Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686409}
parent e73c3238
......@@ -99,22 +99,12 @@ collect_idl_files("web_idl_in_modules") {
output = "${bindings_output_dir}/web_idl_in_modules.pickle"
}
blink_python_runner("web_idl_database") {
action_with_pydeps("web_idl_database") {
script = "${bindings_scripts_dir}/build_web_idl_database.py"
input_data_files = get_target_outputs(":web_idl_in_core") +
get_target_outputs(":web_idl_in_modules")
# List pydeps's content to |pydeps|
pydeps_file = "${bindings_scripts_dir}/build_web_idl_database.pydeps"
pydeps_dir = get_path_info(pydeps_file, "dir")
pydeps_raw = read_file(pydeps_file, "list lines")
set_sources_assignment_filter([ "#*" ])
sources = pydeps_raw
pydeps = sources
sources = []
inputs = input_data_files + rebase_path(pydeps, ".", pydeps_dir)
inputs = input_data_files
output_data_file = "${bindings_output_dir}/web_idl_database.pickle"
outputs = [
output_data_file,
......
......@@ -2,11 +2,36 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os.path
import sys
# Set up |sys.path| so that this module works without user-side setup of
# PYTHONPATH assuming Chromium's directory tree structure.
def _setup_sys_path():
expected_path = 'third_party/blink/renderer/bindings/scripts/web_idl/'
this_dir = os.path.dirname(__file__)
root_dir = os.path.join(this_dir, *(['..'] * expected_path.count('/')))
sys.path = [
# //third_party/ply
os.path.join(root_dir, 'third_party'),
# //tools/idl_parser
os.path.join(root_dir, 'tools'),
# //third_party/blink/renderer/build/scripts/blinkbuild
os.path.join(this_dir, '..', '..', '..', 'build', 'scripts'),
] + sys.path
_setup_sys_path()
from .ast_group import AstGroup
from .composition_parts import Component
from .database import Database
from .database_builder import build_database
__all__ = [
"AstGroup",
"Component",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment