Пример #1
0
    def compile(self):
        # Override default Python library, include, and interpreter
        # path into Boolector's CMake because CMake can get confused
        # if multiple interpreters are available, especially python 2
        # vs python 3.
        import distutils.sysconfig as sysconfig
        import sys
        PYTHON_LIBRARY = os.environ.get('PYSMT_PYTHON_LIBDIR')
        if not PYTHON_LIBRARY:
            PYTHON_LIBRARY = sysconfig.get_config_var('LIBDIR')
        PYTHON_INCLUDE_DIR = sysconfig.get_python_inc()
        PYTHON_EXECUTABLE = sys.executable
        CMAKE_OPTS = ' -DPYTHON_LIBRARY=' + PYTHON_LIBRARY
        CMAKE_OPTS += ' -DPYTHON_INCLUDE_DIR=' + PYTHON_INCLUDE_DIR
        CMAKE_OPTS += ' -DPYTHON_EXECUTABLE=' + PYTHON_EXECUTABLE

        # Unpack
        SolverInstaller.untar(os.path.join(self.base_dir, self.archive_name),
                              self.extract_path)

        # Build lingeling
        SolverInstaller.run("bash ./contrib/setup-lingeling.sh",
                            directory=self.extract_path)

        # Build Btor
        SolverInstaller.run("bash ./contrib/setup-btor2tools.sh",
                            directory=self.extract_path)

        # Build Boolector Solver
        SolverInstaller.run("bash ./configure.sh --python",
                            directory=self.extract_path,
                            env_variables={"CMAKE_OPTS": CMAKE_OPTS})

        SolverInstaller.run("make -j2",
                            directory=os.path.join(self.extract_path, "build"))
Пример #2
0
    def __init__(self, install_dir, bindings_dir, solver_version,
                 mirror_link=None):

        # Getting the right archive name
        os_name = self.os_name
        arch = self.architecture
        ext = "tar.gz"
        if os_name == "windows":
            ext = "zip"
            arch = "msvc"
            if self.architecture == "x86_64":
                os_name = "win64"
            else:
                os_name = "win32"
        elif os_name == "darwin":
            os_name = "darwin-libcxx"

        archive_name = "mathsat-%s-%s-%s.%s" % (solver_version, os_name,
                                                arch, ext)

        native_link = "http://mathsat.fbk.eu/download.php?file={archive_name}"

        SolverInstaller.__init__(self, install_dir=install_dir,
                                 bindings_dir=bindings_dir,
                                 solver_version=solver_version,
                                 archive_name=archive_name,
                                 native_link = native_link,
                                 mirror_link=mirror_link)

        self.python_bindings_dir = os.path.join(self.extract_path, "python")
Пример #3
0
    def compile(self):
        # Select the correct Makefile to be used
        makefile = "Makefile"
        if self.architecture == "x86_64":
            makefile = "Makefile_64bit"

        # Find python-config
        command = self.find_python_config()
        if command is None:
            raise OSError(
                "No installation of python-config found on this system."
                " Please install python-config for this version of python.")
        print("Found python-confing in %s" % command)

        # Build the pycudd
        prefix = None
        p = subprocess.Popen([command, '--includes'],
                             stdout=subprocess.PIPE,
                             stderr=None)
        prefix = p.stdout.read()
        if PY2:
            pass  # Prefix is already a string
        else:
            # > PY3 Prefix is binary data
            prefix = prefix.decode()

        if not prefix or len(prefix) == 0:
            prefix = "/usr"

        SolverInstaller.run("make -C %s -f %s PYTHON_INCL=%s" %
                            (self.extract_path, makefile, prefix))
Пример #4
0
    def __init__(self,
                 install_dir,
                 bindings_dir,
                 solver_version,
                 mirror_link=None,
                 osx=None,
                 git_version=None):
        arch = self.architecture
        if arch == "x86_64":
            arch = "x64"

        system = self.os_name
        if system == "linux":
            system = "ubuntu-14.04"
        elif system == "darwin":
            system = "osx-%s" % osx
        elif system == "windows":
            system = "win"

        # Stable versions template
        # archive_name = "z3-%s-%s-%s.zip" % (solver_version, arch, system)
        #
        # Nightly build template
        archive_name = "z3-%s.%s-%s-%s.zip" % (solver_version, git_version,
                                               arch, system)
        native_link = "https://github.com/pysmt/Z3bin/blob/master/nightly/{archive_name}?raw=true"

        SolverInstaller.__init__(self,
                                 install_dir=install_dir,
                                 bindings_dir=bindings_dir,
                                 solver_version=solver_version,
                                 archive_name=archive_name,
                                 native_link=native_link,
                                 mirror_link=mirror_link)
Пример #5
0
Файл: z3.py Проект: pysmt/pysmt
    def __init__(self, install_dir, bindings_dir, solver_version,
                 mirror_link=None, osx=None, git_version=None, commit=None):
        arch = self.architecture
        if arch == "x86_64":
            arch = "x64"

        system = self.os_name
        if system == "linux":
            system = "ubuntu-14.04"
        elif system == "darwin":
            system = "osx-%s" % osx
        elif system == "windows":
            system = "win"

        if git_version is None:
            # Stable versions template
            archive_name = "z3-%s.%s-%s-%s.zip" % (solver_version, commit, arch, system)
            native_link = "https://github.com/Z3Prover/z3/releases/download/z3-" + solver_version + "/{archive_name}"
            # print(native_link)
        else:
            # Nightly build template
            archive_name = "z3-%s.%s-%s-%s.zip" % (solver_version, git_version, arch, system)
            native_link = "https://github.com/pysmt/Z3bin/blob/master/nightly/{archive_name}?raw=true"

        SolverInstaller.__init__(self, install_dir=install_dir,
                                 bindings_dir=bindings_dir,
                                 solver_version=solver_version,
                                 archive_name=archive_name,
                                 native_link=native_link,
                                 mirror_link=mirror_link)
