Exemple #1
0
 def _geth_binary(self) -> str:
     if "GETH_BINARY" in os.environ:
         return os.environ["GETH_BINARY"]
     elif "GETH_VERSION" in os.environ:
         geth_version = os.environ["GETH_VERSION"]
         _geth_binary = get_executable_path(geth_version)
         if not os.path.exists(_geth_binary):
             install_geth(geth_version)
         assert os.path.exists(_geth_binary)
         return _geth_binary
     else:
         return "geth"
Exemple #2
0
def get_geth_binary():
    from geth.install import (
        get_executable_path,
        install_geth,
    )

    if 'GETH_BINARY' in os.environ:
        return os.environ['GETH_BINARY']
    elif 'GETH_VERSION' in os.environ:
        geth_version = os.environ['GETH_VERSION']
        _geth_binary = get_executable_path(geth_version)
        if not os.path.exists(_geth_binary):
            install_geth(geth_version)
        assert os.path.exists(_geth_binary)
        return _geth_binary
    else:
        return 'geth'
Exemple #3
0
def geth_binary():
    from geth.install import (
        get_executable_path,
        install_geth,
    )

    if 'GETH_BINARY' in os.environ:
        return os.environ['GETH_BINARY']
    elif 'GETH_VERSION' in os.environ:
        geth_version = os.environ['GETH_VERSION']
        _geth_binary = get_executable_path(geth_version)
        if not os.path.exists(_geth_binary):
            install_geth(geth_version)
        assert os.path.exists(_geth_binary)
        return _geth_binary
    else:
        return 'geth'
def test_geth_installation_as_function_call(monkeypatch, tmpdir, platform, version):
    if get_platform() != platform:
        pytest.skip("Wront platform for install script")

    base_install_path = str(tmpdir.mkdir("temporary-dir"))
    monkeypatch.setenv('GETH_BASE_INSTALL_PATH', base_install_path)

    # sanity check that it's not already installed.
    executable_path = get_executable_path(version)
    assert not os.path.exists(executable_path)

    install_geth(identifier=version, platform=platform)

    assert os.path.exists(executable_path)
    monkeypatch.setenv('GETH_BINARY', executable_path)

    actual_version = get_geth_version()
    expected_version = semantic_version.Spec(version.lstrip('v'))

    assert actual_version in expected_version