1"""Module to translate the xbuddy config.""" 2 3from __future__ import print_function 4 5import os 6import sys 7 8if '/mnt/host/source/src/third_party/toolchain-utils/crosperf' in sys.path: 9 dev_path = os.path.expanduser('~/trunk/src/platform/dev') 10 sys.path.append(dev_path) 11else: 12 print('This script can only be run from inside a ChromeOS chroot. Please ' 13 'enter your chroot, go to ~/src/third_party/toolchain-utils/crosperf' 14 ' and try again.') 15 sys.exit(0) 16 17#pylint: disable=import-error 18import xbuddy 19 20 21def Main(xbuddy_string): 22 if not os.path.exists('./xbuddy_config.ini'): 23 config_path = os.path.expanduser('~/trunk/src/platform/dev/' 24 'xbuddy_config.ini') 25 os.symlink(config_path, './xbuddy_config.ini') 26 x = xbuddy.XBuddy(manage_builds=False, static_dir='/tmp/devserver/static') 27 build_id = x.Translate(os.path.split(xbuddy_string)) 28 return build_id 29 30 31if __name__ == '__main__': 32 print(Main(sys.argv[1])) 33 sys.exit(0) 34