Пример #6
0
    def compile(self):
        # Unpack
        SolverInstaller.untar(os.path.join(self.base_dir, self.archive_name),
                              self.extract_path)

        # Build lingeling
        SolverInstaller.run("bash ./contrib/setup-lingeling.sh",
                            directory=self.extract_path)

        # Build Btor
        SolverInstaller.run("bash ./contrib/setup-btor2tools.sh",
                            directory=self.extract_path)

        # Inject Python library and include paths into CMake because Boolector
        # search system can be fooled in some systems
        import distutils.sysconfig as sysconfig
        PYTHON_LIBRARY = sysconfig.get_config_var('LIBDIR')
        PYTHON_INCLUDE_DIR = sysconfig.get_python_inc()
        CMAKE_OPTS = ' -DPYTHON_LIBRARY=' + PYTHON_LIBRARY
        CMAKE_OPTS += ' -DPYTHON_INCLUDE_DIR=' + PYTHON_INCLUDE_DIR

        # Build Boolector Solver
        SolverInstaller.run("bash ./configure.sh --python",
                            directory=self.extract_path,
                            env_variables={"CMAKE_OPTS": CMAKE_OPTS})

        SolverInstaller.run("make -j2",
                            directory=os.path.join(self.extract_path, "build"))
Пример #7
0
    def __init__(self,
                 install_dir,
                 bindings_dir,
                 solver_version,
                 mirror_link=None):

        # Getting the right archive name
        os_name = self.os_name
        arch = self.architecture
        ext = "tar.gz"
        if os_name == "windows":
            ext = "zip"
            arch = "msvc"
            if self.architecture == "x86_64":
                os_name = "win64"
            else:
                os_name = "win32"
        elif os_name == "darwin":
            os_name = "darwin-libcxx"

        archive_name = "mathsat-%s-%s-%s.%s" % (solver_version, os_name, arch,
                                                ext)

        native_link = "http://mathsat.fbk.eu/download.php?file={archive_name}"

        SolverInstaller.__init__(self,
                                 install_dir=install_dir,
                                 bindings_dir=bindings_dir,
                                 solver_version=solver_version,
                                 archive_name=archive_name,
                                 native_link=native_link,
                                 mirror_link=mirror_link)

        self.python_bindings_dir = os.path.join(self.extract_path, "python")
Пример #8
0
    def __init__(self,
                 install_dir,
                 bindings_dir,
                 solver_version,
                 mirror_link=None,
                 yicespy_version='HEAD'):

        self.needs_compilation = False
        if self.os_name == "darwin" or self.needs_compilation:
            sysctl = self.run("sysctl -a",
                              get_output=True,
                              suppress_stderr=True)
            if 'hw.optional.avx2_0: 1' in sysctl:
                # No need to compile, see http://yices.csl.sri.com/faq.html
                pack = "x86_64-apple-darwin16.7.0-static-gmp"
            else:
                self.needs_compilation = True
                pack = "src"
        else:
            pack = "x86_64-pc-linux-gnu-static-gmp"

        archive_name = "yices-%s-%s.tar.gz" % (solver_version, pack)
        native_link = "http://yices.csl.sri.com/releases/{solver_version}/{archive_name}"
        SolverInstaller.__init__(self,
                                 install_dir=install_dir,
                                 bindings_dir=bindings_dir,
                                 solver_version=solver_version,
                                 archive_name=archive_name,
                                 native_link=native_link,
                                 mirror_link=mirror_link)

        self.extract_path = os.path.join(self.base_dir,
                                         "yices-%s" % self.solver_version)
        self.yices_path = os.path.join(self.bindings_dir, "yices_bin")
        self.yicespy_git_version = yicespy_version
Пример #9
0
    def compile(self):
        # Select the correct Makefile to be used
        makefile = "Makefile"
        if self.architecture == "x86_64":
            makefile = "Makefile_64bit"

        # Find python-config
        command = self.find_python_config()
        if command is None:
            raise OSError("No installation of python-config found on this system."
                          " Please install python-config for this version of python.")
        print("Found python-config in %s" % command)

        # Build the pycudd
        prefix = None
        p = subprocess.Popen([command, '--includes'], stdout=subprocess.PIPE, stderr=None)
        prefix = p.stdout.read()
        if PY2:
            pass # Prefix is already a string
        else:
            # > PY3 Prefix is binary data
            prefix = prefix.decode()

        if not prefix or len(prefix) == 0:
            prefix = "/usr"

        SolverInstaller.run("make -C %s -f %s PYTHON_INCL=%s" %
                            (self.extract_path, makefile, prefix))
Пример #10
0
 def move(self):
     SolverInstaller.mv(
         os.path.join(self.bin_path, "share/pyshared/CVC4.py"),
         self.bindings_dir)
     SolverInstaller.mv(
         os.path.join(self.bin_path, "lib/pyshared/_CVC4.so"),
         self.bindings_dir)
Пример #11
0
    def __init__(self, install_dir, bindings_dir, solver_version,
                 mirror_link=None, yicespy_version='HEAD'):

        self.needs_compilation = False
        if self.os_name == "darwin" or self.needs_compilation:
            sysctl = self.run("sysctl -a", get_output=True, suppress_stderr=True)
            if 'hw.optional.avx2_0: 1' in sysctl:
                # No need to compile, see http://yices.csl.sri.com/faq.html
                pack = "x86_64-apple-darwin16.7.0-static-gmp"
            else:
                self.needs_compilation = True
                pack = "src"
        else:
            pack = "x86_64-pc-linux-gnu-static-gmp"

        archive_name = "yices-%s-%s.tar.gz" % (solver_version, pack)
        native_link = "http://yices.csl.sri.com/releases/{solver_version}/{archive_name}"
        SolverInstaller.__init__(self, install_dir=install_dir,
                                 bindings_dir=bindings_dir,
                                 solver_version=solver_version,
                                 archive_name=archive_name,
                                 native_link=native_link,
                                 mirror_link=mirror_link)

        self.extract_path = os.path.join(self.base_dir, "yices-%s" % self.solver_version)
        self.yices_path = os.path.join(self.bindings_dir, "yices_bin")
        self.yicespy_git_version = yicespy_version
