Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 21fb7655 authored by Tao Bao's avatar Tao Bao Committed by Gerrit Code Review
Browse files

Merge "releasetools: Set the search path based on the current executable."

parents 7bebcbaf afd92a86
Loading
Loading
Loading
Loading
+15 −14
Original line number Original line Diff line number Diff line
@@ -47,22 +47,23 @@ logger = logging.getLogger(__name__)




class Options(object):
class Options(object):

  def __init__(self):
  def __init__(self):
    base_out_path = os.getenv('OUT_DIR_COMMON_BASE')
    # Set up search path, in order to find framework/ and lib64/. At the time of
    if base_out_path is None:
    # running this function, user-supplied search path (`--path`) hasn't been
      base_search_path = "out"
    # available. So the value set here is the default, which might be overridden
    else:
    # by commandline flag later.
      base_search_path = os.path.join(base_out_path,
    exec_path = sys.argv[0]
                                      os.path.basename(os.getcwd()))
    if exec_path.endswith('.py'):

      script_name = os.path.basename(exec_path)
    # Python >= 3.3 returns 'linux', whereas Python 2.7 gives 'linux2'.
      # logger hasn't been initialized yet at this point. Use print to output
    platform_search_path = {
      # warnings.
        "linux": os.path.join(base_search_path, "host/linux-x86"),
      print(
        "linux2": os.path.join(base_search_path, "host/linux-x86"),
          'Warning: releasetools script should be invoked as hermetic Python '
        "darwin": os.path.join(base_search_path, "host/darwin-x86"),
          'executable -- build and run `{}` directly.'.format(script_name[:-3]),
    }
          file=sys.stderr)
    self.search_path = os.path.realpath(os.path.join(exec_path, '..'))


    self.search_path = platform_search_path.get(sys.platform)
    self.signapk_path = "framework/signapk.jar"  # Relative to search_path
    self.signapk_path = "framework/signapk.jar"  # Relative to search_path
    self.signapk_shared_library_path = "lib64"   # Relative to search_path
    self.signapk_shared_library_path = "lib64"   # Relative to search_path
    self.extra_signapk_args = []
    self.extra_signapk_args = []