blob: c754dfae543c71e157344319033099dfbe4cdb1d [file] [log] [blame]
Mike Frysingere58c0e22017-10-04 15:43:30 -04001# -*- coding: utf-8 -*-
Chris McDonaldd2fa6162019-07-30 15:30:58 -06002# Copyright 2019 The Chromium OS Authors. All rights reserved.
David Jamesfcb70ef2011-02-02 16:02:30 -08003# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Chris McDonaldd2fa6162019-07-30 15:30:58 -06006"""Thin wrapper to dispatch to old or new parallel_emerge implementation."""
David Jamesfcb70ef2011-02-02 16:02:30 -08007
Mike Frysinger383367e2014-09-16 15:06:17 -04008from __future__ import print_function
9
Chris McDonald16438a82019-10-01 19:01:30 +000010import os
11
Chris McDonaldd2fa6162019-07-30 15:30:58 -060012from chromite.lib import cros_logging
13from chromite.scripts import parallel_emerge_new as NEW_WRAPPER
Thiago Goncalesf4acc422013-07-17 10:26:35 -070014
Chris McDonald16438a82019-10-01 19:01:30 +000015_USE_NEW = os.environ.get('USE_NEW_PARALLEL_EMERGE', '1') == '1'
David Jamesfcb70ef2011-02-02 16:02:30 -080016
Chris McDonaldd2fa6162019-07-30 15:30:58 -060017# parallel_emerge_old.py runs code at import time, so only import it if we
18# intend to use it. This avoids getting a mix of the old and new behaviors.
19if not _USE_NEW:
20 from chromite.scripts import parallel_emerge_old as PARALLEL_EMERGE_OLD
David Jamesfcb70ef2011-02-02 16:02:30 -080021
22
Brian Harring30675052012-02-29 12:18:22 -080023def main(argv):
Chris McDonaldd2fa6162019-07-30 15:30:58 -060024 if _USE_NEW:
Chris McDonaldeb98ee52019-10-14 11:20:58 -060025 cros_logging.notice('Using new parallel_emerge implementation.')
Chris McDonaldd2fa6162019-07-30 15:30:58 -060026 NEW_WRAPPER.main(argv)
27 else:
28 PARALLEL_EMERGE_OLD.main(argv)