Пример #12
0
    def __init__(self,
                 install_dir,
                 bindings_dir,
                 solver_version,
                 mirror_link=None,
                 osx=None):
        arch = self.architecture
        if arch == "x86_64":
            arch = "x64"

        system = self.os_name
        if system == "linux":
            system = "ubuntu-14.04"
        elif system == "darwin":
            system = "osx-%s" % osx

        archive_name = "z3-%s-%s-%s.zip" % (solver_version, arch, system)
        native_link = "https://github.com/Z3Prover/z3/releases/download/z3-4.4.1/{archive_name}"

        SolverInstaller.__init__(self,
                                 install_dir=install_dir,
                                 bindings_dir=bindings_dir,
                                 solver_version=solver_version,
                                 archive_name=archive_name,
                                 native_link=native_link,
                                 mirror_link=mirror_link)
Пример #13
0
    def compile(self):
        # Prepare an empty folder for installing yices
        SolverInstaller.clean_dir(self.yices_path)

        SolverInstaller.run("bash ./install-yices %s" % self.yices_path,
                            directory=self.extract_path)

        self.install_yicespy()
Пример #14
0
    def compile(self):
        # Prepare an empty folder for installing yices
        SolverInstaller.clean_dir(self.yices_path)

        SolverInstaller.run("bash ./install-yices %s" % self.yices_path,
                            directory=self.extract_path)

        self.install_yicespy()
Пример #15
0
 def __init__(self, install_dir, bindings_dir, solver_version, mirror_link=None):
     SolverInstaller.__init__(
         self,
         install_dir=install_dir,
         bindings_dir=bindings_dir,
         solver_version=solver_version,
         mirror_link=mirror_link,
     )
Пример #16
0
Файл: bdd.py Проект: pysmt/pysmt
    def compile(self):
        # Select the correct Makefile to be used
        makefile = "Makefile"
        if self.architecture == "x86_64":
            makefile = "Makefile_64bit"

        import distutils.sysconfig as sysconfig
        PYTHON_INCLUDE_DIR = sysconfig.get_python_inc()
        SolverInstaller.run("make -C %s -f %s PYTHON_INCL=-I%s" %
                            (self.extract_path, makefile, PYTHON_INCLUDE_DIR))
Пример #17
0
    def move(self):
        libdir = "lib.%s-%s-%s" % (self.os_name, self.architecture,
                                   self.python_version)
        bdir = os.path.join(self.extract_path, "build")
        sodir = os.path.join(bdir, libdir)

        for f in os.listdir(sodir):
            if f.endswith(".so"):
                SolverInstaller.mv(os.path.join(sodir, f), self.bindings_dir)
        SolverInstaller.mv(os.path.join(self.extract_path, "picosat.py"), self.bindings_dir)
Пример #18
0
 def __init__(self, install_dir, bindings_dir, solver_version,
              pypicosat_minor_version, mirror_link=None):
     self.pypicosat_minor_version = pypicosat_minor_version
     self.complete_version = None
     SolverInstaller.__init__(self, install_dir=install_dir,
                              bindings_dir=bindings_dir,
                              solver_version=solver_version,
                              mirror_link=mirror_link,
                              native_link=None,
                              archive_name=None)
Пример #19
0
 def __init__(self, install_dir, bindings_dir, solver_version,
              mirror_link=None):
     archive_name = "boolector-%s-with-lingeling-b85.tar.bz2" % solver_version
     native_link = "http://fmv.jku.at/boolector/{archive_name}"
     SolverInstaller.__init__(self, install_dir=install_dir,
                              bindings_dir=bindings_dir,
                              solver_version=solver_version,
                              archive_name=archive_name,
                              native_link=native_link,
                              mirror_link=mirror_link)
Пример #20
0
    def compile(self):
        # Select the correct Makefile to be used
        makefile = "Makefile"
        if self.architecture == "x86_64":
            makefile = "Makefile_64bit"

        import distutils.sysconfig as sysconfig
        PYTHON_INCLUDE_DIR = sysconfig.get_python_inc()
        SolverInstaller.run("make -C %s -f %s PYTHON_INCL=-I%s" %
                            (self.extract_path, makefile, PYTHON_INCLUDE_DIR))
Пример #21
0
    def move(self):
        libdir = "lib.%s-%s-%s" % (self.os_name, self.architecture,
                                   self.python_version)
        bdir = os.path.join(self.extract_path, "build")
        sodir = os.path.join(bdir, libdir)

        for f in os.listdir(sodir):
            if f.endswith(".so"):
                SolverInstaller.mv(os.path.join(sodir, f), self.bindings_dir)
        SolverInstaller.mv(os.path.join(self.extract_path, "picosat.py"), self.bindings_dir)
Пример #22
0
 def __init__(self, install_dir, bindings_dir, solver_version,
              mirror_link=None, git_version='HEAD'):
     archive_name = "repycudd-%s.tar.gz" % git_version
     native_link = "https://codeload.github.com/pysmt/repycudd/tar.gz/%s" % git_version
     SolverInstaller.__init__(self, install_dir=install_dir,
                              bindings_dir=bindings_dir,
                              solver_version=solver_version,
                              archive_name=archive_name,
                              native_link=native_link,
                              mirror_link=mirror_link)
     self.git_version = git_version
