Example #1
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))
Example #2
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))
Example #3
0
 def compile(self):
     picosat_dir = os.path.join(self.extract_path, "picosat-%s" % self.solver_version)
     SolverInstaller.run('bash configure', 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)
Example #4
0
 def compile(self):
     picosat_dir = os.path.join(self.extract_path, "picosat-%s" % self.solver_version)
     SolverInstaller.run('bash configure', 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)
Example #5
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))
Example #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()
        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)

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

        SolverInstaller.run("make -j2",
                            directory=os.path.join(self.extract_path, "build"))
Example #7
0
    def compile(self):
        # Patch the distribution to avoid a known problem
        patch_name = "cvc4_wrapper.patch"
        plink = "https://raw.githubusercontent.com/pysmt/solvers_patches/master/%s" % patch_name
        SolverInstaller.do_download(
            plink, os.path.join(self.extract_path, patch_name))

        # Apply patch
        SolverInstaller.run("patch -p1 -i %s" % patch_name,
                            directory=self.extract_path)

        # 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)
        SolverInstaller.run(config, directory=self.extract_path)

        # 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"))
Example #8
0
    def compile(self):
        # Patch the distribution to avoid a known problem
        patch_name = "cvc4_wrapper.patch"
        plink = "https://raw.githubusercontent.com/pysmt/solvers_patches/master/%s" % patch_name
        SolverInstaller.do_download(plink, os.path.join(self.extract_path, patch_name))

        # Apply patch
        SolverInstaller.run("patch -p1 -i %s" % patch_name,
                            directory=self.extract_path)

        # 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)
        SolverInstaller.run(config, directory=self.extract_path)

        # 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"))
Example #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))
Example #10
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()
Example #11
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()
Example #12
0
File: bdd.py Project: 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))
Example #13
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))
Example #14
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"))
Example #15
0
File: btor.py Project: pysmt/pysmt
    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"))
Example #16
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"))
Example #17
0
File: cvc4.py Project: pysmt/pysmt
    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)
Example #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"))
Example #19
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"))
Example #20
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"))
Example #21
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))
Example #22
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"))
Example #23
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()
Example #24
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))
Example #25
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))
Example #26
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))
Example #27
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()
Example #28
0
File: yices.py Project: pysmt/pysmt
    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()
Example #29
0
File: cvc4.py Project: pysmt/pysmt
    def compile(self):
        # Build ANTLR

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

        # 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 = os.environ.get('PYSMT_PYTHON_LIBDIR')
        PYTHON_INCLUDE_DIR = sysconfig.get_python_inc()
        PYTHON_EXECUTABLE = sys.executable

        CMAKE_OPTS = '-DPYTHON_INCLUDE_DIR=' + PYTHON_INCLUDE_DIR
        CMAKE_OPTS += ' -DPYTHON_EXECUTABLE=' + PYTHON_EXECUTABLE
        if PYTHON_LIBRARY:
            CMAKE_OPTS += ' -DPYTHON_LIBRARY=' + PYTHON_LIBRARY

        SolverInstaller.run([
            'sed', '-i', 's|cmake_opts=""|cmake_opts="' + CMAKE_OPTS + '"|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 -j {}".format(multiprocessing.cpu_count()),
                            directory=self.build_path,
                            env_variables=pyconfig)
Example #30
0
    def compile(self):
        # Build ANTLR

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

        # 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 = os.environ.get('PYSMT_PYTHON_LIBDIR')
        if not PYTHON_LIBRARY:
            PYTHON_LIBRARY = sysconfig.get_config_var('LIBDIR')
        PYTHON_INCLUDE_DIR = sysconfig.get_python_inc()

        # 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)
Example #31
0
    def compile(self):
        # Prepare the building system
        SolverInstaller.run("bash autogen.sh", directory=self.extract_path)

        # Fix url of ANTLR
        SolverInstaller.run(
            "sed -i .bak s/http/https/g ./contrib/get-antlr-3.4",
            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 \
                                  --disable-dependency-tracking"

        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"))
Example #32
0
    def compile(self):
        # Extract sub-archives
        SolverInstaller.run("tar xf archives/lingeling*.tar.gz",
                            directory=self.extract_path)
        SolverInstaller.run("mv lingeling* lingeling",
                            directory=self.extract_path)
        SolverInstaller.run("tar xf archives/boolector*.tar.gz",
                            directory=self.extract_path)
        SolverInstaller.run("mv boolector* boolector",
                            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.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"))