Beispiel #1
0
def has_dependencies_installed():
    try:
        z3.get_version_string()
    except:
        logging.critical(
            "Z3 is not available. Please install z3 from https://github.com/Z3Prover/z3."
        )
        return False

    if not cmd_exists("evm"):
        logging.critical(
            "Please install evm from go-ethereum and make sure it is in the path."
        )
        return False
    if not evm_cmp_version():
        logging.critical("evm version is incompatible.")
        return False

    if not cmd_exists("solc --version"):
        logging.critical(
            "solc is missing. Please install the solidity compiler and make sure solc is in the path."
        )
        return False

    return True
Beispiel #2
0
def has_dependencies_installed():
    try:
        import z3
        import z3.z3util
        z3_version =  z3.get_version_string()
        tested_z3_version = '4.5.1'
        if compare_versions(z3_version, tested_z3_version) > 0:
            logging.warning("You are using an untested version of z3. %s is the officially tested version" % tested_z3_version)
    except:
        logging.critical("Z3 is not available. Please install z3 from https://github.com/Z3Prover/z3.")
        return False

    if not cmd_exists("evm"):
        logging.critical("Please install evm from go-ethereum and make sure it is in the path.")
        return False
    else:
        cmd = "evm --version"
        out = run_command(cmd).strip()
        evm_version = re.findall(r"evm version (\d*.\d*.\d*)", out)[0]
        tested_evm_version = '1.7.3'
        if compare_versions(evm_version, tested_evm_version) > 0:
            logging.warning("You are using evm version %s. The supported version is %s" % (evm_version, tested_evm_version))

    if not cmd_exists("solc"):
        logging.critical("solc is missing. Please install the solidity compiler and make sure solc is in the path.")
        return False
    else:
        cmd = "solc --version"
        out = run_command(cmd).strip()
        solc_version = re.findall(r"Version: (\d*.\d*.\d*)", out)[0]
        tested_solc_version = '0.4.19'
        if compare_versions(solc_version, tested_solc_version) > 0:
            logging.warning("You are using solc version %s, The latest supported version is %s" % (solc_version, tested_solc_version))

    return True
Beispiel #3
0
def has_dependencies_installed():
    '''
    Returns true if dependencies to Z3, evm, and solc are satisfied, else returns false.
    '''
    try:
        if z3.get_version_string() != '4.6.0':
            logging.warning("You are using z3 version %s. The supported version is 4.6.0." % z3.get_version_string())
    except:
        logging.critical("Z3 is not available. Please install z3 from https://github.com/Z3Prover/z3.")
        return False

    if not cmd_exists("evm"):
        logging.critical("Please install evm from go-ethereum and make sure it is in the path.")
        return False
    else:
        cmd = "evm --version"
        out = run_command(cmd).strip()
        version = re.findall(r"evm version (\d*.\d*.\d*)", out)[0]
        if version != '1.8.3':
            logging.warning("You are using evm version %s. The supported version is 1.8.3." % version)

    if not cmd_exists("solc --version"):
        logging.critical("solc is missing. Please install the solidity compiler and make sure solc is in the path.")
        return False
    else:
        cmd = "solc --version"
        out = run_command(cmd).strip()
        version = re.findall(r"Version: (\d*.\d*.\d*)", out)[0]
        if version != '0.4.21':
            logging.warning("You are using solc version %s. The supported version is 0.4.21." % version)

    return True
Beispiel #4
0
def has_dependencies_installed():
    try:
        import z3
        import z3util
        if z3.get_version_string() != '4.4.1':
            print "Warning: You are using an untested version of z3. 4.4.1 is the officially tested version"
    except:
        print "Error: Z3 is not available. Please install z3 from https://github.com/Z3Prover/z3."
        return False

    if not cmd_exists("evm"):
        print "Please install evm from go-ethereum and make sure it is in the path."
        return False
    else:
        cmd = subprocess.Popen(["evm", "--version"], stdout=subprocess.PIPE)
        cmd_out = cmd.communicate()[0].strip()
        version = re.findall(r"evm version (\d*.\d*.\d*)", cmd_out)[0]
        if version != '1.6.1':
            print "Warning: You are using evm version %s. The supported version is 1.6.1" % version

    if not cmd_exists("solc"):
        print "solc is missing. Please install the solidity compiler and make sure solc is in the path."
        return False
    else:
        cmd = subprocess.Popen(["solc", "--version"], stdout=subprocess.PIPE)
        cmd_out = cmd.communicate()[0].strip()
        version = re.findall(r"Version: (\d*.\d*.\d*)", cmd_out)[0]
        if version != '0.4.10':
            print "Warning: You are using solc version %s, The supported version is 0.4.10" % version

    return True