Пример #23
0
 def __init__(self, install_dir, bindings_dir, solver_version,
              mirror_link=None, git_version='HEAD'):
     archive_name = "repycudd-%s.tar.gz" % git_version
     native_link = "https://codeload.github.com/pysmt/repycudd/tar.gz/%s" % git_version
     SolverInstaller.__init__(self, install_dir=install_dir,
                              bindings_dir=bindings_dir,
                              solver_version=solver_version,
                              archive_name=archive_name,
                              native_link=native_link,
                              mirror_link=mirror_link)
     self.git_version = git_version
Пример #24
0
 def __init__(self, install_dir, bindings_dir, solver_version,
              mirror_link=None, lingeling_version=None):
     archive_name = "boolector-%s-with-lingeling-%s.tar.bz2" % \
                    (solver_version, lingeling_version)
     native_link = "http://fmv.jku.at/boolector/{archive_name}"
     SolverInstaller.__init__(self, install_dir=install_dir,
                              bindings_dir=bindings_dir,
                              solver_version=solver_version,
                              archive_name=archive_name,
                              native_link=native_link,
                              mirror_link=mirror_link)
Пример #25
0
    def move(self):
        bpath = os.path.join(self.extract_path, "bin")
        files = ["python/z3"]
        if self.os_name == "linux":
            files += ["libz3.so"]
        elif self.os_name == "darwin":
            files += ["libz3.a", "libz3.dylib"]
        elif self.os_name == "windows":
            files += ["libz3.dll", "libz3.lib"]

        for f in files:
            SolverInstaller.mv(os.path.join(bpath, f), self.bindings_dir)
Пример #26
0
    def compile(self):
        # Prepare an empty folder for installing yices
        SolverInstaller.clean_dir(self.yices_path)

        SolverInstaller.run("autoconf", directory=self.extract_path)

        SolverInstaller.run("bash configure --prefix %s" % self.yices_path,
                            directory=self.extract_path)
        SolverInstaller.run("make", directory=self.extract_path)
        SolverInstaller.run("make install", directory=self.extract_path)

        self.install_yicespy()
Пример #27
0
 def __init__(self, install_dir, bindings_dir, solver_version,
              mirror_link=None, git_version='HEAD'):
     archive_name = "CVC4-%s.tar.gz" % git_version
     native_link = "https://codeload.github.com/CVC4/CVC4/tar.gz/%s" % (git_version)
     SolverInstaller.__init__(self, install_dir=install_dir,
                              bindings_dir=bindings_dir,
                              solver_version=solver_version,
                              archive_name=archive_name,
                              native_link=native_link,
                              mirror_link=mirror_link)
     self.git_version = git_version
     self.bin_path = os.path.join(self.bindings_dir, "CVC4_bin")
Пример #28
0
 def __init__(self, install_dir, bindings_dir, solver_version,
              mirror_link=None, git_version='HEAD'):
     archive_name = "CVC4-%s.tar.gz" % git_version
     native_link = "https://codeload.github.com/CVC4/CVC4/tar.gz/%s" % (git_version)
     SolverInstaller.__init__(self, install_dir=install_dir,
                              bindings_dir=bindings_dir,
                              solver_version=solver_version,
                              archive_name=archive_name,
                              native_link=native_link,
                              mirror_link=mirror_link)
     self.git_version = git_version
     self.bin_path = os.path.join(self.bindings_dir, "CVC4_bin")
Пример #29
0
 def move(self):
     bpath = os.path.join(self.extract_path, "bin")
     files = [
         "z3consts.py", "z3core.py", "z3num.py", "z3poly.py",
         "z3printer.py", "z3.py", "z3rcf.py", "z3test.py", "z3types.py",
         "z3util.py"
     ]
     if self.os_name == "linux":
         files += ["libz3.so"]
     elif self.os_name == "darwin":
         files += ["libz3.a", "libz3.dylib"]
     for f in files:
         SolverInstaller.mv(os.path.join(bpath, f), self.bindings_dir)
Пример #30
0
    def download(self):
        self.complete_version = "%s.%s" % (self.solver_version,
                                           self.pypicosat_minor_version)
        pypi_link = "http://pypi.python.org/pypi/pyPicoSAT/%s/json" % self.complete_version
        response = urllib2.urlopen(pypi_link)
        reader = codecs.getreader("utf-8")
        pypi_json = json.load(reader(response))

        self.native_link = pypi_json["urls"][0]["url"]
        self.archive_name = pypi_json["urls"][0]["filename"]
        self.archive_path = os.path.join(self.base_dir, self.archive_name)
        self.extract_path = os.path.join(self.base_dir, self.archive_name[:-7])

        SolverInstaller.download(self)
Пример #31
0
    def compile(self):
        # Prepare an empty folder for installing yices
        SolverInstaller.clean_dir(self.yices_path)

        if self.needs_compilation:
            SolverInstaller.run("bash configure --prefix %s" % self.yices_path,
                                directory=self.extract_path)
            SolverInstaller.run("make", directory=self.extract_path)
            SolverInstaller.run("make install", directory=self.extract_path)
        else:
            SolverInstaller.run("bash ./install-yices %s" % self.yices_path,
                                directory=self.extract_path)

        self.install_yicespy()
Пример #32
0
    def compile(self):
        # Prepare the building system
        SolverInstaller.run("bash autogen.sh", directory=self.extract_path)

        # Build ANTLR
        SolverInstaller.run("bash get-antlr-3.4",
                            directory=os.path.join(self.extract_path, "contrib"))

        # Configure and build CVC4
        config = "./configure --prefix={bin_path} \
                              --enable-language-bindings=python \
                              --with-antlr-dir={dir_path}/antlr-3.4 ANTLR={dir_path}/antlr-3.4/bin/antlr3;\
                  make; \
                  make install ".format(bin_path=self.bin_path, dir_path=self.extract_path)
        if os.path.exists(sys.executable+"-config"):
            pyconfig = {"PYTHON_CONFIG": sys.executable+"-config"}
        else:
            pyconfig = {}
        SolverInstaller.run(config,
                            directory=self.extract_path,
                            env_variables=pyconfig)

        # Fix the paths of the bindings
        SolverInstaller.run("cp CVC4.so.3.0.0 _CVC4.so",
                            directory=os.path.join(self.bin_path, "lib/pyshared"))
