Exemple #1
0
def is_version_compatible(version: str) -> bool:
    """
    Helper function to check for version compatibility

    @:param version  Domino version to check version compatibility against
    @:return bool   Boolean representing if version is compatible or not
    """
    return parse_version(version) >= parse_version(MINIMUM_SUPPORTED_DOMINO_VERSION)
Exemple #2
0
def _version_check(package, version, minimum):
    if parse_version(version) < parse_version(minimum):
        colour = YELLOW
        expected = f" (expected: {minimum} or higher)"
    else:
        colour = GREEN
        expected = ""
    print(f"{package:10s}: {colour}{version}{NC}{expected}")
    return colour == GREEN
Exemple #3
0
def _tty_supports_color():
    if sys.platform != "win32":
        return True

    if parse_version(platform.version()) < parse_version("10.0.14393"):
        return True

    # Windows >= 10.0.14393 interprets ANSI escape sequences providing terminal
    # processing is enabled.
    return _enable_windows_terminal_processing()
Exemple #4
0
    try:
        ver = subprocess.check_output(
            ["git", "describe", "--tags", "--always"], encoding="utf-8")
    except OSError:
        print("Couldn't run git to get a version number for setup.py")
        return
    return ver.strip()


version = _get_version_hash()

if version[:1] == "v":
    version = version[1:]

jsbsim_version = ""
if parse_version(version) > parse_version("0.5.0"):
    jsbsim_version = "1.1.0"

print("Building wheels {}-{}".format(version, jsbsim_version))

cwd = os.path.dirname(os.path.abspath(__file__))


def write_version_file():
    with open(os.path.join(cwd, "gym_jsbsim", "version.py"), "w") as file:
        file.write("__version__ = '{}'\n".format(version))
        file.write("__jsbsim_version__ = '{}'\n".format(jsbsim_version))


# download a/c data
to_path = "gym_jsbsim/"
Exemple #5
0
def main():
    changes_required = False
    fix_things = "install" in sys.argv
    if sys.version_info[0] == 3:
        python = py.path.local(sys.executable)
        conda = conda_path()
        print("Conda:", conda)
        if not conda:
            print(RED + "No or incomplete conda environment." + NC)
            print("Make sure your conda environment contains conda itself.")
            sys.exit("libtbx.precommit unavailable")
        conda_values = conda_info(conda)
        if not conda_values:
            sys.exit(
                "Can not obtain information from this conda installation. libtbx.precommit unavailable"
            )
        conda_python = py.path.local(conda_values["sys.executable"]).realpath()
        print("Conda python: ", end="")
        if conda_python != python.realpath():
            # Not convinced this is actually a problem. This indicates such a
            # broken environment I don't think we should even check for it.
            print(YELLOW + conda_python.strpath)
            print("    different from running python:", python + NC)
        else:
            print(conda_python.strpath)
        print("Conda version:", GREEN + conda_values["conda_version"] + NC)
        py_ver = "%s.%s.%s" % (
            sys.version_info.major,
            sys.version_info.minor,
            sys.version_info.micro,
        )
        print("Base Python:",
              (GREEN if sys.version_info.minor >= 6 else NC) + py_ver + NC)
        try:
            import pre_commit.constants
        except ImportError:
            if "install" in sys.argv:
                print("Installing precommit...")
                install_precommit_into_conda(conda)
                import pre_commit.constants

                print("Precommit: " + GREEN + pre_commit.constants.VERSION +
                      NC)
            else:
                print("Precommit: " + RED + "<not installed>" + NC)
                changes_required = True
        else:
            print("Precommit: " + GREEN + pre_commit.constants.VERSION + NC)
    else:
        python = install_python(check_only=True)
        if python:
            py_ver = python_version(python)
        else:
            py_ver = False
        if py_ver != python_source_version and fix_things:
            python = install_python()
            py_ver = python_version(python)
        if py_ver == python_source_version:
            py_ver = GREEN + py_ver + NC
        elif py_ver:
            py_ver = YELLOW + py_ver + NC + " (expected: " + python_source_version + ")"
            changes_required = True
        else:
            py_ver = RED + "not installed" + NC
            changes_required = True
        if python:
            pc_ver = precommit_version(python)
            if pc_ver != precommitbx_version and fix_things:
                install_precommit(python)
                pc_ver = precommit_version(python)
            if pc_ver == precommitbx_version:
                pc_ver = GREEN + pc_ver + NC
            elif pc_ver:
                pc_ver = (YELLOW + pc_ver + NC + " (expected: " +
                          precommitbx_version + ")")
                changes_required = True
            else:
                pc_ver = RED + "not installed" + NC
                changes_required = True
            pcp_ver = precommit_package_version(python)
            if not pcp_ver:
                pc_ver = RED + "not installed" + NC
                changes_required = True
            elif parse_version(pcp_ver) < parse_version(
                    precommit_package_min_version):
                pcp_ver = (YELLOW + pcp_ver + NC + " (expected minimum: " +
                           precommit_package_min_version + ")")
                changes_required = True
            else:
                pcp_ver = GREEN + pcp_ver + NC
            print("Precommit Package:", pcp_ver)
            print("Precommit Python:", py_ver)
            print("Precommitbx:", pc_ver)

    print()
    print("Repositories:")
    repositories = list_all_repository_candidates()
    if "install" in sys.argv:
        paths = sys.argv[1:]
        paths.remove("install")
        for path in paths:
            path = py.path.local(".").join(path, abs=1)
            if path.basename in repositories:
                base = path.strpath
            else:
                base = path.basename
            repositories[base] = path
    for module in sorted(repositories):
        if not repositories[module].join(".pre-commit-config.yaml").check():
            print(repo_prefix.format(module), repo_no_precommit)
            continue
        message = (check_precommitbx_hook(repositories[module], python)
                   or repo_precommit_available)
        if message != repo_precommit_installed and fix_things:
            install_precommitbx_hook(repositories[module], python)
            message = (check_precommitbx_hook(repositories[module], python)
                       or repo_precommit_available)
        print(repo_prefix.format(module), message)
        if message != repo_precommit_installed:
            changes_required = True

    if changes_required:
        print()
        sys.exit("To install pre-commit hooks run " + BOLD +
                 "libtbx.precommit install" + NC)
