Home | History | Annotate | Download | only in firmware_TouchMTB
      1 # Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 """This module provides access to autotest_lib.client.common_lib.cros namespace,
      6 and fixes the environment variable for shared libraries (DLL).
      7 """
      8 
      9 import os, sys
     10 
     11 cwd = os.path.dirname(sys.modules[__name__].__file__)
     12 client_dir = os.path.abspath(os.path.join(cwd, '../../common_lib/cros'))
     13 sys.path.insert(0, client_dir)
     14 
     15 DLL_PATH_ENV_NAME = 'LD_LIBRARY_PATH'
     16 DLL_PATH = '/usr/local/lib:/usr/local/lib64'
     17 if not os.environ.get(DLL_PATH_ENV_NAME):
     18     print 'Set up %s!' % DLL_PATH_ENV_NAME
     19     os.environ[DLL_PATH_ENV_NAME] = DLL_PATH
     20     try:
     21         # Note: It is required to restart the process since the linker/loader
     22         #       has kept a copy of the environment in its cache.
     23         print 'Restarting "%s"....' % sys.argv[0]
     24         os.execv(sys.argv[0], sys.argv)
     25     except Exception as e:
     26         print 'Error: Failed to restart %s' % sys.argv[0], e
     27         sys.exit(1)
     28