Пример #33
0
    def compile(self):
        # Prepare the building system
        SolverInstaller.run("bash autogen.sh", directory=self.extract_path)

        # Build ANTLR
        SolverInstaller.run("bash get-antlr-3.4",
                            directory=os.path.join(self.extract_path,
                                                   "contrib"))

        # Configure and build CVC4
        config = "./configure --prefix={bin_path} \
                              --enable-language-bindings=python \
                              --with-antlr-dir={dir_path}/antlr-3.4 ANTLR={dir_path}/antlr-3.4/bin/antlr3;\
                  make; \
                  make install ".format(bin_path=self.bin_path,
                                        dir_path=self.extract_path)
        if os.path.exists(sys.executable + "-config"):
            pyconfig = {"PYTHON_CONFIG": sys.executable + "-config"}
        else:
            pyconfig = {}
        SolverInstaller.run(config,
                            directory=self.extract_path,
                            env_variables=pyconfig)

        # Fix the paths of the bindings
        SolverInstaller.run("cp CVC4.so.3.0.0 _CVC4.so",
                            directory=os.path.join(self.bin_path,
                                                   "lib/pyshared"))
Пример #34
0
    def __init__(self, install_dir, bindings_dir, solver_version,
                 mirror_link=None):
        pack = "x86_64-unknown-linux-gnu-static-gmp"
        archive_name = "yices-%s-%s.tar.gz" % (solver_version, pack)
        native_link = "http://yices.csl.sri.com/cgi-bin/yices2-newnewdownload.cgi?file={archive_name}&accept=I+Agree"
        SolverInstaller.__init__(self, install_dir=install_dir,
                                 bindings_dir=bindings_dir,
                                 solver_version=solver_version,
                                 archive_name=archive_name,
                                 native_link=native_link,
                                 mirror_link=mirror_link)

        self.extract_path = os.path.join(self.base_dir, "yices-%s" % self.solver_version)
        self.yices_path = os.path.join(self.bindings_dir, "yices_bin")
Пример #35
0
    def move(self):
        bpath = os.path.join(self.extract_path, "bin")
        files = [os.path.join(bpath, "python/z3")]
        if self.os_name == "linux":
            files += glob.glob(bpath + '/*.so')
        elif self.os_name == "darwin":
            files += glob.glob(bpath + '/*.a')
            files += glob.glob(bpath + '/*.dylib')
        elif self.os_name == "windows":
            files += glob.glob(bpath + '/*.dll')
            files += glob.glob(bpath + '/*.lib')

        for f in files:
            SolverInstaller.mv(f, self.bindings_dir)
Пример #36
0
    def move(self):
        libdir = "lib.%s-%s-%s" % (self.os_name, self.architecture,
                                   self.python_version)
        if self.os_name == "darwin":
            osx_version = ".".join(platform.mac_ver()[0].split(".")[:2])
            libdir = libdir.replace("darwin", "macosx-%s" % osx_version)
        pdir = self.python_bindings_dir
        bdir = os.path.join(pdir, "build")
        sodir = os.path.join(bdir, libdir)

        for f in os.listdir(sodir):
            if f.endswith(".so"):
                SolverInstaller.mv(os.path.join(sodir, f), self.bindings_dir)
        SolverInstaller.mv(os.path.join(pdir, "mathsat.py"), self.bindings_dir)
Пример #37
0
    def compile(self):
        # Build ANTLR
        SolverInstaller.run("bash get-antlr-3.4",
                            directory=os.path.join(self.extract_path, "contrib"))

        # Build ABC
        # SolverInstaller.run("bash get-abc",
        #                     directory=os.path.join(self.extract_path, "contrib"))
        # Build GLPK
        # We could configure with --gpl --best, but this takes forever to build

        # Inject Python library and include paths into CMake because CVC4 search
        # system can be fooled in some systems
        import distutils.sysconfig as sysconfig
        PYTHON_LIBRARY = sysconfig.get_config_var('LIBDIR')
        PYTHON_INCLUDE_DIR = sysconfig.get_python_inc()
        SolverInstaller.run(['sed', '-i',
                             's|cmake_opts=""|cmake_opts="-DPYTHON_LIBRARY=' + PYTHON_LIBRARY + ' -DPYTHON_INCLUDE_DIR=' + PYTHON_INCLUDE_DIR + '"|g',
                             './configure.sh'], directory=self.extract_path)

        # Configure and build CVC4
        config_cmd = "./configure.sh --language-bindings=python \
                                     --python%s" % self.python_version[0]

        if os.path.exists(sys.executable+"-config"):
            pyconfig = {"PYTHON_CONFIG": sys.executable+"-config"}
        else:
            pyconfig = {}

        SolverInstaller.run(config_cmd, directory=self.extract_path,
                            env_variables=pyconfig)
        SolverInstaller.run("make", directory=self.build_path,
                            env_variables=pyconfig)
Пример #38
0
    def download(self):
        self.complete_version = "%s.%s" % (self.solver_version,
                                           self.pypicosat_minor_version)
        pypi_link = "http://pypi.python.org/pypi/pyPicoSAT/%s/json" % self.complete_version
        response = urllib2.urlopen(pypi_link)
        reader = codecs.getreader("utf-8")
        pypi_json = json.load(reader(response))

        self.native_link = pypi_json["urls"][0]["url"]
        self.archive_name = pypi_json["urls"][0]["filename"]
        self.archive_path = os.path.join(self.base_dir, self.archive_name)
        self.extract_path = os.path.join(self.base_dir, self.archive_name[:-7])

        SolverInstaller.download(self)
