diff options
author | bratell@opera.com <bratell@opera.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-16 21:52:49 +0000 |
---|---|---|
committer | bratell@opera.com <bratell@opera.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-16 21:52:49 +0000 |
commit | dd0ef2ff9d1c8e8002bd34483186c48aeec67de0 (patch) | |
tree | 64fb390d345ca90cfedffdb85480ee9fc6ecc0b5 | |
parent | f0469511a47aeb119f2d7bf45d49d5eb836333ce (diff) | |
download | chromium_src-dd0ef2ff9d1c8e8002bd34483186c48aeec67de0.zip chromium_src-dd0ef2ff9d1c8e8002bd34483186c48aeec67de0.tar.gz chromium_src-dd0ef2ff9d1c8e8002bd34483186c48aeec67de0.tar.bz2 |
gyp performance: don't invoke python to check dir existance
We spend a few tenths of a second every gyp invocation starting
the dir_exists.py program. Seems a bit unnecessary.
BUG=362075
R=scottmg@chromium.org
Review URL: https://codereview.chromium.org/234963003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264316 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | build/common.gypi | 8 | ||||
-rwxr-xr-x | build/dir_exists.py | 10 | ||||
-rw-r--r-- | content/content.gyp | 2 |
3 files changed, 14 insertions, 6 deletions
diff --git a/build/common.gypi b/build/common.gypi index e64e436..f3f3e94 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -1316,8 +1316,8 @@ # Contains data about the attached devices for gyp_managed_install. 'build_device_config_path': '<(PRODUCT_DIR)/build_devices.cfg', - 'sas_dll_exists': '<!(python <(DEPTH)/build/dir_exists.py "<(sas_dll_path)")', - 'wix_exists': '<!(python <(DEPTH)/build/dir_exists.py "<(wix_path)")', + 'sas_dll_exists': '<!pymod_do_main(dir_exists "<(sas_dll_path)")', + 'wix_exists': '<!pymod_do_main(dir_exists "<(wix_path)")', 'windows_sdk_default_path': '<(DEPTH)/third_party/platformsdk_win8/files', 'directx_sdk_default_path': '<(DEPTH)/third_party/directxsdk/files', @@ -1419,12 +1419,12 @@ }, { 'gcc_version%': 0, }], - ['OS=="win" and "<!(python <(DEPTH)/build/dir_exists.py <(windows_sdk_default_path))"=="True"', { + ['OS=="win" and "<!pymod_do_main(dir_exists <(windows_sdk_default_path))"=="True"', { 'windows_sdk_path%': '<(windows_sdk_default_path)', }, { 'windows_sdk_path%': 'C:/Program Files (x86)/Windows Kits/8.0', }], - ['OS=="win" and "<!(python <(DEPTH)/build/dir_exists.py <(directx_sdk_default_path))"=="True"', { + ['OS=="win" and "<!pymod_do_main(dir_exists <(directx_sdk_default_path))"=="True"', { 'directx_sdk_path%': '<(directx_sdk_default_path)', }, { 'directx_sdk_path%': '$(DXSDK_DIR)', diff --git a/build/dir_exists.py b/build/dir_exists.py index 0a89bc8..70d367e 100755 --- a/build/dir_exists.py +++ b/build/dir_exists.py @@ -8,8 +8,16 @@ import os.path import sys def main(): - sys.stdout.write(str(os.path.isdir(sys.argv[1]))) + sys.stdout.write(_is_dir(sys.argv[1])) return 0 +def _is_dir(dir_name): + return str(os.path.isdir(dir_name)) + +def DoMain(args): + """Hook to be called from gyp without starting a separate python + interpreter.""" + return _is_dir(args[0]) + if __name__ == '__main__': sys.exit(main()) diff --git a/content/content.gyp b/content/content.gyp index d4cacf7..5cc8747 100644 --- a/content/content.gyp +++ b/content/content.gyp @@ -6,7 +6,7 @@ 'variables': { 'chromium_code': 1, # Use higher warning level. 'chromium_enable_vtune_jit_for_v8%': 0, # enable the vtune support for V8 engine. - 'directxsdk_exists': '<!(python <(DEPTH)/build/dir_exists.py ../third_party/directxsdk)', + 'directxsdk_exists': '<!pymod_do_main(dir_exists ../third_party/directxsdk)', }, 'target_defaults': { 'defines': ['CONTENT_IMPLEMENTATION'], |