Beispiel #5
0
def has_dependencies_installed():
    try:
        import z3
        import z3.z3util
        z3_version = z3.get_version_string()

        # Actual tested version is 4.5.1, but only 4.5.0 is available online for download.
        # And in fact the 4.5.0 download when installed actually installs v4.8.0, so we are
        # going to treat 4.8.0 as the tested z3 version to avoid the logger warning...
        tested_z3_version = '4.8.0'
        if compare_versions(z3_version, tested_z3_version) > 0:
            logging.warning(
                "You are using an untested version of z3 (%s). %s is the officially tested version"
                % (z3_version, tested_z3_version))
    except:
        logging.critical(
            "Z3 is not available. Please install z3 from https://github.com/Z3Prover/z3."
        )
        return False

    if not cmd_exists("evm"):
        logging.critical(
            "Please install evm from go-ethereum and make sure it is in the path."
        )
        return False
    else:
        cmd = "evm --version"
        out = run_command(cmd).strip()
        evm_version = re.findall(r"evm version (\d*.\d*.\d*)", out)[0]
        tested_evm_version = '1.7.3'
        if compare_versions(evm_version, tested_evm_version) > 0:
            logging.warning(
                "You are using evm version %s. The supported version is %s" %
                (evm_version, tested_evm_version))

    if not cmd_exists("solc"):
        logging.critical(
            "solc is missing. Please install the solidity compiler and make sure solc is in the path."
        )
        return False
    else:
        cmd = "solc --version"
        out = run_command(cmd).strip()
        solc_version = re.findall(r"Version: (\d*.\d*.\d*)", out)[0]
        tested_solc_version = '0.4.19'
        if compare_versions(solc_version, tested_solc_version) > 0:
            logging.warning(
                "You are using solc version %s, The latest supported version is %s"
                % (solc_version, tested_solc_version))

    return True
Beispiel #6
0
    def show_versions(self):
        self._ui.welcome()

        os_version = system() + " " + release() + " (" + " ".join(
            dist()).strip() + ")"

        python = version_info

        import z3
        z3_version = z3.get_version_string()

        docker_version = check_output(["docker", "--version"]).decode("utf-8")
        compose_version = check_output(["docker-compose",
                                        "--version"]).decode("utf-8")

        self._ui.show_versions(os_version, python, z3_version,
                               docker_version.strip(), compose_version.strip())
Beispiel #7
0
def check_z3():
    """
    Check if Z3 API can be loaded properly
    """
    try:
        import z3
        print('* Z3 version: {}'.format(z3.get_version_string()))
        print("Z3 .. OK")

    except Exception as e:
        from sage.env import SAGE_SRC
        msg = (("Try Adding z3py API to PYTHONPATH\n"
                "E.g. in ~/.bash_profile\n"
                "export SAGE={}\n"
                "export PATH=$SAGE:$PATH\n"
                "export PYTHONPATH=$Z3/src/api/python:$PYTHONPATH"
                ).format(SAGE_SRC))

        raise AssertionError('Cannot import Z3 API.\n{}'.format(msg))
Beispiel #8
0
def has_dependencies_installed():
    try:
        import z3
        import z3.z3util
        if z3.get_version_string() != '4.5.0':
            logging.warning(
                "You are using an untested version of z3. 4.5.0 is the officially tested version"
            )
    except:
        logging.critical(
            "Z3 is not available. Please install z3 from https://github.com/Z3Prover/z3."
        )
        return False

    if not cmd_exists("evm"):
        logging.critical(
            "Please install evm from go-ethereum and make sure it is in the path."
        )
        return False
    else:
        cmd = "evm --version"
        out = run_command(cmd).strip()
        version = re.findall(r"evm version (\d*.\d*.\d*)", out)[0]
        if version != '1.6.6':
            logging.warning(
                "You are using evm version %s. The supported version is 1.6.6"
                % version)

    if not cmd_exists("solc"):
        logging.critical(
            "solc is missing. Please install the solidity compiler and make sure solc is in the path."
        )
        return False
    else:
        cmd = "solc --version"
        out = run_command(cmd).strip()
        version = re.findall(r"Version: (\d*.\d*.\d*)", out)[0]
        if version != '0.4.17':
            logging.warning(
                "You are using solc version %s, The latest supported version is 0.4.17"
                % version)

    return True
def has_dependencies_installed():
    try:
        import z3
        import z3.z3util
        z3_version =  z3.get_version_string()
        tested_z3_version = '4.5.1'
        if compare_versions(z3_version, tested_z3_version) > 0:
            logging.debug("You are using an untested version of z3. %s is the officially tested version" % tested_z3_version)
    except:
        logging.critical("Z3 is not available. Please install z3 from https://github.com/Z3Prover/z3.")
        return False

    if not cmd_exists("evm"):
        logging.critical("Please install evm from go-ethereum and make sure it is in the path.")
        return False
    else:
        cmd = "evm --version"
        out = run_command(cmd).strip()
        global_params.EVM_VERSION = re.findall(r"evm version (\d*.\d*.\d*)", out)[0]
    return True
Beispiel #10
0
def get_z3_version(as_str=False):
    import z3
    print(
        'WARN: deprecated, use z3.get_version() or z3.get_version_string() directly'
    )
    return z3.get_version_string() if as_str else z3.get_version()
Beispiel #11
0
import sys
from setuptools import setup, find_packages


def die(msg):
    print(msg, file=sys.stderr)
    sys.exit(1)


if sys.version_info < (3, 4):
    die("Need Python >= 3.4; found {}".format(sys.version))

try:
    import z3
    if z3.get_version() < (4, 5):
        die("Need Z3 >= 4.5; found {}".format(z3.get_version_string()))
except ImportError:
    die("Z3 Python module was not found")

with open(os.path.join(os.path.dirname(__file__), "requirements.txt")) as f:
    reqs = [line.strip() for line in f]

setup(
    name='Cozy',
    version='2.0a1',
    description='Data Structure Synthesizer',
    author='Calvin Loncaric',
    author_email='*****@*****.**',
    url='https://cozy.uwplse.org/',
    packages=find_packages(),
    entry_points={"console_scripts": "cozy=cozy.main:run"},
Beispiel #12
0
def _print_environment_info():
    print("Using z3 version {}".format(get_version_string()))
    print("Using stormpy version {}".format(stormpy.__version__))