Пример #39
0
    def move(self):
        pdir = self.python_bindings_dir
        bdir = os.path.join(pdir, "build")
        sodir = glob.glob(bdir + "/lib.*")[0]
        libdir = os.path.join(self.python_bindings_dir, "../lib")

        # First, we need the SWIG-generated wrapper
        for f in os.listdir(sodir):
            if f.endswith(".so") or f.endswith(".pyd"):
                SolverInstaller.mv(os.path.join(sodir, f), self.bindings_dir)
        SolverInstaller.mv(os.path.join(pdir, "mathsat.py"), self.bindings_dir)

        # Since MathSAT 5.5.0 we also need the SO/DLL/DYLIB of mathsat in the PATH
        # Under Windows, we also need the DLLs of MPIR in the PATH
        for f in os.listdir(libdir):
            if f.endswith(".so") or f.endswith(".dll") or f.endswith(".dylib"):
                SolverInstaller.mv(os.path.join(libdir, f), self.bindings_dir)

        # Fix issue in MathSAT 5.5.1 linking to incorrect directory on OSX
        if self.os_name == "darwin":
            soname = glob.glob(self.bindings_dir + "/_mathsat*.so")[0]
            old_path = "/Users/griggio/Documents/src/mathsat_release/build/libmathsat.dylib"
            new_path = "%s/libmathsat.dylib" % self.bindings_dir
            SolverInstaller.run("install_name_tool -change %s %s %s" %
                                (old_path, new_path, soname))
Пример #40
0
    def move(self):
        libdir = "lib.%s-%s-%s" % (self.os_name, self.architecture,
                                   self.python_version)
        if self.os_name == "darwin":
            osx_version = ".".join(platform.mac_ver()[0].split(".")[:2])
            libdir = libdir.replace("darwin", "macosx-%s" % osx_version)
        pdir = self.python_bindings_dir
        bdir = os.path.join(pdir, "build")
        sodir = os.path.join(bdir, libdir)

        for f in os.listdir(sodir):
            if f.endswith(".so"):
                SolverInstaller.mv(os.path.join(sodir, f), self.bindings_dir)
        SolverInstaller.mv(os.path.join(pdir, "mathsat.py"), self.bindings_dir)
Пример #41
0
    def compile(self):
        # Prepare an empty folder for installing yices
        SolverInstaller.clean_dir(self.yices_path)

        if self.needs_compilation:
            SolverInstaller.run("bash configure --prefix %s" % self.yices_path,
                                directory=self.extract_path)
            SolverInstaller.run("make", directory=self.extract_path)
            SolverInstaller.run("make install", directory=self.extract_path)
        else:
            SolverInstaller.run("bash ./install-yices %s" % self.yices_path,
                                directory=self.extract_path)

        self.install_yicespy()
Пример #42
0
    def move(self):
        pdir = self.python_bindings_dir
        bdir = os.path.join(pdir, "build")
        sodir = glob.glob(bdir + "/lib.*")[0]
        libdir = os.path.join(self.python_bindings_dir, "../lib")

        # First, we need the SWIG-generated wrapper
        for f in os.listdir(sodir):
            if f.endswith(".so") or f.endswith(".pyd"):
                SolverInstaller.mv(os.path.join(sodir, f), self.bindings_dir)
        SolverInstaller.mv(os.path.join(pdir, "mathsat.py"), self.bindings_dir)

        # Since MathSAT 5.5.0 we also need the SO/DLL/DYLIB of mathsat in the PATH
        # Under Windows, we also need the DLLs of MPIR in the PATH
        for f in os.listdir(libdir):
            if f.endswith(".so") or f.endswith(".dll") or f.endswith(".dylib"):
                SolverInstaller.mv(os.path.join(libdir, f), self.bindings_dir)

        # Fix issue in MathSAT 5.5.1 linking to incorrect directory on OSX
        if self.os_name == "darwin":
            soname = glob.glob(self.bindings_dir + "/_mathsat*.so")[0]
            old_path = "/Users/griggio/Documents/src/mathsat_release/build/libmathsat.dylib"
            new_path = "%s/libmathsat.dylib" % self.bindings_dir
            SolverInstaller.run("install_name_tool -change %s %s %s" %
                                (old_path, new_path, soname))
Пример #43
0
    def compile(self):
        # First build
        SolverInstaller.run("make", directory=self.extract_path)

        # Reconfigure and build python bindings
        SolverInstaller.run("bash ./configure.sh -fPIC",
                          directory=os.path.join(self.extract_path, "lingeling"))
        SolverInstaller.run("make",
                          directory=os.path.join(self.extract_path, "lingeling"))

        SolverInstaller.run("bash ./configure -python",
                          directory=os.path.join(self.extract_path, "boolector"))
        SolverInstaller.run("make",
                          directory=os.path.join(self.extract_path, "boolector"))
Пример #44
0
    def __init__(self, install_dir, bindings_dir, solver_version,
                 mirror_link=None):
        archive_name = "mathsat-%s-%s-%s.tar.gz" % (solver_version,
                                                    self.os_name,
                                                    self.architecture)
        native_link = "http://mathsat.fbk.eu/download.php?file={archive_name}"
        SolverInstaller.__init__(self, install_dir=install_dir,
                                 bindings_dir=bindings_dir,
                                 solver_version=solver_version,
                                 archive_name=archive_name,
                                 native_link = native_link,
                                 mirror_link=mirror_link)

        self.python_bindings_dir = os.path.join(self.extract_path, "python")
