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: http://src.chromium.org/svn/trunk/src/build@264316 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
bratell@opera.com 2014-04-16 21:52:49 +00:00
Родитель cb300637f0
Коммит 29b227f288
2 изменённых файлов: 13 добавлений и 5 удалений

Просмотреть файл

@ -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)',

Просмотреть файл

@ -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())