Exemple #1
0
def _run(app, arguments, version=None):
    tool = find_app(app, version)
    if not tool:
        raise OzyError(f"Unable to find ozy-controlled app '{app}'")
    tool.ensure_installed()
    try:
        # The child process shouldn't get any of our overridden variables; put the original ones back.
        environment = restore_overridden_env_vars(os.environ)
        os.execve(tool.executable, [tool.executable] + list(arguments),
                  environment)
    except Exception as e:
        _LOGGER.error("Unable to execute %s: %s", tool.executable, e)
        raise
Exemple #2
0
def test_restore_original_env_vars_restores_pythonpath():
    orig = dict(PYTHONPATH='new', PYTHONPATH_ORIG='orig')
    assert restore_overridden_env_vars(orig) == dict(PYTHONPATH='orig')
Exemple #3
0
def test_restore_original_env_vars_unsets_pythonpath_and_ld_path_if_not_originally_set():
    orig = dict(PYTHONPATH='new', LD_LIBRARY_PATH='new')
    assert restore_overridden_env_vars(orig) == dict()
Exemple #4
0
def test_restore_original_env_vars_keeps_existing():
    orig = dict(a='a', b='b', c='c')
    assert restore_overridden_env_vars(orig) == orig
Exemple #5
0
def test_restore_original_env_vars_restores_ld_library_path():
    orig = dict(LD_LIBRARY_PATH='new', LD_LIBRARY_PATH_ORIG='orig')
    assert restore_overridden_env_vars(orig) == dict(LD_LIBRARY_PATH='orig')