示例#1
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))
示例#2
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)
示例#3
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/pyomt/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)
示例#4
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")
示例#5
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()
示例#6
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/pyomt/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
示例#7
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)
示例#8
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)
示例#9
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)
示例#10
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)
示例#11
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)
示例#12
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")
示例#13
0
    def __init__(self,
                 install_dir,
                 bindings_dir,
                 solver_version,
                 mirror_link=None,
                 yicespy_version='HEAD'):
        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")
        self.yicespy_git_version = yicespy_version
示例#14
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/pyomt/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)
示例#15
0
 def compile(self):
     picosat_dir = os.path.join(self.extract_path,
                                "picosat-%s" % self.solver_version)
     SolverInstaller.run('bash configure.sh',
                         directory=picosat_dir,
                         env_variables={"CFLAGS": " -fPIC"})
     SolverInstaller.run('make',
                         directory=picosat_dir,
                         env_variables={"CFLAGS": " -fPIC"})
     SolverInstaller.run_python("setup.py build",
                                directory=self.extract_path)
示例#16
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)
示例#17
0
 def move(self):
     bdir = os.path.join(self.extract_path, "boolector/build")
     for f in os.listdir(bdir):
         if f.startswith("boolector") and f.endswith(".so"):
             SolverInstaller.mv(os.path.join(bdir, f), self.bindings_dir)
示例#18
0
    def compile(self):
        import glob
        # Build lingeling
        lingeling_archive = glob.glob(
            os.path.join(self.extract_path, "archives",
                         "lingeling-*.tar.gz"))[0]
        SolverInstaller.untar(lingeling_archive, self.extract_path)
        lingeling_dir = glob.glob(os.path.join(self.extract_path,
                                               "lingeling*"))[0]
        SolverInstaller.mv(lingeling_dir,
                           os.path.join(self.extract_path, "lingeling"))
        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"))

        # Build Btor
        boolector_archive = glob.glob(
            os.path.join(self.extract_path, "archives",
                         "boolector-*.tar.gz"))[0]
        SolverInstaller.untar(boolector_archive, self.extract_path)
        boolector_dir = glob.glob(os.path.join(self.extract_path,
                                               "boolector*"))[0]
        SolverInstaller.mv(boolector_dir,
                           os.path.join(self.extract_path, "boolector"))

        SolverInstaller.run("bash ./configure.sh -python",
                            directory=os.path.join(self.extract_path,
                                                   "boolector"))
        SolverInstaller.run("make",
                            directory=os.path.join(self.extract_path,
                                                   "boolector"))

        # Redo this step to make sure the correct version of python is used
        SolverInstaller.run_python(
            "setup.py build_ext -b build -t build/api/python/tmp",
            directory=os.path.join(self.extract_path, "boolector"))
示例#19
0
    def compile(self):
        if self.os_name == "windows":
            libdir = os.path.join(self.python_bindings_dir, "../lib")
            incdir = os.path.join(self.python_bindings_dir, "../include")
            gmp_h_url = "https://github.com/mikand/tamer-windows-deps/raw/master/gmp/include/gmp.h"
            mpir_dll_url = "https://github.com/Legrandin/mpir-windows-builds/blob/master/mpir-2.6.0_VS2015_%s/mpir.dll?raw=true" % self.bits
            mpir_lib_url = "https://github.com/Legrandin/mpir-windows-builds/blob/master/mpir-2.6.0_VS2015_%s/mpir.lib?raw=true" % self.bits
            setup_py_win_url = "https://github.com/pyomt/solvers_patches/raw/master/mathsat/setup-win.py"

            SolverInstaller.do_download(gmp_h_url, os.path.join(incdir, "gmp.h"))
            SolverInstaller.do_download(mpir_dll_url, os.path.join(libdir, "mpir.dll"))
            SolverInstaller.do_download(mpir_lib_url, os.path.join(libdir, "mpir.lib"))

            # Overwrite setup.py with the patched version
            setup_py = os.path.join(self.python_bindings_dir, "setup.py")
            SolverInstaller.mv(setup_py, setup_py + ".original")
            SolverInstaller.do_download(setup_py_win_url, setup_py)

        # Run setup.py to compile the bindings
        SolverInstaller.run_python("./setup.py build", self.python_bindings_dir)
示例#20
0
 def move(self):
     SolverInstaller.mv(os.path.join(self.extract_path, "repycudd.py"),
                        self.bindings_dir)
     SolverInstaller.mv(os.path.join(self.extract_path, "_repycudd.so"),
                        self.bindings_dir)
示例#21
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_cmd = "./configure --prefix={bin_path} \
                                  --enable-language-bindings=python \
                                  --with-antlr-dir={dir_path}/antlr-3.4 ANTLR={dir_path}/antlr-3.4/bin/antlr3"

        config_cmd = config_cmd.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_cmd,
                            directory=self.extract_path,
                            env_variables=pyconfig)
        SolverInstaller.run("make",
                            directory=self.extract_path,
                            env_variables=pyconfig)
        SolverInstaller.run("make install",
                            directory=self.extract_path,
                            env_variables=pyconfig)

        # Fix the paths of the bindings
        SolverInstaller.mv(
            os.path.join(self.bin_path, "lib/pyshared/CVC4.so.4.0.0"),
            os.path.join(self.bin_path, "lib/pyshared/_CVC4.so"))