Пример #45
0
    def __init__(self, install_dir, bindings_dir, solver_version,
                 mirror_link=None, yicespy_version='HEAD'):

        archive_name = "Yices-%s.tar.gz" % (solver_version)
        native_link = "https://github.com/SRI-CSL/yices2/archive/{archive_name}"
        SolverInstaller.__init__(self, install_dir=install_dir,
                                 bindings_dir=bindings_dir,
                                 solver_version=solver_version,
                                 archive_name=archive_name,
                                 native_link=native_link,
                                 mirror_link=mirror_link)

        self.extract_path = os.path.join(self.base_dir, "yices2-Yices-%s" % self.solver_version)
        self.yices_path = os.path.join(self.bindings_dir, "yices_bin")
        self.yicespy_git_version = yicespy_version
Пример #46
0
    def compile(self):
        # Select the correct Makefile to be used
        makefile = "Makefile"
        if self.architecture == "x86_64":
            makefile = "Makefile_64bit"

        # Build the pycudd
        command = ['python%s-config' % self.python_version, '--prefix']
        p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=None)
        prefix = p.stdout.read()

        if not prefix or len(prefix) == 0:
            prefix = "/usr"

        SolverInstaller.run("make -C %s -f %s PYTHON_VER=python%s" \
                            " PYTHON_LOC=%s" % (self.extract_path, makefile,
                                                self.python_version, prefix))
Пример #47
0
 def move(self):
     bpath = os.path.join(self.extract_path, "bin")
     files = [
         "libz3.so",
         "z3consts.py",
         "z3core.py",
         "z3num.py",
         "z3poly.py",
         "z3printer.py",
         "z3.py",
         "z3rcf.py",
         "z3test.py",
         "z3types.py",
         "z3util.py",
     ]
     for f in files:
         SolverInstaller.mv(os.path.join(bpath, f), self.bindings_dir)
Пример #48
0
    def compile(self):
        # First build
        SolverInstaller.run("make", directory=self.extract_path)

        # Reconfigure and build python bindings
        SolverInstaller.run("bash ./configure.sh -fPIC",
                            directory=os.path.join(self.extract_path,
                                                   "lingeling"))
        SolverInstaller.run("make",
                            directory=os.path.join(self.extract_path,
                                                   "lingeling"))

        SolverInstaller.run("bash ./configure -python",
                            directory=os.path.join(self.extract_path,
                                                   "boolector"))
        SolverInstaller.run("make",
                            directory=os.path.join(self.extract_path,
                                                   "boolector"))
Пример #49
0
    def __init__(self, install_dir, bindings_dir, solver_version,
                 pypicosat_minor_version, mirror_link=None):

        self.complete_version = "%s.%s" % (solver_version, pypicosat_minor_version)
        pypi_link = "http://pypi.python.org/pypi/pyPicoSAT/%s/json" % self.complete_version
        response = urllib2.urlopen(pypi_link)
        reader = codecs.getreader("utf-8")
        pypi_json = json.load(reader(response))

        pypicosat_download_link = pypi_json["urls"][0]["url"]
        archive_name = pypi_json["urls"][0]["filename"]
        SolverInstaller.__init__(self, install_dir=install_dir,
                                 bindings_dir=bindings_dir,
                                 solver_version=solver_version,
                                 mirror_link=mirror_link,
                                 native_link=pypicosat_download_link,
                                 archive_name=archive_name)
        self.extract_path = os.path.join(self.base_dir, archive_name[:-7])
Пример #50
0
    def __init__(self, install_dir, bindings_dir, solver_version,
                 mirror_link=None, git_version=None):
        native_link = "https://github.com/Boolector/boolector/archive/%s.tar.gz"
        archive_name = "boolector-%s.tar.gz"

        if git_version:
            native_link = native_link % git_version
            archive_name = archive_name % git_version
        else:
            native_link = native_link % solver_version
            archive_name = archive_name % solver_version

        SolverInstaller.__init__(self, install_dir=install_dir,
                                 bindings_dir=bindings_dir,
                                 solver_version=solver_version,
                                 archive_name=archive_name,
                                 native_link=native_link,
                                 mirror_link=mirror_link)
Пример #51
0
    def compile(self):
        # Select the correct Makefile to be used
        makefile = "Makefile"
        if self.architecture == "x86_64":
            makefile = "Makefile_64bit"

        swig = "swig"
        swig_version = SolverInstaller.run("swig -version", get_output=True)
        if '4.0.1' in swig_version or '4.0.0' in swig_version:
            print(
                "WARNING: the BDD solver does not work with Swig4 < 4.0.2. Fallback to Swig3"
            )
            swig = "swig3.0"  # This is the Ubuntu naming of the executable

        import distutils.sysconfig as sysconfig
        PYTHON_INCLUDE_DIR = sysconfig.get_python_inc()
        SolverInstaller.run(
            "make -C %s -f %s PYTHON_INCL=-I%s SWIG=%s" %
            (self.extract_path, makefile, PYTHON_INCLUDE_DIR, swig))
Пример #52
0
    def install_yicespy(self):
        yicespy_git_version = self.yicespy_git_version
        yicespy_base_name =  "yicespy"
        yicespy_archive_name = "%s.tar.gz" % yicespy_base_name
        yicespy_archive = os.path.join(self.base_dir, yicespy_archive_name)
        yicespy_dir_path = os.path.join(self.base_dir,
                                        yicespy_base_name + "-" + yicespy_git_version)

        yicespy_download_link = "https://codeload.github.com/pysmt/yicespy/tar.gz/%s" % (yicespy_git_version)
        SolverInstaller.do_download(yicespy_download_link, yicespy_archive)

        SolverInstaller.clean_dir(yicespy_dir_path)

        SolverInstaller.untar(yicespy_archive, self.base_dir)
        # Build yicespy
        SolverInstaller.run_python("setup.py --yices-dir=%s -- build_ext bdist_wheel --dist-dir=%s " % (self.yices_path, self.base_dir),
                                   directory=yicespy_dir_path)
        wheel_file = glob.glob(os.path.join(self.base_dir, "yicespy") + "*.whl")[0]
        SolverInstaller.unzip(wheel_file, self.bindings_dir)
