blob: e9556fe7814036accaea4def4f242c87a766d0b4 [file] [log] [blame]
#!/usr/bin/python
# Copyright 2015 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Wrapper around the various portage programs.
This enables the portage tools to be relocatable. The wrapper will dynamically
detect the right paths and then execute the portage programs.
"""
from __future__ import print_function
import os
import sys
base_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
portage_path = os.path.join(base_path, 'lib', 'portage')
sys.path.insert(0, os.path.join(portage_path, 'pym'))
os.environ['PYTHONPATH'] = ':'.join(sys.path)
os.environ['EPREFIX'] = '/'
os.execv(os.path.join(portage_path, 'bin', os.path.basename(__file__)), sys.argv)