Exemple #6
0
def main():
    changes_required = False
    python = install_python(check_only=True)
    fix_things = "install" in sys.argv
    if python:
        py_ver = python_version(python)
    else:
        py_ver = False
    if py_ver != python_source_version and fix_things:
        python = install_python()
        py_ver = python_version(python)
    if py_ver == python_source_version:
        py_ver = GREEN + py_ver + NC
    elif py_ver:
        py_ver = YELLOW + py_ver + NC + " (expected: " + python_source_version + ")"
        changes_required = True
    else:
        py_ver = RED + "not installed" + NC
        changes_required = True
    if python:
        pc_ver = precommit_version(python)
        if pc_ver != precommitbx_version and fix_things:
            install_precommit(python)
            pc_ver = precommit_version(python)
        if pc_ver == precommitbx_version:
            pc_ver = GREEN + pc_ver + NC
        elif pc_ver:
            pc_ver = YELLOW + pc_ver + NC + " (expected: " + precommitbx_version + ")"
            changes_required = True
        else:
            pc_ver = RED + "not installed" + NC
            changes_required = True
        pcp_ver = precommit_package_version(python)
        if not pcp_ver:
            pc_ver = RED + "not installed" + NC
            changes_required = True
        elif parse_version(pcp_ver) < parse_version(
                precommit_package_min_version):
            pcp_ver = (YELLOW + pcp_ver + NC + " (expected minimum: " +
                       precommit_package_min_version + ")")
            changes_required = True
        else:
            pcp_ver = GREEN + pcp_ver + NC
        print("Precommit Package:", pcp_ver)
        print("Precommit Python:", py_ver)
        print("Precommitbx:", pc_ver)

    print()
    print("Repositories:")
    repositories = list_all_repository_candidates()
    if "install" in sys.argv:
        paths = sys.argv[1:]
        paths.remove("install")
        for path in paths:
            path = py.path.local(".").join(path, abs=1)
            if path.basename in repositories:
                base = path.strpath
            else:
                base = path.basename
            repositories[base] = path
    for module in sorted(repositories):
        if not repositories[module].join(".pre-commit-config.yaml").check():
            print(repo_prefix.format(module), repo_no_precommit)
            continue
        message = (check_precommitbx_hook(repositories[module], python)
                   or repo_precommit_available)
        if message != repo_precommit_installed and fix_things:
            install_precommitbx_hook(repositories[module], python)
            message = (check_precommitbx_hook(repositories[module], python)
                       or repo_precommit_available)
        print(repo_prefix.format(module), message)
        if message != repo_precommit_installed:
            changes_required = True

    if changes_required:
        print()
        sys.exit("To install pre-commit hooks run " + BOLD +
                 "libtbx.precommit install" + NC)
Exemple #7
0
def is_on_demand_spark_cluster_supported(version: str) -> bool:
    return parse_version(version) >= parse_version(
        MINIMUM_ON_DEMAND_SPARK_CLUSTER_SUPPORT_DOMINO_VERSION)