Пример #53
0
    def install_yicespy(self):
        yicespy_git_version = self.yicespy_git_version
        yicespy_base_name =  "yicespy"
        yicespy_archive_name = "%s.tar.gz" % yicespy_base_name
        yicespy_archive = os.path.join(self.base_dir, yicespy_archive_name)
        yicespy_dir_path = os.path.join(self.base_dir,
                                        yicespy_base_name + "-" + yicespy_git_version)

        yicespy_download_link = "https://codeload.github.com/pysmt/yicespy/tar.gz/%s" % (yicespy_git_version)
        SolverInstaller.do_download(yicespy_download_link, yicespy_archive)

        SolverInstaller.clean_dir(yicespy_dir_path)

        SolverInstaller.untar(yicespy_archive, self.base_dir)
        # Build yicespy
        SolverInstaller.run_python("setup.py --yices-dir=%s -- build_ext bdist_wheel --dist-dir=%s " % (self.yices_path, self.base_dir),
                                   directory=yicespy_dir_path)
        wheel_file = glob.glob(os.path.join(self.base_dir, "yicespy") + "*.whl")[0]
        SolverInstaller.unzip(wheel_file, self.bindings_dir)
Пример #54
0
    def __init__(self,
                 install_dir,
                 bindings_dir,
                 solver_version,
                 mirror_link=None,
                 osx=None,
                 git_version=None,
                 commit=None):
        arch = self.architecture
        if arch == "x86_64":
            arch = "x64"

        system = self.os_name
        if system == "linux":
            system = "ubuntu-16.04"
        elif system == "darwin":
            system = "osx-%s" % osx
        elif system == "windows":
            system = "win"

        if git_version is None:
            # Stable versions template
            if commit:
                archive_name = "z3-%s.%s-%s-%s.zip" % (solver_version, commit,
                                                       arch, system)
            else:
                archive_name = "z3-%s-%s-%s.zip" % (solver_version, arch,
                                                    system)
            native_link = "https://github.com/Z3Prover/z3/releases/download/z3-" + solver_version + "/{archive_name}"
            # print(native_link)
        else:
            # Nightly build template
            archive_name = "z3-%s.%s-%s-%s.zip" % (solver_version, git_version,
                                                   arch, system)
            native_link = "https://github.com/pysmt/Z3bin/blob/master/nightly/{archive_name}?raw=true"

        SolverInstaller.__init__(self,
                                 install_dir=install_dir,
                                 bindings_dir=bindings_dir,
                                 solver_version=solver_version,
                                 archive_name=archive_name,
                                 native_link=native_link,
                                 mirror_link=mirror_link)
Пример #55
0
    def __init__(self, install_dir, bindings_dir, solver_version,
                 mirror_link=None, yicespy_version='HEAD'):
        
        if self.os_name == "darwin":
            pack = "x86_64-apple-darwin16.7.0-static-gmp"
        else:
            pack = "x86_64-pc-linux-gnu-static-gmp"

        archive_name = "yices-%s-%s.tar.gz" % (solver_version, pack)
        native_link = "http://yices.csl.sri.com/releases/{solver_version}/{archive_name}"
        SolverInstaller.__init__(self, install_dir=install_dir,
                                 bindings_dir=bindings_dir,
                                 solver_version=solver_version,
                                 archive_name=archive_name,
                                 native_link=native_link,
                                 mirror_link=mirror_link)

        self.extract_path = os.path.join(self.base_dir, "yices-%s" % self.solver_version)
        self.yices_path = os.path.join(self.bindings_dir, "yices_bin")
        self.yicespy_git_version = yicespy_version
Пример #56
0
    def __init__(self,
                 install_dir,
                 bindings_dir,
                 solver_version,
                 mirror_link=None):
        archive_name = "mathsat-%s-%s-%s.tar.gz" % (
            solver_version, self.os_name, self.architecture)
        if self.os_name == "darwin":
            archive_name = archive_name.replace("darwin", "darwin-libcxx")
        native_link = "http://mathsat.fbk.eu/download.php?file={archive_name}"

        SolverInstaller.__init__(self,
                                 install_dir=install_dir,
                                 bindings_dir=bindings_dir,
                                 solver_version=solver_version,
                                 archive_name=archive_name,
                                 native_link=native_link,
                                 mirror_link=mirror_link)

        self.python_bindings_dir = os.path.join(self.extract_path, "python")
Пример #57
0
    def compile(self):
        # Select the correct Makefile to be used
        makefile = "Makefile"
        if self.architecture == "x86_64":
            makefile = "Makefile_64bit"

        # Build the pycudd
        command = ['python%s-config' % self.python_version, '--includes']
        p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=None)
        prefix = p.stdout.read()
        if PY2:
            pass # Prefix is already a string
        else:
            # > PY3 Prefix is binary data
            prefix = prefix.decode()

        if not prefix or len(prefix) == 0:
            prefix = "/usr"

        SolverInstaller.run("make -C %s -f %s PYTHON_INCL=%s" %
                            (self.extract_path, makefile, prefix))
Пример #58
0
    def move(self):
        bpath = os.path.join(self.extract_path, "bin")
        files = ["z3consts.py",
                 "z3core.py",
                 "z3num.py",
                 "z3poly.py",
                 "z3printer.py",
                 "z3.py",
                 "z3rcf.py",
                 "z3test.py",
                 "z3types.py",
                 "z3util.py"]
        if self.os_name == "linux":
            files += [ "libz3.so" ]
        elif self.os_name == "darwin":
            files += [ "libz3.a", "libz3.dylib" ]
        elif self.os_name == "windows":
            files += [ "libz3.dll", "libz3.lib" ]

        for f in files:
            SolverInstaller.mv(os.path.join(bpath, f), self.bindings_dir)